diff options
Diffstat (limited to 'libc-parts')
-rw-r--r-- | libc-parts/ChangeLog | 29 | ||||
-rw-r--r-- | libc-parts/_exit.c | 2 | ||||
-rw-r--r-- | libc-parts/backtrace.c | 18 | ||||
-rw-r--r-- | libc-parts/ia32-cmain.c | 6 | ||||
-rw-r--r-- | libc-parts/loader.c | 12 | ||||
-rw-r--r-- | libc-parts/panic.c | 18 | ||||
-rw-r--r-- | libc-parts/process-spawn.c | 8 | ||||
-rw-r--r-- | libc-parts/profile.c | 18 | ||||
-rw-r--r-- | libc-parts/s_printf.c | 5 |
9 files changed, 99 insertions, 17 deletions
diff --git a/libc-parts/ChangeLog b/libc-parts/ChangeLog index 8c55f39..ebd9833 100644 --- a/libc-parts/ChangeLog +++ b/libc-parts/ChangeLog @@ -1,3 +1,32 @@ +2009-01-16 Neal H. Walfield <neal@gnu.org> + + * _exit.c (_exit): Use sched_yield, not l4_yield. + * backtrace.c [USE_L4]: Only include <l4.h> in this case. + [! RM_INTERN]: Include <hurd/thread.h>. + (backtrace_print) [! USE_L4 && ! RM_INTERN]: Use hurd_myself to + get the caller's tid. + [! USE_L4 && RM_INTERN]: Don't print a tid. + * ia32-cmain.c [! USE_L4]: Don't include <l4/globals.h>, + <l4/init.h>, <l4/stubs.h>, or <l4/stubs-init.h>. + (cmain) [! USE_L4]: Don't call l4_init or l4_init_stubs. + * loader.c: Don't include <l4.h>. Include <bits/wordsize.h> and + <endian.h>. + (loader_elf_load): Use __WORDSIZE, __BYTE_ORDER, __LITTLE_ENDIAN + and __BIG_ENDIAN instead of their L4 names. + * panic.c: Include <viengoos/thread.h>. + [! RM_INTERN]: Include <hurd/thread.h>. + (panic_) [! USE_L4 && ! RM_INTERN]: Use hurd_myself, not + l4_myself. + [! USE_L4 && RM_INTERN]: Don't print a tid. + (panic_): Call sched_yield, not l4_yield. + * process-spawn.c (process_spawn) [! USE_L4]: Don't pass utcb and + kip information. Change sp from a l4_word_to to a uintptr_t. + * profile.c [! USE_L4]: Don't include <l4.h>. + (now) [__gnu_hurd_viengoos__ && ! USE_L4]: Just return 0. + (struct profile_block): Change tid to a vg_thread_id_t. + (MYSELF) [__gnu_hurd_viengoos__ && ! USE_L4]: Just return 0. + * s_printf.c (io_buffer_flush) [! USE_L4]: Abort. + 2008-12-17 Neal H. Walfield <neal@gnu.org> * process-spawn.c (process_spawn): Don't use vg_cap_copy but diff --git a/libc-parts/_exit.c b/libc-parts/_exit.c index d2e6a8a..835b06b 100644 --- a/libc-parts/_exit.c +++ b/libc-parts/_exit.c @@ -80,7 +80,7 @@ _exit (int ret) j --; #ifndef RM_INTERN /* XXX: This doesn't work for laden. */ - l4_yield (); + sched_yield (); #endif } } diff --git a/libc-parts/backtrace.c b/libc-parts/backtrace.c index 4fbe875..8e73557 100644 --- a/libc-parts/backtrace.c +++ b/libc-parts/backtrace.c @@ -17,7 +17,13 @@ <http://www.gnu.org/licenses/>. */ #include <s-printf.h> -#include <l4.h> + +#ifndef RM_INTERN +# include <hurd/thread.h> +#endif +#ifdef USE_L4 +# include <l4.h> +#endif #ifdef RM_INTERN # define RA(level) \ @@ -134,7 +140,17 @@ backtrace_print (void) void *bt[20]; int count = backtrace (bt, sizeof (bt) / sizeof (bt[0])); +#ifdef USE_L4 s_printf ("Backtrace for %x: ", l4_myself ()); +#else +# ifndef RM_INTERN + s_printf ("Backtrace for %x: ", hurd_myself ()); +# else +# warning Don't know how to get tid. + s_printf ("Backtrace: "); +# endif +#endif + int i; for (i = 0; i < count; i ++) s_printf ("%p ", bt[i]); diff --git a/libc-parts/ia32-cmain.c b/libc-parts/ia32-cmain.c index 10390f6..a81a2da 100644 --- a/libc-parts/ia32-cmain.c +++ b/libc-parts/ia32-cmain.c @@ -26,10 +26,12 @@ #include <stdint.h> #include <string.h> +#ifdef USE_L4 #include <l4/globals.h> #include <l4/init.h> #include <l4/stubs.h> #include <l4/stubs-init.h> +#endif #include <hurd/startup.h> #include <hurd/mm.h> @@ -58,7 +60,7 @@ finish (void) /* We are not running on the initial stack. Free it. */ { void *p; - for (p = &_stack; p < &_stack_end; p += PAGESIZE) + for (p = &_stack; p < (void *) &_stack_end; p += PAGESIZE) { struct hurd_object_desc *desc; int i; @@ -125,8 +127,10 @@ finish (void) void cmain (void) { +#ifdef USE_L4 l4_init (); l4_init_stubs (); +#endif s_printf ("In cmain\n"); diff --git a/libc-parts/loader.c b/libc-parts/loader.c index 2db7bb3..d0f26b8 100644 --- a/libc-parts/loader.c +++ b/libc-parts/loader.c @@ -24,8 +24,8 @@ #include <hurd/stddef.h> #include <string.h> - -#include <l4.h> +#include <bits/wordsize.h> +#include <endian.h> #include "loader.h" #include "elf.h" @@ -62,18 +62,18 @@ loader_elf_load (loader_allocate_object_callback_t alloc, /* FIXME: Some architectures support both word sizes. */ if (!((elf->e_ident[EI_CLASS] == ELFCLASS32 - && L4_WORDSIZE == 32) + && __WORDSIZE == 32) || (elf->e_ident[EI_CLASS] == ELFCLASS64 - && L4_WORDSIZE == 64))) + && __WORDSIZE == 64))) { debug (0, "Invalid word size"); return false; } if (!((elf->e_ident[EI_DATA] == ELFDATA2LSB - && L4_BYTE_ORDER == L4_LITTLE_ENDIAN) + && __BYTE_ORDER == __LITTLE_ENDIAN) || (elf->e_ident[EI_DATA] == ELFDATA2MSB - && L4_BYTE_ORDER == L4_BIG_ENDIAN))) + && __BYTE_ORDER == __BIG_ENDIAN))) { debug (0, "Invalid byte order"); return false; diff --git a/libc-parts/panic.c b/libc-parts/panic.c index 71ef763..0c88343 100644 --- a/libc-parts/panic.c +++ b/libc-parts/panic.c @@ -22,6 +22,11 @@ #include <stdio.h> #include <stdarg.h> #include <backtrace.h> +#include <viengoos/thread.h> + +#ifndef RM_INTERN +# include <hurd/thread.h> +#endif extern char *program_name; @@ -34,7 +39,16 @@ panic_ (const char *func, int line, const char *fmt, ...) va_start (ap, fmt); - s_printf ("%s:%s:%d:%x: error: ", program_name, func, line, l4_myself ()); + vg_thread_id_t tid = 0; +#ifdef USE_L4 + tid = l4_myself (); +#elif !defined (RM_INTERN) + tid = hurd_myself (); +#else +# warning Unable to determine thread id for this platform. +#endif + + s_printf ("%s:%s:%d:%x: error: ", program_name, func, line, tid); s_vprintf (fmt, ap); s_printf ("\n"); va_end (ap); @@ -43,6 +57,6 @@ panic_ (const char *func, int line, const char *fmt, ...) _exit (127); for (;;) - l4_yield (); + sched_yield (); } diff --git a/libc-parts/process-spawn.c b/libc-parts/process-spawn.c index 77de8a7..a89ade2 100644 --- a/libc-parts/process-spawn.c +++ b/libc-parts/process-spawn.c @@ -268,16 +268,18 @@ process_spawn (vg_addr_t activity, startup_data->version_major = HURD_STARTUP_VERSION_MAJOR; startup_data->version_minor = HURD_STARTUP_VERSION_MINOR; -#ifdef RM_INTERN +#ifdef USE_L4 +# ifdef RM_INTERN startup_data->utcb_area = UTCB_AREA_BASE; startup_data->rm = l4_myself (); -#else +# else { extern struct hurd_startup_data *__hurd_startup_data; startup_data->utcb_area = __hurd_startup_data->utcb_area; startup_data->rm = __hurd_startup_data->rm; } +# endif #endif startup_data->descs = (void *) STARTUP_DATA_ADDR + descs_offset; @@ -747,7 +749,7 @@ process_spawn (vg_addr_t activity, thread->aspace = *as_root_cap; thread->activity = object_to_cap ((struct vg_object *) root_activity); - l4_word_t sp = STARTUP_DATA_ADDR; + uintptr_t sp = STARTUP_DATA_ADDR; error_t err; err = thread_exregs (root_activity, thread, diff --git a/libc-parts/profile.c b/libc-parts/profile.c index 46b34a4..6507589 100644 --- a/libc-parts/profile.c +++ b/libc-parts/profile.c @@ -30,7 +30,9 @@ #include <string.h> #ifdef __gnu_hurd_viengoos__ -# include <l4.h> +# ifdef USE_L4 +# include <l4.h> +# endif # include <viengoos/misc.h> # include <s-printf.h> #else @@ -63,7 +65,12 @@ static inline uint64_t now (void) { #ifdef __gnu_hurd_viengoos__ +# ifdef USE_L4 return l4_system_clock (); +# else +# warning Not ported to this platform. + return 0; +# endif #else struct timeval t; struct timezone tz; @@ -93,8 +100,13 @@ static int thread_count; struct profile_block { #ifdef __gnu_hurd_viengoos__ -#define MYSELF() l4_myself () - l4_thread_id_t tid; +# ifdef USE_L4 +# define MYSELF() l4_myself () +# else +# warning Profile code broken. +# define MYSELF() 0 +# endif + vg_thread_id_t tid; #else #define MYSELF() pthread_self () pthread_t tid; diff --git a/libc-parts/s_printf.c b/libc-parts/s_printf.c index f7e55f9..94caaa2 100644 --- a/libc-parts/s_printf.c +++ b/libc-parts/s_printf.c @@ -41,6 +41,7 @@ io_buffer_flush (struct io_buffer *buffer) return; // rm_write_send_nonblocking (VG_ADDR_VOID, VG_ADDR_VOID, *buffer, VG_ADDR_VOID); +#ifdef USE_L4 l4_msg_tag_t tag = l4_niltag; l4_msg_tag_set_label (&tag, 2132); @@ -61,6 +62,10 @@ io_buffer_flush (struct io_buffer *buffer) extern struct hurd_startup_data *__hurd_startup_data; l4_send (__hurd_startup_data->rm); +#else +# warning Not ported to this platform. + assert (0); +#endif buffer->len = 0; } |