diff options
author | peter <peter@FreeBSD.org> | 2003-04-30 18:16:33 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2003-04-30 18:16:33 +0000 |
commit | 415054f8cbd4c9a67ca976b2678847b2baa8bd8d (patch) | |
tree | 5c71bc084db1d2309bccf38a423416850e4ecffc /lib/libc/amd64/sys | |
parent | d25ffe9c8cbdfd9b7fd631d79f80c1e7157f2c96 (diff) | |
download | FreeBSD-src-415054f8cbd4c9a67ca976b2678847b2baa8bd8d.zip FreeBSD-src-415054f8cbd4c9a67ca976b2678847b2baa8bd8d.tar.gz |
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.
Diffstat (limited to 'lib/libc/amd64/sys')
-rw-r--r-- | lib/libc/amd64/sys/brk.S | 43 | ||||
-rw-r--r-- | lib/libc/amd64/sys/cerror.S | 17 | ||||
-rw-r--r-- | lib/libc/amd64/sys/exect.S | 13 | ||||
-rw-r--r-- | lib/libc/amd64/sys/ptrace.S | 10 | ||||
-rw-r--r-- | lib/libc/amd64/sys/sbrk.S | 46 | ||||
-rw-r--r-- | lib/libc/amd64/sys/setlogin.S | 11 |
6 files changed, 35 insertions, 105 deletions
diff --git a/lib/libc/amd64/sys/brk.S b/lib/libc/amd64/sys/brk.S index 61f6cbe..0192b04 100644 --- a/lib/libc/amd64/sys/brk.S +++ b/lib/libc/amd64/sys/brk.S @@ -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 diff --git a/lib/libc/amd64/sys/cerror.S b/lib/libc/amd64/sys/cerror.S index 1d625be..f9f4da0 100644 --- a/lib/libc/amd64/sys/cerror.S +++ b/lib/libc/amd64/sys/cerror.S @@ -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 diff --git a/lib/libc/amd64/sys/exect.S b/lib/libc/amd64/sys/exect.S index 5848e61..180a309 100644 --- a/lib/libc/amd64/sys/exect.S +++ b/lib/libc/amd64/sys/exect.S @@ -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); */ diff --git a/lib/libc/amd64/sys/ptrace.S b/lib/libc/amd64/sys/ptrace.S index 71ce5c7..e6587e7 100644 --- a/lib/libc/amd64/sys/ptrace.S +++ b/lib/libc/amd64/sys/ptrace.S @@ -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)) diff --git a/lib/libc/amd64/sys/sbrk.S b/lib/libc/amd64/sys/sbrk.S index 97c4769..dcdc513 100644 --- a/lib/libc/amd64/sys/sbrk.S +++ b/lib/libc/amd64/sys/sbrk.S @@ -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 */ diff --git a/lib/libc/amd64/sys/setlogin.S b/lib/libc/amd64/sys/setlogin.S index 013dc7e..54acef8 100644 --- a/lib/libc/amd64/sys/setlogin.S +++ b/lib/libc/amd64/sys/setlogin.S @@ -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) */ |