Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/i386 A better fix for the stub-in-other-module...



details:   https://anonhg.NetBSD.org/src/rev/a6f345feec09
branches:  trunk
changeset: 482701:a6f345feec09
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Sat Feb 19 21:04:58 2000 +0000

description:
A better fix for the stub-in-other-module problem:
Load the address of cerror through the GOT, so we can do a PIC_EPILOGUE and
leave the stack clean.

diffstat:

 lib/libc/arch/i386/SYS.h        |  15 +++++++++++++--
 lib/libc/arch/i386/sys/cerror.S |  11 +++--------
 2 files changed, 16 insertions(+), 10 deletions(-)

diffs (68 lines):

diff -r b81fbcec84b5 -r a6f345feec09 lib/libc/arch/i386/SYS.h
--- a/lib/libc/arch/i386/SYS.h  Sat Feb 19 19:00:13 2000 +0000
+++ b/lib/libc/arch/i386/SYS.h  Sat Feb 19 21:04:58 2000 +0000
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
- *     $NetBSD: SYS.h,v 1.14 1999/08/23 08:45:11 kleink Exp $
+ *     $NetBSD: SYS.h,v 1.15 2000/02/19 21:04:58 mycroft Exp $
  */
 
 #include <machine/asm.h>
@@ -58,11 +58,22 @@
        ENTRY(x);                                                       \
        SYSTRAP(y)
 
+#ifdef PIC
 #define _SYSCALL(x,y)                                                  \
        .text; _ALIGN_TEXT;                                             \
-       2: PIC_PROLOGUE; jmp PIC_PLT(CERROR);                           \
+       2: PIC_PROLOGUE;                                                \
+          mov PIC_GOT(CERROR), %ecx;                                   \
+          PIC_EPILOGUE;                                                \
+          jmp %ecx;                                                    \
        _SYSCALL_NOERROR(x,y);                                          \
        jc 2b
+#else
+#define _SYSCALL(x,y)                                                  \
+       .text; _ALIGN_TEXT;                                             \
+       2: jmp CERROR;                                                  \
+       _SYSCALL_NOERROR(x,y);                                          \
+       jc 2b
+#endif
 
 #define SYSCALL_NOERROR(x)                                             \
        _SYSCALL_NOERROR(x,x)
diff -r b81fbcec84b5 -r a6f345feec09 lib/libc/arch/i386/sys/cerror.S
--- a/lib/libc/arch/i386/sys/cerror.S   Sat Feb 19 19:00:13 2000 +0000
+++ b/lib/libc/arch/i386/sys/cerror.S   Sat Feb 19 21:04:58 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cerror.S,v 1.11 2000/01/23 23:38:32 mycroft Exp $      */
+/*     $NetBSD: cerror.S,v 1.12 2000/02/19 21:04:58 mycroft Exp $      */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -40,7 +40,7 @@
 
 #include <machine/asm.h>
 #if defined(SYSLIBC_SCCS) && !defined(lint)
-       RCSID("$NetBSD: cerror.S,v 1.11 2000/01/23 23:38:32 mycroft Exp $")
+       RCSID("$NetBSD: cerror.S,v 1.12 2000/02/19 21:04:58 mycroft Exp $")
 #endif /* SYSLIBC_SCCS and not lint */
 
 #include "SYS.h"
@@ -52,12 +52,7 @@
 #endif
 _ENTRY(CERROR)
 #ifdef PIC
-       /* This is PIC_PROLOGUE without the pushl at the beginning.  The stub
-          already did that. */
-       call    1f
-1:
-       popl    %ebx
-       addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+       PIC_PROLOGUE
 #endif
 
 #ifdef _REENTRANT



Home | Main Index | Thread Index | Old Index