From owner-p4-projects@FreeBSD.ORG Wed Apr 23 15:27:10 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 49F9037B404; Wed, 23 Apr 2003 15:27:10 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BEE9E37B401 for ; Wed, 23 Apr 2003 15:27:09 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5AE4C43FA3 for ; Wed, 23 Apr 2003 15:27:09 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h3NMR90U029404 for ; Wed, 23 Apr 2003 15:27:09 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h3NMR8So029399 for perforce@freebsd.org; Wed, 23 Apr 2003 15:27:08 -0700 (PDT) Date: Wed, 23 Apr 2003 15:27:08 -0700 (PDT) Message-Id: <200304232227.h3NMR8So029399@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 29553 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Apr 2003 22:27:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=29553 Change 29553 by peter@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),@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 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 */