Date: Mon, 2 Jul 2007 01:21:38 GMT From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 122686 for review Message-ID: <200707020121.l621LcjA035346@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/syscall.h> #include <machine/asm.h> -#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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707020121.l621LcjA035346>