This is the mail archive of the newlib@sourceware.org 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]
Other format: [Raw text]

Re: [PATCH] newlib/configure.host: Turn off sti/cli for i386 setjmp for i386-rtems*


On Feb 26 04:54, Joel Sherrill wrote:
> 
> 
> On 2/26/2016 4:44 AM, Corinna Vinschen wrote:
> >On Feb 25 14:44, Joel Sherrill wrote:
> >>When running RTEMS paravirtualized in user space, the cli/sti instructions
> >>can't be used. But I can't see why they are needed in either user or
> >>supervisor state. Turning the use of them off for RTEMS.
> >>
> >>This code is unmodified since the beginning of the repository, so I have
> >>no insight into why it was done. I may even have been the one to add them.
> >>Absolutely no idea except they aren't necessary.
> >>
> >>---
> >>  newlib/configure.host | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >>diff --git a/newlib/configure.host b/newlib/configure.host
> >>index 5fa37d4..f6abb5c 100644
> >>--- a/newlib/configure.host
> >>+++ b/newlib/configure.host
> >>@@ -592,6 +592,8 @@ case "${host}" in
> >>  	newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
> >>          # turn off unsupported items in posix directory
> >>  	newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN"
> >>+        # turn off using cli/sti in i386 setjmp/longjmp
> >>+	newlib_cflags="${newlib_cflags} -D_I386MACH_ALLOW_HW_INTERRUPTS"
> >>  	;;
> >>  # VxWorks supplies its own version of malloc, and the newlib one
> >>  # doesn't work because VxWorks does not have sbrk.
> >
> >Patch is ok, please apply.
> >
> >Would it make sense to enable _I386MACH_ALLOW_HW_INTERRUPTS by default
> >on x86/x86_64?
> 
> I can't see any downside. I spot checked other ports and no other port seemed to have comparable code. I would be OK with that. Where is it defaulted?

I thought changing the definition from _I386MACH_ALLOW_HW_INTERRUPTS to,
e.g, _I386MACH_DISABLE_HW_INTERRUPTS wouldn't hurt, as in the patch
below.

However, we might have to make sure how to handle explicitly mentioned
ix86 systems (rdos, sco, netware).  I know basically nothing about
these.

> Also FWIW, I would like to see this resolved before the next newlib snapshot
> so the RTEMS tools can include this. We are due for a tool update and I don't
> want to impact users too much in a single month. :)

For that it's probably better just to apply your patch as is for now.


Corinna


diff --git a/newlib/configure.host b/newlib/configure.host
index 5fa37d4..9054230 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -469,7 +469,6 @@ case "${host}" in
 	default_newlib_io_pos_args="yes"
 	#newlib_cflags="${newlib_cflags} -Werror" # DEBUGGING ONLY;BREAKS BUILD
 	newlib_cflags="${newlib_cflags} -Wall"
-	newlib_cflags="${newlib_cflags} -D_I386MACH_ALLOW_HW_INTERRUPTS"
 	newlib_cflags="${newlib_cflags} -DHAVE_FCNTL"
 	newlib_cflags="${newlib_cflags} -DHAVE_GETOPT"
 	newlib_cflags="${newlib_cflags} -D_NO_POSIX_SPAWN"
diff --git a/newlib/libc/machine/i386/i386mach.h b/newlib/libc/machine/i386/i386mach.h
index 23c3219..403d24b 100644
--- a/newlib/libc/machine/i386/i386mach.h
+++ b/newlib/libc/machine/i386/i386mach.h
@@ -74,7 +74,7 @@
 #define SOTYPE_FUNCTION(sym)
 #endif
 
-#ifdef _I386MACH_ALLOW_HW_INTERRUPTS
+#ifndef _I386MACH_DISABLE_HW_INTERRUPTS
 #define        __CLI
 #define        __STI
 #else
diff --git a/newlib/libc/machine/x86_64/x86_64mach.h b/newlib/libc/machine/x86_64/x86_64mach.h
index 84cb2f8..05e6392 100644
--- a/newlib/libc/machine/x86_64/x86_64mach.h
+++ b/newlib/libc/machine/x86_64/x86_64mach.h
@@ -104,7 +104,7 @@
 #define SOTYPE_FUNCTION(sym)
 #endif
 
-#ifdef _I386MACH_ALLOW_HW_INTERRUPTS
+#ifndef _I386MACH_DISABLE_HW_INTERRUPTS
 #define        __CLI
 #define        __STI
 #else
diff --git a/newlib/libc/sys/linux/machine/i386/i386mach.h b/newlib/libc/sys/linux/machine/i386/i386mach.h
index 23c3219..403d24b 100644
--- a/newlib/libc/sys/linux/machine/i386/i386mach.h
+++ b/newlib/libc/sys/linux/machine/i386/i386mach.h
@@ -74,7 +74,7 @@
 #define SOTYPE_FUNCTION(sym)
 #endif
 
-#ifdef _I386MACH_ALLOW_HW_INTERRUPTS
+#ifndef _I386MACH_DISABLE_HW_INTERRUPTS
 #define        __CLI
 #define        __STI
 #else
diff --git a/newlib/libm/machine/i386/i386mach.h b/newlib/libm/machine/i386/i386mach.h
index 23c3219..403d24b 100644
--- a/newlib/libm/machine/i386/i386mach.h
+++ b/newlib/libm/machine/i386/i386mach.h
@@ -74,7 +74,7 @@
 #define SOTYPE_FUNCTION(sym)
 #endif
 
-#ifdef _I386MACH_ALLOW_HW_INTERRUPTS
+#ifndef _I386MACH_DISABLE_HW_INTERRUPTS
 #define        __CLI
 #define        __STI
 #else


-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature


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