Update for AMD64 after repocopy from i386/sys/*. This means:
- strip out the nasty PIC_PROLOGUE/EPILOGUE stuff, since we dont have to lose a register in PIC mode anymore (we use %rip-relative addressing). - update for C register argument passing conventions. - convert 32 bit to 64 bit register sizes etc.
This commit is contained in:
parent
d25ffe9c8c
commit
415054f8cb
@ -45,46 +45,23 @@ __FBSDID("$FreeBSD$");
|
||||
.globl HIDENAME(curbrk)
|
||||
.globl HIDENAME(minbrk)
|
||||
ENTRY(_brk)
|
||||
pushq %rdi
|
||||
jmp ok
|
||||
|
||||
ENTRY(brk)
|
||||
#ifdef PIC
|
||||
movl 4(%esp),%eax
|
||||
PIC_PROLOGUE
|
||||
movl PIC_GOT(HIDENAME(curbrk)),%edx # set up GOT addressing
|
||||
movl PIC_GOT(HIDENAME(minbrk)),%ecx #
|
||||
PIC_EPILOGUE
|
||||
cmpl %eax,(%ecx)
|
||||
pushq %rdi
|
||||
movq %rdi,%rax
|
||||
cmpq %rax,PIC_GOT(HIDENAME(minbrk))
|
||||
jbe ok
|
||||
movl (%ecx),%eax
|
||||
movl %eax,4(%esp)
|
||||
movq PIC_GOT(HIDENAME(minbrk)),%rdi
|
||||
ok:
|
||||
mov $SYS_break,%eax
|
||||
movq $SYS_break,%rax
|
||||
KERNCALL
|
||||
jb err
|
||||
movl 4(%esp),%eax
|
||||
movl %eax,(%edx)
|
||||
movl $0,%eax
|
||||
movq 0(%rsp),%rax
|
||||
movq %rax,PIC_GOT(HIDENAME(curbrk))
|
||||
movq $0,%rax
|
||||
popq %rdi
|
||||
ret
|
||||
err:
|
||||
PIC_PROLOGUE
|
||||
jmp PIC_PLT(HIDENAME(cerror))
|
||||
|
||||
#else
|
||||
|
||||
movl 4(%esp),%eax
|
||||
cmpl %eax,HIDENAME(minbrk)
|
||||
jbe ok
|
||||
movl HIDENAME(minbrk),%eax
|
||||
movl %eax,4(%esp)
|
||||
ok:
|
||||
mov $SYS_break,%eax
|
||||
KERNCALL
|
||||
jb err
|
||||
movl 4(%esp),%eax
|
||||
movl %eax,HIDENAME(curbrk)
|
||||
movl $0,%eax
|
||||
ret
|
||||
err:
|
||||
jmp HIDENAME(cerror)
|
||||
#endif
|
||||
|
@ -52,18 +52,11 @@ __FBSDID("$FreeBSD$");
|
||||
.globl CNAME(__error)
|
||||
.type CNAME(__error),@function
|
||||
HIDENAME(cerror):
|
||||
pushl %eax
|
||||
#ifdef PIC
|
||||
/* The caller must execute the PIC prologue before jumping to cerror. */
|
||||
pushq %rax
|
||||
call PIC_PLT(CNAME(__error))
|
||||
popl %ecx
|
||||
PIC_EPILOGUE
|
||||
#else
|
||||
call CNAME(__error)
|
||||
popl %ecx
|
||||
#endif
|
||||
movl %ecx,(%eax)
|
||||
movl $-1,%eax
|
||||
movl $-1,%edx
|
||||
popq %rcx
|
||||
movq %rcx,(%rax)
|
||||
movq $-1,%rax
|
||||
movq $-1,%rdx
|
||||
ret
|
||||
|
||||
|
@ -44,12 +44,11 @@ __FBSDID("$FreeBSD$");
|
||||
#include <machine/psl.h>
|
||||
|
||||
ENTRY(exect)
|
||||
mov $SYS_execve,%eax
|
||||
pushf
|
||||
popl %edx
|
||||
orl $ PSL_T,%edx
|
||||
pushl %edx
|
||||
popf
|
||||
movq $SYS_execve,%rax
|
||||
pushfq
|
||||
popq %r8
|
||||
orq $PSL_T,%r8
|
||||
pushq %r8
|
||||
popfq
|
||||
KERNCALL
|
||||
PIC_PROLOGUE
|
||||
jmp PIC_PLT(HIDENAME(cerror)) /* exect(file, argv, env); */
|
||||
|
@ -44,18 +44,10 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
ENTRY(ptrace)
|
||||
xorl %eax,%eax
|
||||
#ifdef PIC
|
||||
PIC_PROLOGUE
|
||||
movl PIC_GOT(CNAME(errno)),%edx
|
||||
movl %eax,(%edx)
|
||||
PIC_EPILOGUE
|
||||
#else
|
||||
movl %eax,CNAME(errno)
|
||||
#endif
|
||||
movl %eax,PIC_GOT(CNAME(errno))
|
||||
mov $SYS_ptrace,%eax
|
||||
KERNCALL
|
||||
jb err
|
||||
ret
|
||||
err:
|
||||
PIC_PROLOGUE
|
||||
jmp PIC_PLT(HIDENAME(cerror))
|
||||
|
@ -47,48 +47,26 @@ __FBSDID("$FreeBSD$");
|
||||
.globl HIDENAME(curbrk)
|
||||
|
||||
.data
|
||||
HIDENAME(minbrk): .long CNAME(_end)
|
||||
HIDENAME(curbrk): .long CNAME(_end)
|
||||
HIDENAME(minbrk): .quad CNAME(_end)
|
||||
HIDENAME(curbrk): .quad CNAME(_end)
|
||||
.text
|
||||
|
||||
ENTRY(sbrk)
|
||||
#ifdef PIC
|
||||
movl 4(%esp),%ecx
|
||||
PIC_PROLOGUE
|
||||
movl PIC_GOT(HIDENAME(curbrk)),%edx
|
||||
movl (%edx),%eax
|
||||
PIC_EPILOGUE
|
||||
testl %ecx,%ecx
|
||||
pushq %rdi
|
||||
movq %rdi,%rcx
|
||||
movq PIC_GOT(HIDENAME(curbrk)),%rax
|
||||
testq %rcx,%rcx
|
||||
jz back
|
||||
addl %eax,4(%esp)
|
||||
addq %rax,%rdi
|
||||
mov $SYS_break,%eax
|
||||
KERNCALL
|
||||
jb err
|
||||
PIC_PROLOGUE
|
||||
movl PIC_GOT(HIDENAME(curbrk)),%edx
|
||||
movl (%edx),%eax
|
||||
addl %ecx,(%edx)
|
||||
PIC_EPILOGUE
|
||||
movq PIC_GOT(HIDENAME(curbrk)),%rax
|
||||
movq 0(%rsp), %rcx
|
||||
addq %rcx,PIC_GOT(HIDENAME(curbrk))
|
||||
back:
|
||||
addq $8, %rsp
|
||||
ret
|
||||
err:
|
||||
PIC_PROLOGUE
|
||||
addq $8, %rsp
|
||||
jmp PIC_PLT(HIDENAME(cerror))
|
||||
|
||||
#else /* !PIC */
|
||||
|
||||
movl 4(%esp),%ecx
|
||||
movl HIDENAME(curbrk),%eax
|
||||
testl %ecx,%ecx
|
||||
jz back
|
||||
addl %eax,4(%esp)
|
||||
mov $SYS_break,%eax
|
||||
KERNCALL
|
||||
jb err
|
||||
movl HIDENAME(curbrk),%eax
|
||||
addl %ecx,HIDENAME(curbrk)
|
||||
back:
|
||||
ret
|
||||
err:
|
||||
jmp HIDENAME(cerror)
|
||||
#endif /* PIC */
|
||||
|
@ -45,14 +45,5 @@ __FBSDID("$FreeBSD$");
|
||||
.globl CNAME(_logname_valid) /* in _getlogin() */
|
||||
|
||||
SYSCALL(setlogin)
|
||||
#ifdef PIC
|
||||
PIC_PROLOGUE
|
||||
pushl %eax
|
||||
movl PIC_GOT(CNAME(_logname_valid)),%eax
|
||||
movl $0,(%eax)
|
||||
popl %eax
|
||||
PIC_EPILOGUE
|
||||
#else
|
||||
movl $0,CNAME(_logname_valid)
|
||||
#endif
|
||||
movl $0,PIC_GOT(CNAME(_logname_valid))
|
||||
ret /* setlogin(name) */
|
||||
|
Loading…
Reference in New Issue
Block a user