This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


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

patch: REG vs. REGISTER and longjmp portability


In my Aug 22 patch to setjmp.S, I overlooked that i386mach.h defined
__REG_PREFIX__, while setjmp.S used __REGISTER_PREFIX__. Sorry.

I'm not sure if this makes sense (gcc frowns upon any attempt to change
__REGISTER_PREFIX__ anyway), but I've added the __REGISTER_PREFIX__
change to setjmp.S again.

The second part of the patch is to make cli/sti in longjmp configurable.
This is necessary to run it under Linux. The solution isn't perfectly
clean (i.e. there really ought to be hooks to do something else, e.g.
block signals), but I hope it's acceptable as a band aid.

My patch is relative to the CVS tree plus my machine/i386/*.S patch
applied.

The good news is that ash (Almquist shell) now compiles almost out of
the box.

- Werner

---------------------------------- ChangeLog ----------------------------------

2000-08-24  Werner Almesberger  <Werner.Almesberger@epfl.ch>
	* libc/machine/i386/setjmp.S: inclusion of i386mach.h did not take
	into account that i386mach.h defines __REG_PREFIX__, not
	__REGISTER_PREFIX__
	* libc/machine/i386/i386mach.h: added __CLI and __STI macros
	(controlled via ALLOW_HW_INTERRUPTS macro)
	* libc/machine/i386/setjmp.S (longjmp): uses __CLI and __STI
	instead of cli and sti

------------------------------------ patch ------------------------------------

--- src/newlib/libc/machine/i386/i386mach.h.broken	Thu Aug 24 10:28:10 2000
+++ src/newlib/libc/machine/i386/i386mach.h	Thu Aug 24 10:29:37 2000
@@ -73,3 +73,11 @@
 #else
 #define SOTYPE_FUNCTION(sym)
 #endif
+
+#ifdef ALLOW_HW_INTERRUPTS
+#define	__CLI
+#define	__STI
+#else
+#define __CLI	cli
+#define __STI	sti
+#endif
--- src/newlib/libc/machine/i386/setjmp.S.broken	Thu Aug 24 09:42:15 2000
+++ src/newlib/libc/machine/i386/setjmp.S	Thu Aug 24 10:28:23 2000
@@ -24,6 +24,7 @@
  */
 
 	#include "i386mach.h"
+	#define __REGISTER_PREFIX__ %  /* i386mach.h sets __REG_PREFIX__ ?!? */
 
         .global SYM (setjmp)
         .global SYM (longjmp)
@@ -72,7 +73,7 @@
 
 	movl	24(edi),ebp
 
-	cli
+	__CLI
 	movl	28(edi),esp
 	
 	pushl	32(edi)	
@@ -83,6 +84,6 @@
 	movl	12(edi),edx
 	movl	16(edi),esi
 	movl	20(edi),edi
-	sti
+	__STI
 
 	ret

-- 
  _________________________________________________________________________
 / Werner Almesberger, ICA, EPFL, CH       werner.almesberger@ica.epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

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