PERFORCE change 29553 for review
Peter Wemm
peter at FreeBSD.org
Wed Apr 23 15:27:11 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=29553
Change 29553 by peter at peter_daintree on 2003/04/23 15:26:35
checkpoint of initial conversion to x86-64. Of note, pipe(2) is
very broken. %rdi is clobbered by the syscall so I need to not use
the SYSCALL() macro.
Affected files ...
.. //depot/projects/hammer/lib/libc/x86_64/sys/Ovfork.S#2 edit
.. //depot/projects/hammer/lib/libc/x86_64/sys/brk.S#2 edit
.. //depot/projects/hammer/lib/libc/x86_64/sys/cerror.S#2 edit
.. //depot/projects/hammer/lib/libc/x86_64/sys/exect.S#2 edit
.. //depot/projects/hammer/lib/libc/x86_64/sys/pipe.S#2 edit
.. //depot/projects/hammer/lib/libc/x86_64/sys/reboot.S#2 edit
.. //depot/projects/hammer/lib/libc/x86_64/sys/sbrk.S#2 edit
Differences ...
==== //depot/projects/hammer/lib/libc/x86_64/sys/Ovfork.S#2 (text+ko) ====
@@ -47,12 +47,12 @@
.weak vfork
.set vfork,__sys_vfork
ENTRY(__sys_vfork)
- popl %ecx /* my rta into ecx */
- mov $SYS_vfork,%eax
+ popq %rcx /* my rta into ecx */
+ mov $SYS_vfork,%rax
KERNCALL
jb 1f
- jmp *%ecx
+ jmp *%rcx
1:
- pushl %ecx
+ pushq %rcx
PIC_PROLOGUE
jmp PIC_PLT(HIDENAME(cerror))
==== //depot/projects/hammer/lib/libc/x86_64/sys/brk.S#2 (text+ko) ====
@@ -45,6 +45,7 @@
.globl HIDENAME(curbrk)
.globl HIDENAME(minbrk)
ENTRY(_brk)
+ pushq %rdi
jmp ok
ENTRY(brk)
@@ -72,18 +73,19 @@
#else
- movl 4(%esp),%eax
- cmpl %eax,HIDENAME(minbrk)
+ pushq %rdi
+ movq %rdi,%rax
+ cmpq %rax,HIDENAME(minbrk)
jbe ok
- movl HIDENAME(minbrk),%eax
- movl %eax,4(%esp)
+ movq HIDENAME(minbrk),%rdi
ok:
- mov $SYS_break,%eax
+ movq $SYS_break,%rax
KERNCALL
jb err
- movl 4(%esp),%eax
- movl %eax,HIDENAME(curbrk)
- movl $0,%eax
+ movq 0(%rsp),%rax
+ movq %rax,HIDENAME(curbrk)
+ movq $0,%rax
+ popq %rdi
ret
err:
jmp HIDENAME(cerror)
==== //depot/projects/hammer/lib/libc/x86_64/sys/cerror.S#2 (text+ko) ====
@@ -52,18 +52,18 @@
.globl CNAME(__error)
.type CNAME(__error), at function
HIDENAME(cerror):
- pushl %eax
+ pushq %rax
#ifdef PIC
/* The caller must execute the PIC prologue before jumping to cerror. */
call PIC_PLT(CNAME(__error))
- popl %ecx
+ popq %rcx
PIC_EPILOGUE
#else
call CNAME(__error)
- popl %ecx
+ popq %rcx
#endif
- movl %ecx,(%eax)
- movl $-1,%eax
- movl $-1,%edx
+ movq %rcx,(%rax)
+ movq $-1,%rax
+ movq $-1,%rdx
ret
==== //depot/projects/hammer/lib/libc/x86_64/sys/exect.S#2 (text+ko) ====
@@ -44,12 +44,12 @@
#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 %rdx
+ orq $ PSL_T,%rdx
+ pushq %rdx
+ popfq
KERNCALL
PIC_PROLOGUE
jmp PIC_PLT(HIDENAME(cerror)) /* exect(file, argv, env); */
==== //depot/projects/hammer/lib/libc/x86_64/sys/pipe.S#2 (text+ko) ====
@@ -43,8 +43,8 @@
#include "SYS.h"
SYSCALL(pipe)
- movl 4(%esp),%ecx
- movl %eax,(%ecx)
- movl %edx,4(%ecx)
- movl $0,%eax
+ movq 8(%rsp),%rcx /* XXX wrong!! %rdi!! */
+ movq %rax,(%rcx)
+ movq %rdx,8(%rcx)
+ movq $0,%rax
ret
==== //depot/projects/hammer/lib/libc/x86_64/sys/reboot.S#2 (text+ko) ====
@@ -43,4 +43,4 @@
#include "SYS.h"
SYSCALL(reboot)
- iret
+ iretq
==== //depot/projects/hammer/lib/libc/x86_64/sys/sbrk.S#2 (text+ko) ====
@@ -47,8 +47,8 @@
.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)
@@ -77,18 +77,22 @@
#else /* !PIC */
- movl 4(%esp),%ecx
- movl HIDENAME(curbrk),%eax
- testl %ecx,%ecx
+ pushq %rdi
+ movq %rdi,%rcx
+ movq HIDENAME(curbrk),%rax
+ testq %rcx,%rcx
jz back
- addl %eax,4(%esp)
+ addq %rax,%rdi
mov $SYS_break,%eax
KERNCALL
jb err
- movl HIDENAME(curbrk),%eax
- addl %ecx,HIDENAME(curbrk)
+ movq HIDENAME(curbrk),%rax
+ movq 0(%rsp), %rcx
+ addq %rcx,HIDENAME(curbrk)
back:
+ addq $8, %rsp
ret
err:
+ addq $8, %rsp
jmp HIDENAME(cerror)
#endif /* PIC */
More information about the p4-projects
mailing list