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] | |
I built a cross-compiler targeted at i386-elf using binutils
2.16.91.0.6, gcc 4.1.0-20060328, and newlib 1.14.0. I made one change
to newlib--I removed the #ifdef HAVE_GETTIMEOFDAY in time.c.
I used the cross compiler to compile Mini-OS, a small kernel that can
be run using the Xen hypervisor. The result runs with no obvious
problems.
I modified the code that implements the console in Mini-OS so that it
exercises setjmp and longjmp. A page fault occurs when longjmp is
called. Even stranger, it appears that the address being referenced
is actually a segment descriptor. Could it be that GCC 4 generates
code that does not work with the newlib's version of setjmp and
longjmp?
I'm not sure how to provide a better bug report, but I'll supply more
details upon request. One other thing I did was write a very simple
main routine, and compiled and linked it with
./newlib/libc/machine/i386/{setjmp.S,i386mach.h} using the native GCC,
version 3.3.5. It also crashes, but I'm not sure what that proves.
John
Attachment:
main.c
Description: setjmp main
diff -ur oxen-unstable/extras/mini-os/console/console.c xen-unstable/extras/mini-os/console/console.c
--- oxen-unstable/extras/mini-os/console/console.c 2006-04-29 00:24:30.000000000 -0400
+++ xen-unstable/extras/mini-os/console/console.c 2006-05-02 14:15:30.000000000 -0400
@@ -44,7 +44,26 @@
#include <xenbus.h>
#include <xen/io/console.h>
+#if defined LUA_CONSOLE
+#include <setjmp.h>
+
+void do_jump(jmp_buf env) {
+ printk("About to jump\n");
+ longjmp(env, 1);
+ printk("Missed the jump\n");
+}
+
+void do_setup(void) {
+ jmp_buf env;
+ if (setjmp(env))
+ return;
+ do_jump(env);
+ printk("landed\n");
+}
+
+#endif
+
/* Low level functions defined in xencons_ring.c */
extern int xencons_ring_init(void);
extern int xencons_ring_send(const char *data, unsigned len);
@@ -64,8 +83,10 @@
buf[len] = '\0';
printk("%s", buf);
- if(buf[len-1] == '\r')
- printk("\nNo console input handler.\n");
+ if(buf[len-1] == '\r') {
+ printk("\nTrying setjmp.\n");
+ do_setup();
+ }
}
}
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |