diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/alpha/gen/rfork_thread.S | 65 | ||||
-rw-r--r-- | lib/libc/gen/basename.3 | 99 | ||||
-rw-r--r-- | lib/libc/gen/basename.c | 76 | ||||
-rw-r--r-- | lib/libc/gen/dirname.3 | 106 | ||||
-rw-r--r-- | lib/libc/gen/dirname.c | 79 | ||||
-rw-r--r-- | lib/libc/i386/gen/rfork_thread.S | 112 | ||||
-rw-r--r-- | lib/libc/i386/sys/i386_clr_watch.c | 50 | ||||
-rw-r--r-- | lib/libc/i386/sys/i386_set_watch.3 | 103 | ||||
-rw-r--r-- | lib/libc/i386/sys/i386_set_watch.c | 88 |
9 files changed, 0 insertions, 778 deletions
diff --git a/lib/libc/alpha/gen/rfork_thread.S b/lib/libc/alpha/gen/rfork_thread.S deleted file mode 100644 index ff0ed2c5acc2e..0000000000000 --- a/lib/libc/alpha/gen/rfork_thread.S +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "SYS.h" -#include <sys/syscall.h> -/* #include <machine/pal.h> */ - -/* - * This is pretty evil and based mostly on examples from other syscall - * stubs and code that gcc generated. Correctness is uncertain, but it - * seems to work quite happily. - */ -LEAF(rfork_thread, 1) - br gp,L1 /* XXX profiling */ -L1: - LDGP(pv) - lda sp,-16(sp) - stq ra,0(sp) - mov a3,a5 - CALLSYS_ERROR(rfork) - beq v0,$child - addl v0,zero,v0 - ldq ra,0(sp) - lda sp,16(sp) - RET -$child: - mov a1,sp - lda sp,-16(sp) - stq zero,0(sp) - mov a5,a0 - mov a2,t12 - jsr ra,(t12),0 - ldgp gp,0(ra) - mov v0,a0 -#ifdef SYS_exit - CALLSYS_NOERROR(exit) -#else - CALLSYS_NOERROR(sys_exit) -#endif -END(rfork_thread) diff --git a/lib/libc/gen/basename.3 b/lib/libc/gen/basename.3 deleted file mode 100644 index 7ed2b1fbd7c4b..0000000000000 --- a/lib/libc/gen/basename.3 +++ /dev/null @@ -1,99 +0,0 @@ -.\" -.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $OpenBSD: basename.3,v 1.12 2000/04/18 03:01:25 aaron Exp $ -.\" $FreeBSD$ -.\" -.Dd August 17, 1997 -.Dt BASENAME 3 -.Os -.Sh NAME -.Nm basename -.Nd extract the base portion of a pathname -.Sh SYNOPSIS -.Fd #include <libgen.h> -.Ft char * -.Fn basename "const char *path" -.Sh DESCRIPTION -The -.Fn basename -function -returns the last component from the pathname pointed to by -.Ar path , -deleting any trailing -.Sq \&/ -characters. -If -.Ar path -consists entirely of -.Sq \&/ -characters, a pointer to the string -.Qq \&/ -is returned. -If -.Ar path -is a null pointer or the empty string, a pointer to the string -.Qq \&. -is returned. -.Sh RETURN VALUES -On successful completion, -.Fn basename -returns a pointer to the last component of -.Ar path . -.Pp -If -.Fn basename -fails, a null pointer is returned and the global variable -.Va errno -is set to indicate the error. -.Sh ERRORS -The following error codes may be set in -.Va errno : -.Bl -tag -width Er -.It Bq Er ENAMETOOLONG -The path component to be returned was larger than -.Dv MAXPATHLEN . -.El -.Sh WARNINGS -.Fn basename -returns a pointer to internal static storage space that will be overwritten -by subsequent calls. -.Sh SEE ALSO -.Xr basename 1 , -.Xr dirname 1 , -.Xr dirname 3 -.Sh STANDARDS -The -.Fn basename -function conforms to -.St -xpg4.2 . -.Sh HISTORY -The -.Fn basename -function first appeared in -.Ox 2.2 . -.Sh AUTHOR -Todd C. Miller <Todd.Miller@courtesan.com> diff --git a/lib/libc/gen/basename.c b/lib/libc/gen/basename.c deleted file mode 100644 index b68ef3f1dd787..0000000000000 --- a/lib/libc/gen/basename.c +++ /dev/null @@ -1,76 +0,0 @@ -/* $OpenBSD: basename.c,v 1.4 1999/05/30 17:10:30 espie Exp $ */ -/* $FreeBSD$ */ - -/* - * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static char rcsid[] = "$OpenBSD: basename.c,v 1.4 1999/05/30 17:10:30 espie Exp $"; -#endif /* not lint */ - -#include <errno.h> -#include <libgen.h> -#include <string.h> -#include <sys/param.h> - -char * -basename(path) - const char *path; -{ - static char bname[MAXPATHLEN]; - register const char *endp, *startp; - - /* Empty or NULL string gets treated as "." */ - if (path == NULL || *path == '\0') { - (void)strcpy(bname, "."); - return(bname); - } - - /* Strip trailing slashes */ - endp = path + strlen(path) - 1; - while (endp > path && *endp == '/') - endp--; - - /* All slashes becomes "/" */ - if (endp == path && *endp == '/') { - (void)strcpy(bname, "/"); - return(bname); - } - - /* Find the start of the base */ - startp = endp; - while (startp > path && *(startp - 1) != '/') - startp--; - - if (endp - startp + 1 > sizeof(bname)) { - errno = ENAMETOOLONG; - return(NULL); - } - (void)strncpy(bname, startp, endp - startp + 1); - bname[endp - startp + 1] = '\0'; - return(bname); -} diff --git a/lib/libc/gen/dirname.3 b/lib/libc/gen/dirname.3 deleted file mode 100644 index f209019ee63ff..0000000000000 --- a/lib/libc/gen/dirname.3 +++ /dev/null @@ -1,106 +0,0 @@ -.\" -.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $OpenBSD: dirname.3,v 1.9 2000/04/18 03:01:25 aaron Exp $ -.\" $FreeBSD$ -.\" -.Dd August 17, 1997 -.Dt DIRNAME 3 -.Os -.Sh NAME -.Nm dirname -.Nd extract the directory portition of a pathname -.Sh SYNOPSIS -.Fd #include <libgen.h> -.Ft char * -.Fn dirname "const char *path" -.Sh DESCRIPTION -The -.Fn dirname -function -is the converse of -.Xr basename 3 ; -it returns a pointer to the parent directory of the pathname pointed to by -.Ar path . -Any trailing -.Sq \&/ -characters are not counted as part of the directory -name. -If -.Ar path -is a null pointer, the empty string, or contains no -.Sq \&/ -characters, -.Fn dirname -returns a pointer to the string -.Qq \&. , -signifying the current directory. -.Sh RETURN VALUES -On successful completion, -.Fn dirname -returns a pointer to the parent directory of -.Ar path . -.Pp -If -.Fn dirname -fails, a null pointer is returned and the global variable -.Va errno -is set to indicate the error. -.Sh ERRORS -The following error codes may be set in -.Va errno : -.Bl -tag -width Er -.It Bq Er ENAMETOOLONG -The path component to be returned was larger than -.Dv MAXPATHLEN . -.El -.Sh WARNINGS -.Fn dirname -returns a pointer to internal static storage space that will be overwritten -by subsequent calls (each function has its own separate storage). -.Pp -Other vendor implementations of -.Fn dirname -may modify the contents of the string passed to -.Fn dirname ; -this should be taken into account when writing code which calls this function -if portability is desired. -.Sh SEE ALSO -.Xr basename 1 , -.Xr dirname 1 , -.Xr basename 3 -.Sh STANDARDS -The -.Fn dirname -function conforms to -.St -xpg4.2 . -.Sh HISTORY -The -.Fn dirname -function first appeared in -.Ox 2.2 . -.Sh AUTHOR -Todd C. Miller <Todd.Miller@courtesan.com> diff --git a/lib/libc/gen/dirname.c b/lib/libc/gen/dirname.c deleted file mode 100644 index 5f6019e70f806..0000000000000 --- a/lib/libc/gen/dirname.c +++ /dev/null @@ -1,79 +0,0 @@ -/* $OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $ */ -/* $FreeBSD$ */ - -/* - * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static char rcsid[] = "$OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $"; -#endif /* not lint */ - -#include <errno.h> -#include <libgen.h> -#include <string.h> -#include <sys/param.h> - -char * -dirname(path) - const char *path; -{ - static char bname[MAXPATHLEN]; - register const char *endp; - - /* Empty or NULL string gets treated as "." */ - if (path == NULL || *path == '\0') { - (void)strcpy(bname, "."); - return(bname); - } - - /* Strip trailing slashes */ - endp = path + strlen(path) - 1; - while (endp > path && *endp == '/') - endp--; - - /* Find the start of the dir */ - while (endp > path && *endp != '/') - endp--; - - /* Either the dir is "/" or there are no slashes */ - if (endp == path) { - (void)strcpy(bname, *endp == '/' ? "/" : "."); - return(bname); - } else { - do { - endp--; - } while (endp > path && *endp == '/'); - } - - if (endp - path + 1 > sizeof(bname)) { - errno = ENAMETOOLONG; - return(NULL); - } - (void)strncpy(bname, path, endp - path + 1); - bname[endp - path + 1] = '\0'; - return(bname); -} diff --git a/lib/libc/i386/gen/rfork_thread.S b/lib/libc/i386/gen/rfork_thread.S deleted file mode 100644 index 2d63b67c7d0ca..0000000000000 --- a/lib/libc/i386/gen/rfork_thread.S +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * With thanks to John Dyson for the original version of this. - */ - -#include <SYS.h> - -/* - * 8 12 16 20 - * rfork_thread(flags, stack_addr, start_fnc, start_arg); - * - * flags: Flags to rfork system call. See rfork(2). - * stack_addr: Top of stack for thread. - * start_fnc: Address of thread function to call in child. - * start_arg: Argument to pass to the thread function in child. - */ - -ENTRY(rfork_thread) - pushl %ebp - movl %esp, %ebp - pushl %esi - - /* - * Push thread info onto the new thread's stack - */ - movl 12(%ebp), %esi # get stack addr - - subl $4, %esi - movl 20(%ebp), %eax # get start argument - movl %eax, (%esi) - - subl $4, %esi - movl 16(%ebp), %eax # get start thread address - movl %eax, (%esi) - - /* - * Prepare and execute the thread creation syscall - */ - pushl 8(%ebp) - pushl $0 - leal SYS_rfork, %eax - KERNCALL - jb 2f - - /* - * Check to see if we are in the parent or child - */ - cmpl $0, %edx - jnz 1f - addl $8, %esp - popl %esi - movl %ebp, %esp - popl %ebp - ret - .p2align 2 - - /* - * If we are in the child (new thread), then - * set-up the call to the internal subroutine. If it - * returns, then call __exit. - */ -1: - movl %esi,%esp - popl %eax - call *%eax - addl $4, %esp - - /* - * Exit system call - */ - pushl %eax - pushl $0 -#ifdef SYS_exit - leal SYS_exit, %eax -#else - leal SYS_sys_exit, %eax -#endif - KERNCALL - - /* - * Branch here if the thread creation fails: - */ -2: - PIC_PROLOGUE - jmp PIC_PLT(HIDENAME(cerror)) diff --git a/lib/libc/i386/sys/i386_clr_watch.c b/lib/libc/i386/sys/i386_clr_watch.c deleted file mode 100644 index 0320634ca76d3..0000000000000 --- a/lib/libc/i386/sys/i386_clr_watch.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2000 Brian S. Dean <bsd@bsdhome.com> - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BRIAN S. DEAN ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BRIAN S. DEAN BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - */ - -/* - * $FreeBSD$ - */ - - -#include <machine/reg.h> -#include <machine/sysarch.h> - - -int -i386_clr_watch(int watchnum, struct dbreg * d) -{ - - if (watchnum < 0 || watchnum >= 4) - return -1; - - d->dr7 = d->dr7 & ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16))); - DBREG_DRX(d,watchnum) = 0; - - return 0; -} diff --git a/lib/libc/i386/sys/i386_set_watch.3 b/lib/libc/i386/sys/i386_set_watch.3 deleted file mode 100644 index a85ae85c7b5e1..0000000000000 --- a/lib/libc/i386/sys/i386_set_watch.3 +++ /dev/null @@ -1,103 +0,0 @@ -.\" Copyright (c) 2000 Brian S. Dean -.\" All rights reserved. -.\" -.\" This man-page is based on a similar man-page by Jonathan Lemon -.\" which is copyrighted under the following conditions: -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd August 24, 2000 -.Os -.Dt I386_SET_WATCH 3 -.Sh NAME -.Nm i386_clr_watch , -.Nm i386_set_watch -.Nd manage i386 debug register values -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.Fd #include <machine/reg.h> -.Fd #include <machine/sysarch.h> -.Ft int -.Fn i386_clr_watch "int watchnum" "struct dbreg *d" -.Ft int -.Fn i386_set_watch "int watchnum" "unsigned int watchaddr" "int size" "int access" "struct dbreg *d" -.Sh DESCRIPTION -.Fn i386_clr_watch -will disable the indicated watch point within the specified debug -register set. -.Pp -.Fn i386_set_watch -will set up the specified debug registers as indicated by the -parameters. The -.Fa watchnum -argument specifies which watch register is used, 0, 1, 2, 3, or -1. If -.Fa watchnum -is -1, a free watch register is found and used. If there are no free -watch registers, an error code of -1 is returned. -.Fa Watchaddr -specifies the watch address, -.Fa size -specifies the size in bytes of the area to be watched (1, 2, or 4 bytes), -and -.Fa access -specifes the type of watch point: -.Pp -.Bd -literal -offset indent -compact -DBREG_DR7_EXEC An execution breakpoint. -DBREG_DR7_WRONLY Break only when the watch area is written to. -DBREG_DR7_RDWR Break when the watch area is read from or written - to. -.Ed -.Pp -Note that these functions do not actually set or clear breakpoints; -they manipulate the indicated debug register set. You must use -.Xr ptrace 2 -to retrieve and install the debug register values for a process. -.Sh RETURN VALUES -.Fn i386_clr_watch -returns 0 on success, or -1 if -.Fa watchnum -is invalid (not in the range of 0-3). -.Pp -.Fn i386_set_watch -will return the -.Fa watchnum -argument, or the watchnum actually used in the case that -.Fa watchnum -is -1 on success. On error, -.Fn i386_set_watch -will return -1 indicating that the watchpoint could not be set up -because either no more watchpoints are available, or -.Fa watchnum , -.Fa size , -or -.Fa access -is invalid. -.Sh SEE ALSO -.Xr ptrace 2 , -.Xr procfs 5 -.Sh AUTHORS -This man page was written by -.An Brian S. Dean . diff --git a/lib/libc/i386/sys/i386_set_watch.c b/lib/libc/i386/sys/i386_set_watch.c deleted file mode 100644 index bb710dc701c3f..0000000000000 --- a/lib/libc/i386/sys/i386_set_watch.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2000 Brian S. Dean <bsd@bsdhome.com> - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BRIAN S. DEAN ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BRIAN S. DEAN BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - */ - -/* - * $FreeBSD$ - */ - - -#include <machine/reg.h> -#include <machine/sysarch.h> - - -int -i386_set_watch(int watchnum, unsigned int watchaddr, int size, - int access, struct dbreg * d) -{ - int i; - unsigned int mask; - - if (watchnum == -1) { - for (i = 0, mask = 0x3; i < 4; i++, mask <<= 2) - if ((d->dr7 & mask) == 0) - break; - if (i < 4) - watchnum = i; - else - return -1; - } - - switch (access) { - case DBREG_DR7_EXEC: - size = 1; /* size must be 1 for an execution breakpoint */ - /* fall through */ - case DBREG_DR7_WRONLY: - case DBREG_DR7_RDWR: - break; - default : return -1; break; - } - - /* - * we can watch a 1, 2, or 4 byte sized location - */ - switch (size) { - case 1 : mask = 0x00; break; - case 2 : mask = 0x01 << 2; break; - case 4 : mask = 0x03 << 2; break; - default : return -1; break; - } - - mask |= access; - - /* clear the bits we are about to affect */ - d->dr7 &= ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16))); - - /* set drN register to the address, N=watchnum */ - DBREG_DRX(d,watchnum) = watchaddr; - - /* enable the watchpoint */ - d->dr7 |= (0x2 << (watchnum*2)) | (mask << (watchnum*4+16)); - - return watchnum; -} |