From owner-p4-projects@FreeBSD.ORG Mon Jul 2 01:21:39 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8A15C16A468; Mon, 2 Jul 2007 01:21:39 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3FD0116A421 for ; Mon, 2 Jul 2007 01:21:39 +0000 (UTC) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 2FEF213C447 for ; Mon, 2 Jul 2007 01:21:39 +0000 (UTC) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l621LdGX035349 for ; Mon, 2 Jul 2007 01:21:39 GMT (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l621LcjA035346 for perforce@freebsd.org; Mon, 2 Jul 2007 01:21:38 GMT (envelope-from peter@freebsd.org) Date: Mon, 2 Jul 2007 01:21:38 GMT Message-Id: <200707020121.l621LcjA035346@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 Cc: Subject: PERFORCE change 122686 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2007 01:21:39 -0000 http://perforce.freebsd.org/chv.cgi?CH=122686 Change 122686 by peter@peter_overcee on 2007/07/02 01:21:30 PSEUDO() was missing the errno handling. Ooops. For example, gen/getlogin.c was calling _getlogin(), and examining errno. i386/amd64 PSEUDO(getlogin) macros didn't set errno. This was copied to some other platforms. The real difference between SYSCALL, RSYSCALL and PSEUDO is that SYSCALL is a basic syscall (not used on i386/amd64), RSYSCALL is SYSCALL with a 'ret' after it. SYSCALL/SYSCALL define __sys_sc (where "sc" == name), with _sc and sc as weak aliases. PSEUDO is like RSYSCALL, except with just __sys_sc and _sc. Affected files ... .. //depot/projects/hammer/lib/libc/amd64/SYS.h#8 edit .. //depot/projects/hammer/lib/libc/i386/SYS.h#4 edit Differences ... ==== //depot/projects/hammer/lib/libc/amd64/SYS.h#8 (text+ko) ==== @@ -44,6 +44,12 @@ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx + +#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \ + .weak CNAME(__CONCAT(_,x)); \ + .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ + mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret ; \ + 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx #else #define RSYSCALL(x) ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(x); \ @@ -52,11 +58,12 @@ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ 2: jmp HIDENAME(cerror) -#endif #define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ - mov __CONCAT($SYS_,x),%rax; KERNCALL; ret + mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ + 2: jmp HIDENAME(cerror) +#endif #define KERNCALL movq %rcx, %r10; syscall ==== //depot/projects/hammer/lib/libc/i386/SYS.h#4 (text+ko) ==== @@ -36,20 +36,19 @@ #include #include -#define SYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \ +#define RSYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \ ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(x); \ .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ - mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b + mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b; ret -#define RSYSCALL(x) SYSCALL(x); ret - -#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \ +#define PSEUDO(x) 2: PIC_PROLOGUE; jmp mp PIC_PLT(HIDENAME(cerror)); \ + ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ - mov __CONCAT($SYS_,x),%eax; KERNCALL; ret + mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b; ret /* gas messes up offset -- although we don't currently need it, do for BCS */ #define LCALL(x,y) .byte 0x9a ; .long y; .word x