This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Accommodate BP return value from __errno_location ()


PUSH_ERRNO_LOCATION_RETURN is defined in the new file
libc/sysdeps/i386/bp-asm.h that was checked in previously.

PUSH_ERRNO_LOCATION_RETURN and POP_ERRNO_LOCATION_RETURN expand
to nothing, and BP_SYM does nothing for non-BP builds.

OK?

2000-06-26  Greg McGary  <greg@mcgary.org>

	* sysdeps/i386/bp-asm.h (POP_ERRNO_LOCATION_RETURN): Fold insns.
	* sysdeps/unix/i386/sysdep.S (syscall_error): Push & pop space
	for BP return value & push implicit struct-return pointer to
	__errno_location.
	* sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise.
	(SYSCALL_ERROR_HANDLER): Likewise.
	* sysdeps/unix/sysv/linux/i386/i686/sysdep.h
	(SYSCALL_ERROR_HANDLER): Likewise.

Index: sysdeps/i386/bp-asm.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/bp-asm.h,v
retrieving revision 1.1
diff -u -p -r1.1 bp-asm.h
--- bp-asm.h	2000/06/09 06:14:39	1.1
+++ bp-asm.h	2000/06/27 01:28:53
@@ -106,8 +106,7 @@
    argument, but we must pop the space for the BP itself.  We also
    dereference the return value in order to dig out the pointer value.  */
 #   define POP_ERRNO_LOCATION_RETURN		\
-	movl (%esp), %eax;			\
-	addl $4, %esp;				\
+	popl %eax;				\
 	addl $8, %esp
 
 #  else /* !__BOUNDED_POINTERS__ */
Index: sysdeps/unix/i386/sysdep.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/i386/sysdep.S,v
retrieving revision 1.18
diff -u -p -B -w -r1.18 sysdep.S
--- sysdep.S	1998/03/06 11:39:04	1.18
+++ sysdep.S	2000/06/27 01:24:05
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,6 +19,8 @@
 #include <sysdep.h>
 #define _ERRNO_H
 #include <bits/errno.h>
+#include <bp-asm.h>
+#include <bp-sym.h>
 
 .globl C_SYMBOL_NAME(errno)
 .globl syscall_error
@@ -43,7 +45,9 @@ notb:
 	movl %eax, C_SYMBOL_NAME(errno)
 #else
 	pushl %eax
-	call __errno_location
+	PUSH_ERRNO_LOCATION_RETURN
+	call BP_SYM (__errno_location)
+	POP_ERRNO_LOCATION_RETURN
 	popl %ecx
 	movl %ecx, (%eax)
 #endif
@@ -58,7 +62,9 @@ notb:
 	movl %eax, (%ecx)
 #else
 	pushl %eax
-	call C_SYMBOL_NAME(__errno_location@PLT)
+	PUSH_ERRNO_LOCATION_RETURN
+	call C_SYMBOL_NAME (BP_SYM (__errno_location)@PLT)
+	POP_ERRNO_LOCATION_RETURN
 	popl %ecx
 	/* Pop %ebx value saved before jumping here.  */
 	popl %ebx
Index: sysdeps/unix/sysv/linux/i386/i686/sysdep.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/i686/sysdep.h,v
retrieving revision 1.4
diff -u -p -B -w -r1.4 sysdep.h
--- sysdep.h	2000/05/22 01:03:28	1.4
+++ sysdep.h	2000/06/27 01:24:05
@@ -22,6 +22,8 @@
 
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/i386/sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
 
 /* We define special versions of the error handler code to match the i686's
    deep branch prediction mechanism.  */
@@ -39,7 +41,9 @@
   xorl %edx, %edx;							      \
   subl %eax, %edx;							      \
   pushl %edx;								      \
-  call __errno_location@PLT;						      \
+  PUSH_ERRNO_LOCATION_RETURN;						      \
+  call BP_SYM (__errno_location)@PLT;					      \
+  POP_ERRNO_LOCATION_RETURN;						      \
   popl %ecx;								      \
   popl %ebx;								      \
   movl %ecx, (%eax);							      \
Index: sysdeps/unix/sysv/linux/i386/sysdep.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/sysdep.h,v
retrieving revision 1.26
diff -u -p -B -w -r1.26 sysdep.h
--- sysdep.h	1999/01/13 13:28:39	1.26
+++ sysdep.h	2000/06/27 01:24:06
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 93, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 93, 95, 96, 97, 98, 99, 00 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
 
@@ -22,6 +22,8 @@
 
 /* There is some commonality.  */
 #include <sysdeps/unix/i386/sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
 
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
@@ -82,7 +84,9 @@
   addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx;				      \
   subl %eax, %edx;							      \
   pushl %edx;								      \
-  call __errno_location@PLT;						      \
+  PUSH_ERRNO_LOCATION_RETURN;						      \
+  call BP_SYM (__errno_location)@PLT;					      \
+  POP_ERRNO_LOCATION_RETURN;						      \
   popl %ecx;								      \
   popl %ebx;								      \
   movl %ecx, (%eax);							      \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]