mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
Rewrite ptrace(2) wrappers in C.
Besides removing hand-translation to assembler, this also adds missing wrappers for arm64 and risc-v. Reviewed by: emaste, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D7694
This commit is contained in:
parent
771e2c7753
commit
afd3e268d2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=305012
@ -4,7 +4,7 @@
|
||||
SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \
|
||||
amd64_set_gsbase.c
|
||||
|
||||
MDASM= vfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \
|
||||
MDASM= vfork.S brk.S cerror.S exect.S getcontext.S \
|
||||
sbrk.S setlogin.S sigreturn.S
|
||||
|
||||
# Don't generate default code for these syscalls:
|
||||
|
@ -1,67 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
.asciz "@(#)ptrace.s 5.1 (Berkeley) 4/23/90"
|
||||
#endif /* SYSLIBC_SCCS and not lint */
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
.globl CNAME(__error)
|
||||
.type CNAME(__error),@function
|
||||
|
||||
ENTRY(ptrace)
|
||||
pushq %rdi /* align stack */
|
||||
pushq %rdi
|
||||
pushq %rsi
|
||||
pushq %rdx
|
||||
pushq %rcx
|
||||
#ifdef PIC
|
||||
callq PIC_PLT(CNAME(__error))
|
||||
#else
|
||||
callq CNAME(__error)
|
||||
#endif
|
||||
popq %rcx
|
||||
popq %rdx
|
||||
popq %rsi
|
||||
popq %rdi
|
||||
popq %rdi
|
||||
movl $0,(%rax)
|
||||
mov $SYS_ptrace,%eax
|
||||
KERNCALL
|
||||
jb HIDENAME(cerror)
|
||||
ret
|
||||
END(ptrace)
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -2,7 +2,7 @@
|
||||
|
||||
SRCS+= __vdso_gettc.c
|
||||
|
||||
MDASM= Ovfork.S brk.S cerror.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S
|
||||
MDASM= Ovfork.S brk.S cerror.S sbrk.S shmat.S sigreturn.S syscall.S
|
||||
|
||||
# Don't generate default code for these syscalls:
|
||||
NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o
|
||||
|
@ -1,51 +0,0 @@
|
||||
/* $NetBSD: ptrace.S,v 1.7 2003/08/07 16:42:04 agc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* 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. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: @(#)ptrace.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
#include "SYS.h"
|
||||
|
||||
ENTRY(ptrace)
|
||||
stmfd sp!, {r0-r3, lr}
|
||||
sub sp, sp, #4 /* align stack */
|
||||
bl PIC_SYM(_C_LABEL(__error), PLT)
|
||||
add sp, sp, #4 /* unalign stack */
|
||||
mov r1, #0x00000000
|
||||
str r1, [r0]
|
||||
ldmfd sp!, {r0-r3, lr}
|
||||
SYSTRAP(ptrace)
|
||||
bcs PIC_SYM(CERROR, PLT)
|
||||
RET
|
||||
END(ptrace)
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -7,7 +7,7 @@ SRCS+= i386_clr_watch.c i386_set_watch.c i386_vm86.c
|
||||
SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \
|
||||
i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c
|
||||
|
||||
MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \
|
||||
MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S \
|
||||
sbrk.S setlogin.S sigreturn.S syscall.S
|
||||
|
||||
# Don't generate default code for these syscalls:
|
||||
|
@ -1,59 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
.asciz "@(#)ptrace.s 5.1 (Berkeley) 4/23/90"
|
||||
#endif /* SYSLIBC_SCCS and not lint */
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
.globl CNAME(__error)
|
||||
.type CNAME(__error),@function
|
||||
|
||||
ENTRY(ptrace)
|
||||
#ifdef PIC
|
||||
PIC_PROLOGUE
|
||||
call PIC_PLT(CNAME(__error))
|
||||
PIC_EPILOGUE
|
||||
#else
|
||||
call CNAME(__error)
|
||||
#endif
|
||||
movl $0,(%eax)
|
||||
mov $SYS_ptrace,%eax
|
||||
KERNCALL
|
||||
jb HIDENAME(cerror)
|
||||
ret
|
||||
END(ptrace)
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -335,6 +335,7 @@ int __sys_openat(int, const char *, int, ...);
|
||||
int __sys_pselect(int, struct fd_set *, struct fd_set *,
|
||||
struct fd_set *, const struct timespec *,
|
||||
const __sigset_t *);
|
||||
int __sys_ptrace(int, __pid_t, char *, int);
|
||||
int __sys_poll(struct pollfd *, unsigned, int);
|
||||
int __sys_ppoll(struct pollfd *, unsigned, const struct timespec *,
|
||||
const __sigset_t *);
|
||||
|
@ -3,7 +3,7 @@
|
||||
SRCS+= trivial-vdso_tc.c
|
||||
|
||||
MDASM= Ovfork.S brk.S cerror.S exect.S \
|
||||
ptrace.S sbrk.S syscall.S
|
||||
sbrk.S syscall.S
|
||||
|
||||
# Don't generate default code for these syscalls:
|
||||
NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o
|
||||
|
@ -1,71 +0,0 @@
|
||||
/* $NetBSD: ptrace.S,v 1.9 2003/08/07 16:42:17 agc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Ralph Campbell.
|
||||
*
|
||||
* 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. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
#include "SYS.h"
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
ASMSTR("from: @(#)ptrace.s 8.1 (Berkeley) 6/4/93")
|
||||
ASMSTR("$NetBSD: ptrace.S,v 1.9 2003/08/07 16:42:17 agc Exp $")
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
NESTED_NOPROFILE(ptrace, CALLFRAME_SIZ, ra)
|
||||
.mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
|
||||
SETUP_GP
|
||||
PTR_SUBU sp, sp, CALLFRAME_SIZ
|
||||
SETUP_GP64(CALLFRAME_GP, ptrace)
|
||||
SAVE_GP(CALLFRAME_GP)
|
||||
|
||||
PTR_S ra, CALLFRAME_RA(sp)
|
||||
|
||||
PTR_LA t9, _C_LABEL(__error) # locate address of errno
|
||||
jalr t9
|
||||
|
||||
PTR_L ra, CALLFRAME_RA(sp)
|
||||
INT_S zero, 0(v0) # update errno value
|
||||
|
||||
li v0, SYS_ptrace
|
||||
syscall
|
||||
|
||||
# Load __cerror's address using our gp, then restore it.
|
||||
PTR_LA t9, __cerror
|
||||
RESTORE_GP64
|
||||
PTR_ADDU sp, sp, CALLFRAME_SIZ
|
||||
|
||||
bne a3, zero, 1f
|
||||
|
||||
j ra
|
||||
1: j t9
|
||||
END(ptrace)
|
@ -1,6 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S
|
||||
MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S
|
||||
|
||||
# Don't generate default code for these syscalls:
|
||||
NOASM= break.o exit.o getlogin.o sstk.o yield.o
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2002 Peter Grehan.
|
||||
* 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.
|
||||
*/
|
||||
/* $NetBSD: ptrace.S,v 1.3 2000/02/23 20:16:57 kleink Exp $ */
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
ENTRY(ptrace)
|
||||
mflr %r0
|
||||
stwu %r1,-32(%r1)
|
||||
stw %r0,36(%r1)
|
||||
stw %r3,8(%r1)
|
||||
stw %r4,12(%r1)
|
||||
stw %r5,16(%r1)
|
||||
stw %r6,20(%r1)
|
||||
|
||||
bl PIC_PLT(CNAME(__error))
|
||||
li %r7,0
|
||||
stw %r7,0(%r3)
|
||||
|
||||
lwz %r3,8(%r1)
|
||||
lwz %r4,12(%r1)
|
||||
lwz %r5,16(%r1)
|
||||
lwz %r0,36(%r1)
|
||||
lwz %r6,20(%r1)
|
||||
mtlr %r0
|
||||
la %r1,32(%r1)
|
||||
li %r0,SYS_ptrace
|
||||
sc
|
||||
bso 1f
|
||||
blr
|
||||
1:
|
||||
b PIC_PLT(HIDENAME(cerror))
|
||||
END(ptrace)
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -1,6 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S
|
||||
MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S
|
||||
|
||||
# Don't generate default code for these syscalls:
|
||||
NOASM= break.o exit.o getlogin.o sstk.o yield.o
|
||||
|
@ -1,68 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2002 Peter Grehan.
|
||||
* 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.
|
||||
*/
|
||||
/* $NetBSD: ptrace.S,v 1.3 2000/02/23 20:16:57 kleink Exp $ */
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
ENTRY(ptrace)
|
||||
mflr %r0
|
||||
std %r0,16(%r1)
|
||||
stdu %r1,-80(%r1)
|
||||
stw %r3,48(%r1)
|
||||
stw %r4,52(%r1)
|
||||
std %r5,56(%r1)
|
||||
stw %r6,64(%r1)
|
||||
|
||||
bl CNAME(__error)
|
||||
nop
|
||||
li %r7,0
|
||||
stw %r7,0(%r3)
|
||||
|
||||
lwz %r3,48(%r1)
|
||||
lwz %r4,52(%r1)
|
||||
ld %r5,56(%r1)
|
||||
lwz %r6,64(%r1)
|
||||
ld %r1,0(%r1)
|
||||
ld %r0,16(%r1)
|
||||
mtlr %r0
|
||||
li %r0,SYS_ptrace
|
||||
sc
|
||||
bso 1f
|
||||
blr
|
||||
1:
|
||||
stdu %r1,-48(%r1) /* lr already saved */
|
||||
bl HIDENAME(cerror)
|
||||
nop
|
||||
ld %r1,0(%r1)
|
||||
ld %r0,16(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
END(ptrace)
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -12,7 +12,7 @@ SRCS+= __sparc_sigtramp_setup.c \
|
||||
|
||||
CFLAGS+= -I${LIBC_SRCTOP}/sparc64/fpu
|
||||
|
||||
MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S sigaction1.S
|
||||
MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S sigaction1.S
|
||||
|
||||
# Don't generate default code for these syscalls:
|
||||
NOASM= break.o exit.o getlogin.o sstk.o yield.o
|
||||
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* 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.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Header: ptrace.s,v 1.2 91/12/20 01:59:00 leres Exp
|
||||
* from: NetBSD: ptrace.S,v 1.4 2000/07/24 00:11:10 mycroft Exp
|
||||
*/
|
||||
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
.asciz "@(#)ptrace.s 8.1 (Berkeley) 6/4/93"
|
||||
#if 0
|
||||
RCSID("$NetBSD: ptrace.S,v 1.4 2000/07/24 00:11:10 mycroft Exp $")
|
||||
#endif
|
||||
#endif /* SYSLIBC_SCCS and not lint */
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
_SYSENTRY(ptrace)
|
||||
save %sp, -CCFSZ, %sp
|
||||
call CNAME(__error)
|
||||
nop
|
||||
stw %g0, [%o0]
|
||||
restore
|
||||
_SYSCALL(ptrace)
|
||||
retl
|
||||
nop
|
||||
_SYSEND(ptrace)
|
@ -48,6 +48,7 @@ INTERPOSED = \
|
||||
poll \
|
||||
ppoll \
|
||||
pselect \
|
||||
ptrace \
|
||||
read \
|
||||
readv \
|
||||
recvfrom \
|
||||
|
49
lib/libc/sys/ptrace.c
Normal file
49
lib/libc/sys/ptrace.c
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The FreeBSD Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions of this software were developed by Konstantin Belousov
|
||||
* under sponsorship from the FreeBSD Foundation.
|
||||
*
|
||||
* 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(s), this list of conditions and the following disclaimer as
|
||||
* the first lines of this file unmodified other than the possible
|
||||
* addition of one or more copyright notices.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <errno.h>
|
||||
#include "libc_private.h"
|
||||
|
||||
__weak_reference(_ptrace, ptrace);
|
||||
|
||||
int
|
||||
_ptrace(int request, pid_t pid, caddr_t addr, int data)
|
||||
{
|
||||
|
||||
errno = 0;
|
||||
return (__sys_ptrace(request, pid, addr, data));
|
||||
}
|
Loading…
Reference in New Issue
Block a user