diff options
96 files changed, 682 insertions, 504 deletions
@@ -1,3 +1,10 @@ +2008-12-17 Neal H. Walfield <neal@gnu.org> + + * libviengoos: New directory. + * Makefile.am (SUBDIRS): Add libviengoos. + * configure.ac: Include libviengoos/headers.m4. Generate + libviengoos/Makefile. + 2008-12-12 Neal H. Walfield <neal@gnu.org> * README: Move build requirements prior to build instructions. diff --git a/Makefile.am b/Makefile.am index d42e746..297e44b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,7 +31,7 @@ else endif if TRAVERSE_HIERARCHY -SUBDIRS = libl4 platform \ +SUBDIRS = libl4 libviengoos platform \ $(LIBC_SUBDIRS) $(NEWLIB_SUBDIRS) \ hurd libhurd-ihash libhurd-btree libbitarray \ libhurd-slab \ diff --git a/benchmarks/GCbench.c b/benchmarks/GCbench.c index 1b786be..eb3652e 100644 --- a/benchmarks/GCbench.c +++ b/benchmarks/GCbench.c @@ -88,8 +88,8 @@ static int iter; #ifdef __gnu_hurd_viengoos__ #include <hurd/storage.h> -#include <hurd/cap.h> -#include <hurd/activity.h> +#include <viengoos/cap.h> +#include <viengoos/activity.h> #include <pthread.h> #include <hurd/anonymous.h> #include <string.h> diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am index 67f7542..f1d8224 100644 --- a/benchmarks/Makefile.am +++ b/benchmarks/Makefile.am @@ -20,9 +20,9 @@ bootdir = $(prefix)/boot if ! ENABLE_TESTS -SUBDIRS = sqlite boehm-gc +SUBDIRS = sqlite # boehm-gc -boot_PROGRAMS = shared-memory-distribution activity-distribution cache gcbench +boot_PROGRAMS = shared-memory-distribution activity-distribution cache # gcbench endif shared_memory_distribution_CPPFLAGS = $(USER_CPPFLAGS) diff --git a/benchmarks/activity-distribution.c b/benchmarks/activity-distribution.c index 46724b6..52cc6a3 100644 --- a/benchmarks/activity-distribution.c +++ b/benchmarks/activity-distribution.c @@ -7,7 +7,7 @@ #include <pthread.h> #include <assert.h> -#include <hurd/activity.h> +#include <viengoos/activity.h> #include <hurd/storage.h> #include <hurd/startup.h> #include <hurd/anonymous.h> diff --git a/benchmarks/boehm-gc/patches/05-viengoos-scheduler.patch b/benchmarks/boehm-gc/patches/05-viengoos-scheduler.patch index 10b5cc2..e986cdf 100644 --- a/benchmarks/boehm-gc/patches/05-viengoos-scheduler.patch +++ b/benchmarks/boehm-gc/patches/05-viengoos-scheduler.patch @@ -237,7 +237,7 @@ diff -uprN -x '*.applied' -x config.guess -x '*~' -x autom4te.cache -x config.su */ +#ifdef __gnu_hurd_viengoos__ -+#include <hurd/activity.h> ++#include <viengoos/activity.h> +#include <hurd/as.h> +#endif +#include <stdint.h> @@ -678,8 +678,8 @@ diff -uprN -x '*.applied' -x config.guess -x '*~' -x autom4te.cache -x config.su } +#ifdef __gnu_hurd_viengoos__ -+#include <hurd/cap.h> -+#include <hurd/addr.h> ++#include <hurd/viengoosh> ++#include <hurd/viengoos.h> +#include <hurd/as.h> + +extern addr_t gc_activity __attribute__ ((weak)); diff --git a/benchmarks/cache.c b/benchmarks/cache.c index 11d0fc5..84942d8 100644 --- a/benchmarks/cache.c +++ b/benchmarks/cache.c @@ -181,8 +181,8 @@ static struct hurd_ihash cache; #ifdef __gnu_hurd_viengoos__ #include <hurd/storage.h> -#include <hurd/cap.h> -#include <hurd/activity.h> +#include <viengoos/cap.h> +#include <viengoos/activity.h> #include <pthread.h> #include <hurd/anonymous.h> #include <hurd/as.h> diff --git a/benchmarks/shared-memory-distribution.c b/benchmarks/shared-memory-distribution.c index 482f0c1..20e38d1 100644 --- a/benchmarks/shared-memory-distribution.c +++ b/benchmarks/shared-memory-distribution.c @@ -6,7 +6,7 @@ #include <string.h> #include <pthread.h> -#include <hurd/activity.h> +#include <viengoos/activity.h> #include <hurd/storage.h> #include <hurd/startup.h> diff --git a/configure.ac b/configure.ac index dfb43d6..52604d7 100644 --- a/configure.ac +++ b/configure.ac @@ -185,6 +185,7 @@ m4_include([viengoos/config.m4]) # Create links for header and library files. m4_include([libl4/headers.m4]) +m4_include([libviengoos/headers.m4]) m4_include([platform/headers.m4]) m4_include([hurd/headers.m4]) m4_include([libhurd-ihash/headers.m4]) @@ -313,6 +314,7 @@ AC_CONFIG_FILES([Makefile libl4/v2/Makefile libl4/v2/ia32/Makefile libl4/x2/Makefile libl4/tests/Makefile libl4/Makefile + libviengoos/Makefile platform/alpha/Makefile platform/amd64/Makefile platform/ia32/Makefile platform/ia64/Makefile platform/powerpc/Makefile platform/powerpc64/Makefile diff --git a/hieronymus/hieronymus.c b/hieronymus/hieronymus.c index 0d99c94..7a0d3da 100644 --- a/hieronymus/hieronymus.c +++ b/hieronymus/hieronymus.c @@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <hurd/activity.h> -#include <hurd/folio.h> +#include <viengoos/activity.h> +#include <viengoos/folio.h> +#include <viengoos/thread.h> #include <hurd/storage.h> #include <hurd/capalloc.h> -#include <hurd/thread.h> #include <hurd/as.h> -#include <hurd/rm.h> +#include <viengoos/misc.h> #include <hurd/ihash.h> #include <process-spawn.h> diff --git a/hurd/ChangeLog b/hurd/ChangeLog index 34e3ba7..8b17eed 100644 --- a/hurd/ChangeLog +++ b/hurd/ChangeLog @@ -1,3 +1,39 @@ +2008-12-17 Neal H. Walfield <neal@gnu.org> + + * activity.h: Move to ../libviengoos/viengoos. Update references. + * addr-trans.h: Likewise. + * addr.h: Likewise. + * cap.h: Likewise. + * folio.h: Likewise. + * futex.h: Likewise. + * ipc.h: Likewise. + * message.h: Likewise. + * messenger.h: Likewise. + * rpc.h: Likewise. + * thread.h: Move viengoos specific bits... + * ../libviengoos/viengoos/thread.h: ... to this new file. + * thread.h (struct hurd_utcb): New structure. + * exceptions.h (hurd_utcb): Use a struct hurd_utcb *, not a + struct vg_utcb *. Update users. + (hurd_activation_state_alloc): Likewise. + (hurd_activation_state_free): Likewise. + (hurd_activation_handler_activated): Likewise. + (hurd_activation_handler_normal): Likewise. + * t-addr-trans.c: Move to ../libviengoos. + * t-addr.c: Likewise. + * t-rpc.c: Likewise. + * Makefile.am (TESTS, check_PROGRAMS, t_addr_CPPFLAGS) + (t_addr_SOURCES, t_addr_trans_CPPFLAGS, t_addr_trans_SOURCES) + (t_rpc_CPPFLAGS, t_rpc_SOURCES): Move from this file... + * ../libviengoos/Makefile.am. + * Makefile.am (includehurd_HEADERS): Don't mention activity.h, + addr-trans.h, addr.h, cap.h, folio.h, futex.h, ipc.h, message.h or + messenger.h. + * headers.m4: Don't create a link to hurd/addr.h, + hurd/addr-trans.h, hurd/cap.h, hurd/folio.h, hurd/rpc.h, + hurd/activity.h, hurd/futex.h, hurd/message.h, hurd/messenger.h or + hurd/ipc.h. + 2008-12-16 Neal H. Walfield <neal@gnu.org> * thread.h (struct vg_utcb): Remove field saved_thread_state. diff --git a/hurd/Makefile.am b/hurd/Makefile.am index f385acd..4eae77a 100644 --- a/hurd/Makefile.am +++ b/hurd/Makefile.am @@ -18,18 +18,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. includehurddir = $(includedir)/hurd -includehurd_HEADERS = rpc.h startup.h stddef.h types.h addr.h \ - addr-trans.h cap.h folio.h exceptions.h thread.h activity.h \ - lock.h mutex.h rmutex.h futex.h error.h trace.h - -TESTS = t-addr t-addr-trans t-rpc -check_PROGRAMS = $(TESTS) - -t_addr_CPPFLAGS = $(CHECK_CPPFLAGS) -t_addr_SOURCES = t-addr.c - -t_addr_trans_CPPFLAGS = $(CHECK_CPPFLAGS) -t_addr_trans_SOURCES = t-addr-trans.c - -t_rpc_CPPFLAGS = $(CHECK_CPPFLAGS) -t_rpc_SOURCES = t-rpc.c +includehurd_HEADERS = startup.h stddef.h types.h \ + exceptions.h thread.h \ + lock.h mutex.h rmutex.h error.h trace.h diff --git a/hurd/exceptions.h b/hurd/exceptions.h index 765fc5f..6d27d6e 100644 --- a/hurd/exceptions.h +++ b/hurd/exceptions.h @@ -26,14 +26,14 @@ #ifndef ASM #include <stdint.h> -#include <hurd/cap.h> -#include <hurd/thread.h> +#include <viengoos/cap.h> +#include <viengoos/thread.h> #include <hurd/error.h> #include <l4/space.h> #define RPC_STUB_PREFIX activation #define RPC_ID_PREFIX ACTIVATION -#include <hurd/rpc.h> +#include <viengoos/rpc.h> /* Activation message ids. */ enum @@ -102,7 +102,7 @@ extern void hurd_activation_handler_init (void); /* Return the calling thread's UTCB. Threading libraries should set this to their own implementation once they are up and running. */ -extern struct vg_utcb *(*hurd_utcb) (void); +extern struct hurd_utcb *(*hurd_utcb) (void); /* Allocate a utcb buffer and associated data structures (including an exception messenger) for the thread THEAD (which must already exist @@ -110,11 +110,11 @@ extern struct vg_utcb *(*hurd_utcb) (void); messenger in the thread object. Returns the new UTCB in *UTCB. Returns 0 on success, otherwise an error code. */ extern error_t hurd_activation_state_alloc (addr_t thread, - struct vg_utcb **utcb); + struct hurd_utcb **utcb); /* Release the state allocated by hurd_activation_state_alloc. May not be called by a thread on its own UTCB! */ -extern void hurd_activation_state_free (struct vg_utcb *utcb); +extern void hurd_activation_state_free (struct hurd_utcb *utcb); /* When a thread causes an activation, the kernel invokes the thread's @@ -139,10 +139,10 @@ extern void hurd_activation_state_free (struct vg_utcb *utcb); stack. When this function returns, the interrupted state is restored. */ extern struct activation_frame *hurd_activation_handler_activated - (struct vg_utcb *utcb); + (struct hurd_utcb *utcb); extern void hurd_activation_handler_normal - (struct activation_frame *activation_frame, struct vg_utcb *utcb); + (struct activation_frame *activation_frame, struct hurd_utcb *utcb); /* The first instruction of activation handler dispatcher. */ diff --git a/hurd/headers.m4 b/hurd/headers.m4 index 51b19fd..d5842fb 100644 --- a/hurd/headers.m4 +++ b/hurd/headers.m4 @@ -13,23 +13,13 @@ AC_CONFIG_LINKS([sysroot/include/hurd/stddef.h:hurd/stddef.h sysroot/include/hurd/types.h:hurd/types.h sysroot/include/hurd/startup.h:hurd/startup.h - sysroot/include/hurd/addr.h:hurd/addr.h - sysroot/include/hurd/addr-trans.h:hurd/addr-trans.h - sysroot/include/hurd/cap.h:hurd/cap.h - sysroot/include/hurd/folio.h:hurd/folio.h - sysroot/include/hurd/rpc.h:hurd/rpc.h sysroot/include/hurd/exceptions.h:hurd/exceptions.h sysroot/include/hurd/thread.h:hurd/thread.h - sysroot/include/hurd/activity.h:hurd/activity.h sysroot/include/hurd/lock.h:hurd/lock.h sysroot/include/hurd/trace.h:hurd/trace.h sysroot/include/hurd/mutex.h:hurd/mutex.h sysroot/include/hurd/rmutex.h:hurd/rmutex.h - sysroot/include/hurd/futex.h:hurd/futex.h sysroot/include/hurd/error.h:hurd/error.h - sysroot/include/hurd/message.h:hurd/message.h - sysroot/include/hurd/messenger.h:hurd/messenger.h - sysroot/include/hurd/ipc.h:hurd/ipc.h sysroot/include/hurd/math.h:hurd/math.h sysroot/include/hurd/bits/math.h:hurd/bits/${arch}/math.h ]) diff --git a/hurd/mutex.h b/hurd/mutex.h index cded557..4e68701 100644 --- a/hurd/mutex.h +++ b/hurd/mutex.h @@ -39,7 +39,7 @@ typedef int ss_mutex_t; #include <l4/thread.h> #include <assert.h> #include <hurd/lock.h> -#include <hurd/futex.h> +#include <viengoos/futex.h> /* Unlocked. */ #define _MUTEX_UNLOCKED 0 diff --git a/hurd/startup.h b/hurd/startup.h index 0c31d9f..8ca0da0 100644 --- a/hurd/startup.h +++ b/hurd/startup.h @@ -24,7 +24,7 @@ #include <stddef.h> #include <hurd/types.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #ifdef USE_L4 # include <l4/types.h> diff --git a/hurd/thread.h b/hurd/thread.h index 522d13a..4427db3 100644 --- a/hurd/thread.h +++ b/hurd/thread.h @@ -16,23 +16,6 @@ License along with GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __have_vg_thread_id_t -# define __have_vg_thread_id_t - -# ifdef USE_L4 -# include <l4.h> -typedef l4_thread_id_t vg_thread_id_t; -# define vg_niltid l4_nilthread -# define VG_THREAD_ID_FMT "%x" -# else -# include <stdint.h> -typedef uint64_t vg_thread_id_t; -# define vg_niltid -1 -# define VG_THREAD_ID_FMT "%llx" -# endif - -#endif /* !__have_vg_thread_id_t */ - #ifndef __have_activation_frame # define __have_activation_frame @@ -95,22 +78,59 @@ struct activation_frame }; #endif -#if defined(__need_vg_thread_id_t) || defined (__need_activation_frame) -# undef __need_vg_thread_id_t +#if defined (__need_activation_frame) # undef __need_activation_frame #else #ifndef _HURD_THREAD_H #define _HURD_THREAD_H 1 +#include <viengoos/thread.h> + #include <stdint.h> #include <hurd/types.h> -#include <hurd/addr.h> -#include <hurd/addr-trans.h> -#include <hurd/cap.h> -#include <hurd/messenger.h> +#include <viengoos/addr.h> +#include <viengoos/addr-trans.h> +#include <viengoos/cap.h> +#include <viengoos/messenger.h> #include <setjmp.h> +/* The user thread control block. */ +struct hurd_utcb +{ + struct vg_utcb vg; + + /* Top of the activation frame stack (i.e., the active + activation). */ + struct activation_frame *activation_stack; + /* The bottom of the activation stack. */ + struct activation_frame *activation_stack_bottom; + + /* The CRC protects the above fields by checking for + modification, which can happen if a call back function uses + too much stack. The fields following crc are not protected + by the crc as they are expected to be changed by the + activation handler. */ + + uintptr_t crc; + + /* The exception buffer. */ + struct hurd_message_buffer *exception_buffer; + /* The current extant IPC. */ + struct hurd_message_buffer *extant_message; + + struct hurd_fault_catcher *catchers; + + /* The alternate activation stack. */ + void *alternate_stack; + bool alternate_stack_inuse; + +#define UTCB_CANARY0 0xCA17A1 +#define UTCB_CANARY1 0xDEADB15D + uintptr_t canary0; + uintptr_t canary1; +}; + /* Cause the activation frame to assume the state of the long jump buffer BUF. If SET_RET is true, the normal function return value is set to RET. */ @@ -141,258 +161,6 @@ extern void hurd_fault_catcher_register (struct hurd_fault_catcher *catcher); /* Unregister a fault catch handler. */ extern void hurd_fault_catcher_unregister (struct hurd_fault_catcher *catcher); - -/* The user thread control block. */ -struct vg_utcb -{ - union - { - /* The following structures are examined or modified by the - kernel. */ - - /* **** ia32-exception-entry.S silently depends on the layout of - this structure **** */ - struct - { - union - { - struct - { - /* Whether the thread is in activated mode. If so, any - activations that arrive during this time will be queued - or dropped. */ - uintptr_t activated_mode : 1; - /* Set by the kernel to indicated that there is a pending - message. */ - uintptr_t pending_message : 1; - /* Set by the kernel to indicate whether the thread was - interrupted while the EIP is in the transition range. */ - uintptr_t interrupt_in_transition : 1; - }; - uintptr_t mode; - }; - - /* The value of the IP and SP when the thread was running. */ - uintptr_t saved_ip; - uintptr_t saved_sp; - - /* Top of the activation frame stack (i.e., the active - activation). */ - struct activation_frame *activation_stack; - /* The bottom of the activation stack. */ - struct activation_frame *activation_stack_bottom; - - uintptr_t activation_handler_sp; - uintptr_t activation_handler_ip; - uintptr_t activation_handler_end; - - /* The protected payload of the capability that invoked the - messenger that caused this activation. */ - uint64_t protected_payload; - /* The messenger's id. */ - uint64_t messenger_id; - - uintptr_t inline_words[VG_MESSENGER_INLINE_WORDS]; - addr_t inline_caps[VG_MESSENGER_INLINE_CAPS]; - - union - { - struct - { - int inline_word_count : 2; - int inline_cap_count : 1; - }; - int inline_data : 3; - }; - - /* The following fields are not examined or modified by the - kernel. */ - - /* The CRC protects the above fields by checking for - modification, which can happen if a call back function uses - too much stack. The fields following crc are not protected - by the crc as they are expected to be changed by the - activation handler. */ - - uintptr_t crc; - - /* The exception buffer. */ - struct hurd_message_buffer *exception_buffer; - /* The current extant IPC. */ - struct hurd_message_buffer *extant_message; - - struct hurd_fault_catcher *catchers; - - /* The alternate activation stack. */ - void *alternate_stack; - bool alternate_stack_inuse; - -#define UTCB_CANARY0 0xCA17A1 -#define UTCB_CANARY1 0xDEADB15D - uintptr_t canary0; - uintptr_t canary1; - }; - char data[PAGESIZE]; - }; -}; - -/* A thread object's user accessible capability slots. */ -enum - { - /* Root of the address space. */ - THREAD_ASPACE_SLOT = 0, - /* The activity the thread is bound to. */ - THREAD_ACTIVITY_SLOT = 1, - /* The messenger to post exceptions to. */ - THREAD_EXCEPTION_MESSENGER = 2, - /* The user thread control block. Must be a cap_page. */ - THREAD_UTCB = 3, - - /* Total number of capability slots in a thread object. This must - be a power of 2. */ - THREAD_SLOTS = 4, - }; -#define THREAD_SLOTS_LOG2 2 - -enum -{ - HURD_EXREGS_SET_UTCB = 0x2000, - HURD_EXREGS_SET_EXCEPTION_MESSENGER = 0x1000, - HURD_EXREGS_SET_ASPACE = 0x800, - HURD_EXREGS_SET_ACTIVITY = 0x400, - HURD_EXREGS_SET_SP = _L4_XCHG_REGS_SET_SP, - HURD_EXREGS_SET_IP = _L4_XCHG_REGS_SET_IP, - HURD_EXREGS_SET_SP_IP = _L4_XCHG_REGS_SET_SP | _L4_XCHG_REGS_SET_IP, - HURD_EXREGS_SET_EFLAGS = _L4_XCHG_REGS_SET_FLAGS, - HURD_EXREGS_SET_USER_HANDLE = _L4_XCHG_REGS_SET_USER_HANDLE, - HURD_EXREGS_SET_REGS = (HURD_EXREGS_SET_UTCB - | HURD_EXREGS_SET_EXCEPTION_MESSENGER - | HURD_EXREGS_SET_ASPACE - | HURD_EXREGS_SET_ACTIVITY - | HURD_EXREGS_SET_SP - | HURD_EXREGS_SET_IP - | HURD_EXREGS_SET_EFLAGS - | HURD_EXREGS_SET_USER_HANDLE), - - HURD_EXREGS_GET_REGS = _L4_XCHG_REGS_DELIVER, - - HURD_EXREGS_START = _L4_XCHG_REGS_SET_HALT, - HURD_EXREGS_STOP = _L4_XCHG_REGS_SET_HALT | _L4_XCHG_REGS_HALT, - - HURD_EXREGS_ABORT_SEND = _L4_XCHG_REGS_CANCEL_SEND, - HURD_EXREGS_ABORT_RECEIVE = _L4_XCHG_REGS_CANCEL_RECV, - HURD_EXREGS_ABORT_IPC = HURD_EXREGS_ABORT_SEND | _L4_XCHG_REGS_CANCEL_RECV, -}; - -enum - { - RM_thread_exregs = 600, - RM_thread_id, - RM_thread_activation_collect, - }; - -#ifdef RM_INTERN -struct thread; -typedef struct thread *thread_t; -#else -typedef addr_t thread_t; -#endif - -#define RPC_STUB_PREFIX rm -#define RPC_ID_PREFIX RM - -#include <hurd/rpc.h> - -struct hurd_thread_exregs_in -{ - uintptr_t aspace_cap_properties_flags; - struct cap_properties aspace_cap_properties; - - uintptr_t sp; - uintptr_t ip; - uintptr_t eflags; - uintptr_t user_handle; -}; - -struct hurd_thread_exregs_out -{ - uintptr_t sp; - uintptr_t ip; - uintptr_t eflags; - uintptr_t user_handle; -}; - -/* l4_exregs wrapper. */ -RPC (thread_exregs, 6, 1, 4, - /* cap_t principal, cap_t thread, */ - uintptr_t, control, struct hurd_thread_exregs_in, in, - cap_t, aspace, cap_t, activity, cap_t, utcb, cap_t, exception_messenger, - /* Out: */ - struct hurd_thread_exregs_out, out, - cap_t, aspace_out, cap_t, activity_out, cap_t, utcb_out, - cap_t, exception_messenger_out) - -static inline error_t -thread_start (addr_t thread) -{ - struct hurd_thread_exregs_in in; - struct hurd_thread_exregs_out out; - - return rm_thread_exregs (ADDR_VOID, thread, - HURD_EXREGS_START | HURD_EXREGS_ABORT_IPC, - in, ADDR_VOID, ADDR_VOID, ADDR_VOID, ADDR_VOID, - &out, NULL, NULL, NULL, NULL); -} - -static inline error_t -thread_start_sp_ip (addr_t thread, uintptr_t sp, uintptr_t ip) -{ - struct hurd_thread_exregs_in in; - struct hurd_thread_exregs_out out; - - in.sp = sp; - in.ip = ip; - - return rm_thread_exregs (ADDR_VOID, thread, - HURD_EXREGS_START | HURD_EXREGS_ABORT_IPC - | HURD_EXREGS_SET_SP_IP, - in, ADDR_VOID, ADDR_VOID, ADDR_VOID, ADDR_VOID, - &out, NULL, NULL, NULL, NULL); -} - -static inline error_t -thread_stop (addr_t thread) -{ - struct hurd_thread_exregs_in in; - struct hurd_thread_exregs_out out; - - return rm_thread_exregs (ADDR_VOID, thread, - HURD_EXREGS_STOP | HURD_EXREGS_ABORT_IPC, - in, ADDR_VOID, ADDR_VOID, ADDR_VOID, ADDR_VOID, - &out, NULL, NULL, NULL, NULL); -} - -/* Return the unique integer associated with thread THREAD. */ -RPC(thread_id, 0, 1, 0, - /* cap_t, principal, cap_t, thread, */ - vg_thread_id_t, tid) - -/* Cause the delivery of a pending message, if any. */ -RPC(thread_activation_collect, 0, 0, 0 - /* cap_t principal, cap_t thread */) - -#undef RPC_STUB_PREFIX -#undef RPC_ID_PREFIX - -static inline vg_thread_id_t -vg_myself (void) -{ - vg_thread_id_t tid; - error_t err = rm_thread_id (ADDR_VOID, ADDR_VOID, &tid); - if (err) - return vg_niltid; - return tid; -} #endif /* _HURD_THREAD_H */ -#endif /* __need_vg_thread_id_t */ +#endif /* __need_activation_frame */ diff --git a/hurd/types.h b/hurd/types.h index fefe928..7d5e9be 100644 --- a/hurd/types.h +++ b/hurd/types.h @@ -22,6 +22,6 @@ #ifndef _HURD_TYPES_H #define _HURD_TYPES_H 1 -#include <hurd/addr.h> +#include <viengoos/addr.h> #endif /* _HURD_TYPES_H */ diff --git a/libc-parts/_exit.c b/libc-parts/_exit.c index fc9630d..6e07898 100644 --- a/libc-parts/_exit.c +++ b/libc-parts/_exit.c @@ -20,7 +20,7 @@ #include <hurd/stddef.h> #include <hurd/startup.h> -#include <hurd/folio.h> +#include <viengoos/folio.h> int __global_zero; diff --git a/libc-parts/backtrace.c b/libc-parts/backtrace.c index 5439413..342c65d 100644 --- a/libc-parts/backtrace.c +++ b/libc-parts/backtrace.c @@ -33,6 +33,7 @@ #else # include <hurd/exceptions.h> +# include <hurd/thread.h> # include <setjmp.h> # define RA(level) \ diff --git a/libc-parts/process-spawn.c b/libc-parts/process-spawn.c index 4211951..843da21 100644 --- a/libc-parts/process-spawn.c +++ b/libc-parts/process-spawn.c @@ -18,10 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <hurd/folio.h> -#include <hurd/thread.h> +#include <viengoos/folio.h> +#include <viengoos/thread.h> +#include <viengoos/misc.h> #include <hurd/as.h> -#include <hurd/rm.h> #include <loader.h> #include <string.h> diff --git a/libc-parts/process-spawn.h b/libc-parts/process-spawn.h index af23a77..b11d5ae 100644 --- a/libc-parts/process-spawn.h +++ b/libc-parts/process-spawn.h @@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <hurd/addr.h> -#include <hurd/thread.h> +#include <viengoos/addr.h> +#include <viengoos/thread.h> /* Load a task. Return a capability designating the main thread. The slot is allocated with capalloc. If MAKE_RUNNABLE is true, makes diff --git a/libc-parts/profile.c b/libc-parts/profile.c index 01525e5..58d8dec 100644 --- a/libc-parts/profile.c +++ b/libc-parts/profile.c @@ -31,8 +31,8 @@ #ifdef __gnu_hurd_viengoos__ # include <l4.h> -# include <hurd/rm.h> -# include <s-printf.h> +# include <viengoos/misc.h> +# include <s-printf.h> #else # include <pthread.h> # include <sys/time.h> diff --git a/libc-parts/s_printf.c b/libc-parts/s_printf.c index 7940af8..fa417fb 100644 --- a/libc-parts/s_printf.c +++ b/libc-parts/s_printf.c @@ -29,7 +29,7 @@ #endif #include <stdarg.h> -#include <hurd/rm.h> +#include <viengoos/misc.h> #include "s-printf.h" diff --git a/libhurd-mm/anonymous.c b/libhurd-mm/anonymous.c index dc5a78b..c6f0bcb 100644 --- a/libhurd-mm/anonymous.c +++ b/libhurd-mm/anonymous.c @@ -28,7 +28,7 @@ #include <hurd/btree.h> #include <hurd/slab.h> -#include <hurd/rm.h> +#include <viengoos/misc.h> #include <profile.h> #include <backtrace.h> diff --git a/libhurd-mm/anonymous.h b/libhurd-mm/anonymous.h index e946dc2..fe5491e 100644 --- a/libhurd-mm/anonymous.h +++ b/libhurd-mm/anonymous.h @@ -23,7 +23,7 @@ #include <hurd/pager.h> #include <hurd/btree.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/exceptions.h> #include <l4/thread.h> diff --git a/libhurd-mm/as-build-custom.c b/libhurd-mm/as-build-custom.c index d393f54..5c200ce 100644 --- a/libhurd-mm/as-build-custom.c +++ b/libhurd-mm/as-build-custom.c @@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <hurd/activity.h> -#include <hurd/addr.h> -#include <hurd/cap.h> +#include <viengoos/activity.h> +#include <viengoos/addr.h> +#include <viengoos/cap.h> /* Expose as_slot_ensure_full_custom and as_insert_custom. */ #define ID_SUFFIX custom diff --git a/libhurd-mm/as-build.c b/libhurd-mm/as-build.c index 728183b..b2266cb 100644 --- a/libhurd-mm/as-build.c +++ b/libhurd-mm/as-build.c @@ -22,12 +22,12 @@ #include <stddef.h> #include <assert.h> -#include <hurd/cap.h> +#include <viengoos/cap.h> #include <hurd/stddef.h> -#include <hurd/folio.h> +#include <viengoos/folio.h> #include <hurd/exceptions.h> #include <hurd/as.h> -#include <hurd/rm.h> +#include <viengoos/misc.h> #ifndef RM_INTERN # include <hurd/storage.h> diff --git a/libhurd-mm/as-compute-gbits.h b/libhurd-mm/as-compute-gbits.h index 72faf8e..4fe1d42 100644 --- a/libhurd-mm/as-compute-gbits.h +++ b/libhurd-mm/as-compute-gbits.h @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <hurd/folio.h> +#include <viengoos/folio.h> struct as_guard_cappage { diff --git a/libhurd-mm/as-dump.c b/libhurd-mm/as-dump.c index f0f8e1f..4eb4168 100644 --- a/libhurd-mm/as-dump.c +++ b/libhurd-mm/as-dump.c @@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <hurd/cap.h> -#include <hurd/folio.h> +#include <viengoos/cap.h> +#include <viengoos/folio.h> #include <hurd/as.h> #include <hurd/stddef.h> #include <assert.h> diff --git a/libhurd-mm/as-lookup.c b/libhurd-mm/as-lookup.c index ca8fb30..7639fd1 100644 --- a/libhurd-mm/as-lookup.c +++ b/libhurd-mm/as-lookup.c @@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <hurd/cap.h> -#include <hurd/folio.h> +#include <viengoos/cap.h> +#include <viengoos/folio.h> #include <hurd/as.h> #include <hurd/stddef.h> #include <assert.h> diff --git a/libhurd-mm/as.c b/libhurd-mm/as.c index 4daed0c..be9dc09 100644 --- a/libhurd-mm/as.c +++ b/libhurd-mm/as.c @@ -20,11 +20,11 @@ #include "as.h" #include "storage.h" -#include <hurd/rm.h> +#include <viengoos/misc.h> #include <pthread.h> -#include <hurd/folio.h> -#include <hurd/cap.h> +#include <viengoos/folio.h> +#include <viengoos/cap.h> #include <hurd/btree.h> #include <hurd/slab.h> #include <hurd/mutex.h> diff --git a/libhurd-mm/as.h b/libhurd-mm/as.h index 1e281b6..8343fdd 100644 --- a/libhurd-mm/as.h +++ b/libhurd-mm/as.h @@ -22,8 +22,8 @@ #ifndef _HURD_AS_H #define _HURD_AS_H -#include <hurd/addr.h> -#include <hurd/cap.h> +#include <viengoos/addr.h> +#include <viengoos/cap.h> #include <hurd/exceptions.h> #include <stdbool.h> #include <l4/types.h> diff --git a/libhurd-mm/capalloc.c b/libhurd-mm/capalloc.c index dde4956..998b123 100644 --- a/libhurd-mm/capalloc.c +++ b/libhurd-mm/capalloc.c @@ -24,7 +24,7 @@ #include "storage.h" #include "as.h" -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/btree.h> #include <hurd/slab.h> #include <hurd/stddef.h> diff --git a/libhurd-mm/capalloc.h b/libhurd-mm/capalloc.h index 77d6359..5583f3f 100644 --- a/libhurd-mm/capalloc.h +++ b/libhurd-mm/capalloc.h @@ -22,7 +22,7 @@ #ifndef _HURD_CAP_ALLOC_H #define _HURD_CAP_ALLOC_H -#include <hurd/addr.h> +#include <viengoos/addr.h> /* Allocate a capability slot. */ extern addr_t capalloc (void); diff --git a/libhurd-mm/exceptions.c b/libhurd-mm/exceptions.c index 26ad7c7..73d9a9f 100644 --- a/libhurd-mm/exceptions.c +++ b/libhurd-mm/exceptions.c @@ -24,7 +24,7 @@ #include <hurd/storage.h> #include <hurd/thread.h> #include <hurd/mm.h> -#include <hurd/rm.h> +#include <viengoos/misc.h> #include <hurd/slab.h> #include <l4/thread.h> @@ -38,7 +38,7 @@ void hurd_fault_catcher_register (struct hurd_fault_catcher *catcher) { - struct vg_utcb *utcb = hurd_utcb (); + struct hurd_utcb *utcb = hurd_utcb (); assert (utcb); assert (catcher); @@ -153,7 +153,7 @@ hurd_activation_message_register (struct hurd_message_buffer *message_buffer) if (unlikely (! mm_init_done)) return; - struct vg_utcb *utcb = hurd_utcb (); + struct hurd_utcb *utcb = hurd_utcb (); assert (utcb); assert (message_buffer); @@ -173,7 +173,7 @@ hurd_activation_message_unregister (struct hurd_message_buffer *message_buffer) if (unlikely (! mm_init_done)) return; - struct vg_utcb *utcb = hurd_utcb (); + struct hurd_utcb *utcb = hurd_utcb (); assert (utcb); assert (message_buffer); assert (utcb->extant_message == message_buffer); @@ -218,7 +218,7 @@ activation_frame_slab_dealloc (void *hook, void *buffer, size_t size) } static void -check_activation_frame_reserve (struct vg_utcb *utcb) +check_activation_frame_reserve (struct hurd_utcb *utcb) { if (unlikely (! utcb->activation_stack || ! utcb->activation_stack->prev)) @@ -244,7 +244,7 @@ check_activation_frame_reserve (struct vg_utcb *utcb) } static struct activation_frame * -activation_frame_alloc (struct vg_utcb *utcb) +activation_frame_alloc (struct hurd_utcb *utcb) { struct activation_frame *activation_frame; @@ -272,7 +272,7 @@ activation_frame_alloc (struct vg_utcb *utcb) void hurd_activation_stack_dump (void) { - struct vg_utcb *utcb = hurd_utcb (); + struct hurd_utcb *utcb = hurd_utcb (); int depth = 0; struct activation_frame *activation_frame; @@ -300,7 +300,7 @@ hurd_activation_stack_dump (void) void hurd_activation_handler_normal (struct activation_frame *activation_frame, - struct vg_utcb *utcb) + struct hurd_utcb *utcb) { assert (utcb == hurd_utcb ()); assert (activation_frame->canary == ACTIVATION_FRAME_CANARY); @@ -451,7 +451,7 @@ hurd_activation_handler_normal (struct activation_frame *activation_frame, #ifndef NDEBUG static uintptr_t -crc (struct vg_utcb *utcb) +crc (struct hurd_utcb *utcb) { uintptr_t crc = 0; uintptr_t *p; @@ -463,15 +463,15 @@ crc (struct vg_utcb *utcb) #endif struct activation_frame * -hurd_activation_handler_activated (struct vg_utcb *utcb) +hurd_activation_handler_activated (struct hurd_utcb *utcb) { assert (((uintptr_t) utcb & (PAGESIZE - 1)) == 0); assert (utcb->canary0 == UTCB_CANARY0); assert (utcb->canary1 == UTCB_CANARY1); - assert (utcb->activated_mode); + assert (utcb->vg.activated_mode); /* XXX: Assumption that stack grows down... */ - assert (utcb->activation_handler_sp - PAGESIZE <= (uintptr_t) &utcb); - assert ((uintptr_t) &utcb <= utcb->activation_handler_sp); + assert (utcb->vg.activation_handler_sp - PAGESIZE <= (uintptr_t) &utcb); + assert ((uintptr_t) &utcb <= utcb->vg.activation_handler_sp); if (unlikely (! mm_init_done)) /* Just returns: during initialization, we don't except any faults or @@ -485,14 +485,14 @@ hurd_activation_handler_activated (struct vg_utcb *utcb) assertx (utcb == hurd_utcb (), "%p != %p (func: %p; ip: %p, sp: %p)", utcb, hurd_utcb (), hurd_utcb, - (void *) utcb->saved_ip, (void *) utcb->saved_sp); + (void *) utcb->vg.saved_ip, (void *) utcb->vg.saved_sp); debug (5, "Activation handler called (utcb: %p)", utcb); struct hurd_message_buffer *mb - = (struct hurd_message_buffer *) (uintptr_t) utcb->messenger_id; + = (struct hurd_message_buffer *) (uintptr_t) utcb->vg.messenger_id; - debug (5, "Got message %llx (utcb: %p)", utcb->messenger_id, utcb); + debug (5, "Got message %llx (utcb: %p)", utcb->vg.messenger_id, utcb); assert (mb->magic == HURD_MESSAGE_BUFFER_MAGIC); @@ -608,7 +608,7 @@ hurd_activation_handler_activated (struct vg_utcb *utcb) else { panic ("Unknown messenger %llx (extant: %p; exception: %p) (label: %d)", - utcb->messenger_id, + utcb->vg.messenger_id, utcb->extant_message, utcb->exception_buffer, vg_message_word (mb->reply, 0)); } @@ -643,9 +643,9 @@ static char activation_handler_area0[PAGESIZE] __attribute__ ((aligned (PAGESIZE))); static char activation_handler_msg[PAGESIZE] __attribute__ ((aligned (PAGESIZE))); -static struct vg_utcb *initial_utcb = (void *) &activation_handler_area0[0]; +static struct hurd_utcb *initial_utcb = (void *) &activation_handler_area0[0]; -static struct vg_utcb * +static struct hurd_utcb * simple_utcb_fetcher (void) { assert (initial_utcb->canary0 == UTCB_CANARY0); @@ -654,7 +654,7 @@ simple_utcb_fetcher (void) return initial_utcb; } -struct vg_utcb *(*hurd_utcb) (void); +struct hurd_utcb *(*hurd_utcb) (void); void hurd_activation_handler_init_early (void) @@ -664,21 +664,21 @@ hurd_activation_handler_init_early (void) hurd_utcb = simple_utcb_fetcher; - struct vg_utcb *utcb = hurd_utcb (); + struct hurd_utcb *utcb = hurd_utcb (); assert (utcb == initial_utcb); /* XXX: We assume the stack grows down! SP is set to the end of the exception page. */ - utcb->activation_handler_sp + utcb->vg.activation_handler_sp = (uintptr_t) activation_handler_area0 + sizeof (activation_handler_area0); /* The word beyond the base of the stack is interpreted as a pointer to the exception page. Make it so. */ - utcb->activation_handler_sp -= sizeof (void *); - * (void **) utcb->activation_handler_sp = utcb; + utcb->vg.activation_handler_sp -= sizeof (void *); + * (void **) utcb->vg.activation_handler_sp = utcb; - utcb->activation_handler_ip = (uintptr_t) &hurd_activation_handler_entry; - utcb->activation_handler_end = (uintptr_t) &hurd_activation_handler_end; + utcb->vg.activation_handler_ip = (uintptr_t) &hurd_activation_handler_entry; + utcb->vg.activation_handler_end = (uintptr_t) &hurd_activation_handler_end; struct hurd_thread_exregs_in in; memset (&in, 0, sizeof (in)); @@ -703,14 +703,14 @@ hurd_activation_handler_init_early (void) 0, 0, ADDR_VOID); if (err) panic ("Failed to send IPC: %d", err); - if (utcb->inline_words[0]) - panic ("Failed to install utcb page: %d", utcb->inline_words[0]); + if (utcb->vg.inline_words[0]) + panic ("Failed to install utcb page: %d", utcb->vg.inline_words[0]); } void hurd_activation_handler_init (void) { - struct vg_utcb *utcb; + struct hurd_utcb *utcb; error_t err = hurd_activation_state_alloc (__hurd_startup_data->thread, &utcb); if (err) @@ -730,7 +730,7 @@ hurd_activation_handler_init (void) #define ACTIVATION_AREA_SIZE (1 << ACTIVATION_AREA_SIZE_LOG2) error_t -hurd_activation_state_alloc (addr_t thread, struct vg_utcb **utcbp) +hurd_activation_state_alloc (addr_t thread, struct hurd_utcb **utcbp) { debug (5, DEBUG_BOLD ("allocating activation state for " ADDR_FMT), ADDR_PRINTF (thread)); @@ -780,7 +780,7 @@ hurd_activation_state_alloc (addr_t thread, struct vg_utcb **utcbp) int page = SKIP; /* Allocate the utcb. */ - struct vg_utcb *utcb = activation_area_base + page * PAGESIZE; + struct hurd_utcb *utcb = activation_area_base + page * PAGESIZE; alloc (utcb); page += 1 + SKIP; @@ -790,30 +790,31 @@ hurd_activation_state_alloc (addr_t thread, struct vg_utcb **utcbp) XXX: We assume the stack grows down! */ #ifndef NDEBUG /* Use a dedicated page. */ - utcb->activation_handler_sp + utcb->vg.activation_handler_sp = (uintptr_t) activation_area_base + page * PAGESIZE; - alloc ((void *) utcb->activation_handler_sp); + alloc ((void *) utcb->vg.activation_handler_sp); - utcb->activation_handler_sp += PAGESIZE; + utcb->vg.activation_handler_sp += PAGESIZE; page += 1 + SKIP; #else /* Use the end of the UTCB. */ - utcb->activation_handler_sp = utcb + PAGESIZE; + utcb->vg.activation_handler_sp = utcb + PAGESIZE; #endif /* At the top of the stack page, we use some space to remember the storage we allocate so that we can free it later. */ - utcb->activation_handler_sp + utcb->vg.activation_handler_sp -= sizeof (addr_t) * ACTIVATION_AREA_SIZE / PAGESIZE; - memset (utcb->activation_handler_sp, 0, + memset ((void *) utcb->vg.activation_handler_sp, 0, sizeof (addr_t) * ACTIVATION_AREA_SIZE / PAGESIZE); - memcpy (utcb->activation_handler_sp, pages, sizeof (addr_t) * page_count); - pages = (addr_t *) utcb->activation_handler_sp; + memcpy ((void *) utcb->vg.activation_handler_sp, pages, + sizeof (addr_t) * page_count); + pages = (addr_t *) utcb->vg.activation_handler_sp; /* The word beyond the base of the stack is a pointer to the exception page. */ - utcb->activation_handler_sp -= sizeof (void *); - * (void **) utcb->activation_handler_sp = utcb; + utcb->vg.activation_handler_sp -= sizeof (void *); + * (void **) utcb->vg.activation_handler_sp = utcb; /* And a medium-sized alternate stack. */ @@ -829,8 +830,8 @@ hurd_activation_state_alloc (addr_t thread, struct vg_utcb **utcbp) utcb->alternate_stack = a; - utcb->activation_handler_ip = (uintptr_t) &hurd_activation_handler_entry; - utcb->activation_handler_end = (uintptr_t) &hurd_activation_handler_end; + utcb->vg.activation_handler_ip = (uintptr_t) &hurd_activation_handler_entry; + utcb->vg.activation_handler_end = (uintptr_t) &hurd_activation_handler_end; utcb->exception_buffer = hurd_message_buffer_alloc_long (); utcb->extant_message = NULL; @@ -841,7 +842,7 @@ hurd_activation_state_alloc (addr_t thread, struct vg_utcb **utcbp) debug (5, "Activation area: %p-%p; utcb: %p; stack: %p; alt stack: %p", (void *) activation_area_base, (void *) activation_area_base + ACTIVATION_AREA_SIZE - 1, - utcb, (void *) utcb->activation_handler_sp, utcb->alternate_stack); + utcb, (void *) utcb->vg.activation_handler_sp, utcb->alternate_stack); /* Unblock the exception handler messenger. */ @@ -880,7 +881,7 @@ hurd_activation_state_alloc (addr_t thread, struct vg_utcb **utcbp) } void -hurd_activation_state_free (struct vg_utcb *utcb) +hurd_activation_state_free (struct hurd_utcb *utcb) { assert (utcb->canary0 == UTCB_CANARY0); assert (utcb->canary1 == UTCB_CANARY1); @@ -902,7 +903,7 @@ hurd_activation_state_free (struct vg_utcb *utcb) in. */ addr_t pages[ACTIVATION_AREA_SIZE / PAGESIZE]; memcpy (pages, - utcb->activation_handler_sp + sizeof (uintptr_t), + (void *) utcb->vg.activation_handler_sp + sizeof (uintptr_t), sizeof (addr_t) * ACTIVATION_AREA_SIZE / PAGESIZE); int i; diff --git a/libhurd-mm/ia32-exception-entry.S b/libhurd-mm/ia32-exception-entry.S index c7f0b8c..f4212bf 100644 --- a/libhurd-mm/ia32-exception-entry.S +++ b/libhurd-mm/ia32-exception-entry.S @@ -26,7 +26,7 @@ #define UTCB_MODE (0*4) #define UTCB_SAVED_IP (1*4) #define UTCB_SAVED_SP (2*4) -#define UTCB_ACTIVATION_FRAME_STACK (3*4) +#define UTCB_ACTIVATION_FRAME_STACK (512 + 0*4) /* The bits of the mode word. */ #define ACTIVATED_MODE_BIT 0 diff --git a/libhurd-mm/madvise.c b/libhurd-mm/madvise.c index 529c2be..853226d 100644 --- a/libhurd-mm/madvise.c +++ b/libhurd-mm/madvise.c @@ -19,7 +19,7 @@ <http://www.gnu.org/licenses/>. */ #include <hurd/stddef.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/as.h> #include <hurd/storage.h> #include <hurd/anonymous.h> diff --git a/libhurd-mm/map.h b/libhurd-mm/map.h index 382a6e9..206b392 100644 --- a/libhurd-mm/map.h +++ b/libhurd-mm/map.h @@ -22,7 +22,7 @@ #define _HURD_MAP_H #include <hurd/btree.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/mutex.h> #include <hurd/as.h> #include <stdint.h> diff --git a/libhurd-mm/message-buffer.h b/libhurd-mm/message-buffer.h index 21e44b4..0c35b27 100644 --- a/libhurd-mm/message-buffer.h +++ b/libhurd-mm/message-buffer.h @@ -23,7 +23,7 @@ # include <stdint.h> # include <stdbool.h> -# include <hurd/addr.h> +# include <viengoos/addr.h> /* Forward. */ struct vg_message; diff --git a/libhurd-mm/mm-init.c b/libhurd-mm/mm-init.c index ea12898..caf362e 100644 --- a/libhurd-mm/mm-init.c +++ b/libhurd-mm/mm-init.c @@ -25,6 +25,7 @@ #include <hurd/startup.h> #include <hurd/exceptions.h> +#include <hurd/thread.h> #ifdef i386 #include <hurd/pager.h> @@ -87,7 +88,7 @@ mm_init (addr_t activity) assert (a == (void *) (fault_addr & ~(PAGESIZE - 1))); assert (count == 1); - struct vg_utcb *utcb = hurd_utcb (); + struct hurd_utcb *utcb = hurd_utcb (); struct activation_frame *activation_frame = utcb->activation_stack; debug (4, "Fault at %p (ip: %p, sp: %p, eax: %p, " "ebx: %p, ecx: %p, edx: %p, edi: %p, esi: %p, ebp: %p, " diff --git a/libhurd-mm/mm.h b/libhurd-mm/mm.h index 52b7ed8..8baace8 100644 --- a/libhurd-mm/mm.h +++ b/libhurd-mm/mm.h @@ -22,7 +22,7 @@ #ifndef HURD_MM_MM_H #define HURD_MM_MM_H -#include <hurd/addr.h> +#include <viengoos/addr.h> /* Set to one by mm_init just before returning. */ extern int mm_init_done; diff --git a/libhurd-mm/mmap.c b/libhurd-mm/mmap.c index 3535ce2..bda87cf 100644 --- a/libhurd-mm/mmap.c +++ b/libhurd-mm/mmap.c @@ -20,7 +20,7 @@ #include <hurd/stddef.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/as.h> #include <hurd/storage.h> #include <hurd/anonymous.h> diff --git a/libhurd-mm/mprotect.c b/libhurd-mm/mprotect.c index 10cf1de..e80d08c 100644 --- a/libhurd-mm/mprotect.c +++ b/libhurd-mm/mprotect.c @@ -19,7 +19,7 @@ <http://www.gnu.org/licenses/>. */ #include <hurd/stddef.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/as.h> #include <hurd/storage.h> #include <hurd/anonymous.h> diff --git a/libhurd-mm/storage.c b/libhurd-mm/storage.c index 3f774e1..8079036 100644 --- a/libhurd-mm/storage.c +++ b/libhurd-mm/storage.c @@ -23,10 +23,10 @@ #include <hurd/stddef.h> #include <hurd/btree.h> #include <hurd/slab.h> -#include <hurd/addr.h> -#include <hurd/folio.h> +#include <viengoos/addr.h> +#include <viengoos/folio.h> #include <hurd/startup.h> -#include <hurd/rm.h> +#include <viengoos/misc.h> #include <hurd/mutex.h> #include <backtrace.h> diff --git a/libhurd-mm/storage.h b/libhurd-mm/storage.h index 887f477..c7b4f66 100644 --- a/libhurd-mm/storage.h +++ b/libhurd-mm/storage.h @@ -22,8 +22,8 @@ #ifndef _HURD_STORAGE_H #define _HURD_STORAGE_H -#include <hurd/addr.h> -#include <hurd/cap.h> +#include <viengoos/addr.h> +#include <viengoos/cap.h> enum storage_expectancy { diff --git a/libpthread/ChangeLog b/libpthread/ChangeLog index cd6013f..65ba0d4 100644 --- a/libpthread/ChangeLog +++ b/libpthread/ChangeLog @@ -1,3 +1,10 @@ +2008-12-17 Neal H. Walfield <neal@gnu.org> + + * sysdeps/viengoos/bits/pthread-np.h (pthread_hurd_utcb_np): + Return a struct hurd_utcb *, not a struct vg_utcb *. + * sysdeps/viengoos/pt-sysdep.h (PTHREAD_SYSDEP_MEMBERS): Change + utcb's type to a struct hurd_utcb *. + 2008-12-11 Neal H. Walfield <neal@gnu.org> Update to new RPC interfaces, IPC semantics. diff --git a/libpthread/signal/sigwaiter.c b/libpthread/signal/sigwaiter.c index 8d041ac..adc05ca 100644 --- a/libpthread/signal/sigwaiter.c +++ b/libpthread/signal/sigwaiter.c @@ -20,7 +20,7 @@ #include "sig-internal.h" -#include <hurd/futex.h> +#include <viengoos/futex.h> struct sigwaiter *sigwaiters; diff --git a/libpthread/sysdeps/viengoos/bits/pthread-np.h b/libpthread/sysdeps/viengoos/bits/pthread-np.h index aea3bab..9986a62 100644 --- a/libpthread/sysdeps/viengoos/bits/pthread-np.h +++ b/libpthread/sysdeps/viengoos/bits/pthread-np.h @@ -24,12 +24,12 @@ #ifndef _BITS_PTHREAD_NP_H #define _BITS_PTHREAD_NP_H 1 -#include <hurd/addr.h> -#include <hurd/exceptions.h> +#include <viengoos/addr.h> +#include <hurd/thread.h> int pthread_setactivity_np (addr_t activity); /* Returns the caller's activation state block. */ -struct vg_utcb *pthread_hurd_utcb_np (void) __attribute__ ((pure)); +struct hurd_utcb *pthread_hurd_utcb_np (void) __attribute__ ((pure)); #endif /* bits/pthread-np.h */ diff --git a/libpthread/sysdeps/viengoos/ia32/pt-setup.c b/libpthread/sysdeps/viengoos/ia32/pt-setup.c index 88a60e8..bdd814a 100644 --- a/libpthread/sysdeps/viengoos/ia32/pt-setup.c +++ b/libpthread/sysdeps/viengoos/ia32/pt-setup.c @@ -20,7 +20,7 @@ #include <l4.h> #include <pt-internal.h> -#include <hurd/thread.h> +#include <viengoos/thread.h> #include <hurd/exceptions.h> /* The stack layout used on the i386 is: diff --git a/libpthread/sysdeps/viengoos/ia32/signal-dispatch-lowlevel.c b/libpthread/sysdeps/viengoos/ia32/signal-dispatch-lowlevel.c index 8dd9be7..091815b 100644 --- a/libpthread/sysdeps/viengoos/ia32/signal-dispatch-lowlevel.c +++ b/libpthread/sysdeps/viengoos/ia32/signal-dispatch-lowlevel.c @@ -21,7 +21,7 @@ #include <pt-internal.h> #include <sig-internal.h> -#include <hurd/thread.h> +#include <viengoos/thread.h> #include <pthread.h> #include <stdint.h> #include <atomic.h> diff --git a/libpthread/sysdeps/viengoos/pt-block.c b/libpthread/sysdeps/viengoos/pt-block.c index 548cc3f..8e6a17f 100644 --- a/libpthread/sysdeps/viengoos/pt-block.c +++ b/libpthread/sysdeps/viengoos/pt-block.c @@ -20,7 +20,7 @@ #include <pt-internal.h> #include <hurd/stddef.h> -#include <hurd/futex.h> +#include <viengoos/futex.h> /* Block THREAD. */ void diff --git a/libpthread/sysdeps/viengoos/pt-hurd-utcb-np.c b/libpthread/sysdeps/viengoos/pt-hurd-utcb-np.c index b3a76f4..ec08baf 100644 --- a/libpthread/sysdeps/viengoos/pt-hurd-utcb-np.c +++ b/libpthread/sysdeps/viengoos/pt-hurd-utcb-np.c @@ -19,7 +19,7 @@ #include <pt-internal.h> -struct vg_utcb * +struct hurd_utcb * pthread_hurd_utcb_np (void) { struct __pthread *thread = _pthread_self (); diff --git a/libpthread/sysdeps/viengoos/pt-setactivity-np.c b/libpthread/sysdeps/viengoos/pt-setactivity-np.c index efcc9b7..db695b9 100644 --- a/libpthread/sysdeps/viengoos/pt-setactivity-np.c +++ b/libpthread/sysdeps/viengoos/pt-setactivity-np.c @@ -19,8 +19,8 @@ #include <pt-internal.h> -#include <hurd/addr.h> -#include <hurd/thread.h> +#include <viengoos/addr.h> +#include <viengoos/thread.h> int pthread_setactivity_np (addr_t activity) diff --git a/libpthread/sysdeps/viengoos/pt-sysdep.h b/libpthread/sysdeps/viengoos/pt-sysdep.h index 0733640..15e0a03 100644 --- a/libpthread/sysdeps/viengoos/pt-sysdep.h +++ b/libpthread/sysdeps/viengoos/pt-sysdep.h @@ -36,7 +36,7 @@ #define PTHREAD_SYSDEP_MEMBERS \ addr_t object; \ vg_thread_id_t threadid; \ - struct vg_utcb *utcb; \ + struct hurd_utcb *utcb; \ struct hurd_message_buffer *lock_message_buffer; \ /* If the above fields are valid. */ \ bool have_kernel_resources; \ diff --git a/libpthread/sysdeps/viengoos/pt-thread-alloc.c b/libpthread/sysdeps/viengoos/pt-thread-alloc.c index 3cc02be..3c7df34 100644 --- a/libpthread/sysdeps/viengoos/pt-thread-alloc.c +++ b/libpthread/sysdeps/viengoos/pt-thread-alloc.c @@ -24,7 +24,7 @@ #include <hurd/startup.h> #include <hurd/storage.h> #include <hurd/as.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/message-buffer.h> #include <pt-internal.h> diff --git a/libpthread/sysdeps/viengoos/pt-thread-dealloc.c b/libpthread/sysdeps/viengoos/pt-thread-dealloc.c index 9e174a9..f7d732b 100644 --- a/libpthread/sysdeps/viengoos/pt-thread-dealloc.c +++ b/libpthread/sysdeps/viengoos/pt-thread-dealloc.c @@ -25,7 +25,7 @@ #include <hurd/exceptions.h> #include <hurd/mutex.h> #include <hurd/as.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/message-buffer.h> void diff --git a/libpthread/sysdeps/viengoos/pt-thread-halt.c b/libpthread/sysdeps/viengoos/pt-thread-halt.c index cfa861b..d721500 100644 --- a/libpthread/sysdeps/viengoos/pt-thread-halt.c +++ b/libpthread/sysdeps/viengoos/pt-thread-halt.c @@ -22,7 +22,7 @@ #include <pt-internal.h> -#include <hurd/thread.h> +#include <viengoos/thread.h> void __pthread_thread_halt (struct __pthread *thread) diff --git a/libpthread/sysdeps/viengoos/pt-thread-start.c b/libpthread/sysdeps/viengoos/pt-thread-start.c index f03f4c2..f4478ac 100644 --- a/libpthread/sysdeps/viengoos/pt-thread-start.c +++ b/libpthread/sysdeps/viengoos/pt-thread-start.c @@ -20,7 +20,7 @@ #include <assert.h> #include <errno.h> #include <string.h> -#include <hurd/thread.h> +#include <viengoos/thread.h> #include <hurd/exceptions.h> #include <pt-internal.h> diff --git a/libpthread/sysdeps/viengoos/pt-wakeup.c b/libpthread/sysdeps/viengoos/pt-wakeup.c index 60804ea..6435689 100644 --- a/libpthread/sysdeps/viengoos/pt-wakeup.c +++ b/libpthread/sysdeps/viengoos/pt-wakeup.c @@ -20,7 +20,7 @@ #include <pt-internal.h> #include <hurd/stddef.h> -#include <hurd/futex.h> +#include <viengoos/futex.h> #include <stdint.h> /* Wakeup THREAD. */ diff --git a/libviengoos/ChangeLog b/libviengoos/ChangeLog new file mode 100644 index 0000000..1e3bbc5 --- /dev/null +++ b/libviengoos/ChangeLog @@ -0,0 +1,21 @@ +2008-12-17 Neal H. Walfield <neal@gnu.org> + + * Makefile.am: New file. + * headers.m4: Likewise. + * t-addr-trans.c: Move from ../hurd. + * t-addr.c: Likewise. + * t-rpc.c: Likewise. + * viengoos.h: Likewise. + * viengoos/activity.h: Likewise. + * viengoos/addr-trans.h: Likewise. + * viengoos/addr.h: Likewise. + * viengoos/cap.h: Likewise. + * viengoos/folio.h: Likewise. + * viengoos/futex.h: Likewise. + * viengoos/ipc.h: Likewise. + * viengoos/message.h: Likewise. + * viengoos/messenger.h: Likewise. + * viengoos/rpc.h: Likewise. + * viengoos/misc.h: Moved from ../viengoos/rm.h. + * viengoos/thread.h: New file split from ../hurd/thread.h. + diff --git a/libviengoos/Makefile.am b/libviengoos/Makefile.am new file mode 100644 index 0000000..6e7b1c4 --- /dev/null +++ b/libviengoos/Makefile.am @@ -0,0 +1,40 @@ +# Makefile.am - Makefile template for libviengoos. +# Copyright (C) 2008 Free Software Foundation, Inc. +# Written by Neal H. Walfield +# +# This file is part of the GNU Hurd. +# +# The GNU Hurd is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# The GNU Hurd is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +viengoos_headers = addr.h addr-trans.h cap.h \ + thread.h folio.h activity.h futex.h messenger.h \ + message.h ipc.h \ + rpc.h \ + misc.h + +nobase_include_HEADERS = viengoos.h \ + $(addprefix viengoos/, $(viengoos_headers)) + +TESTS = t-addr t-addr-trans t-rpc +check_PROGRAMS = $(TESTS) + +t_addr_CPPFLAGS = $(CHECK_CPPFLAGS) +t_addr_SOURCES = t-addr.c + +t_addr_trans_CPPFLAGS = $(CHECK_CPPFLAGS) +t_addr_trans_SOURCES = t-addr-trans.c + +t_rpc_CPPFLAGS = $(CHECK_CPPFLAGS) +t_rpc_SOURCES = t-rpc.c diff --git a/libviengoos/headers.m4 b/libviengoos/headers.m4 new file mode 100644 index 0000000..834985f --- /dev/null +++ b/libviengoos/headers.m4 @@ -0,0 +1,28 @@ +# headers.m4 - Autoconf snippets to install links for header files. +# Copyright 2008 Free Software Foundation, Inc. +# Written by Neal H. Walfield +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +AC_CONFIG_LINKS([ + sysroot/include/viengoos.h:libviengoos/viengoos.h + sysroot/include/viengoos/addr.h:libviengoos/viengoos/addr.h + sysroot/include/viengoos/addr-trans.h:libviengoos/viengoos/addr-trans.h + sysroot/include/viengoos/cap.h:libviengoos/viengoos/cap.h + sysroot/include/viengoos/thread.h:libviengoos/viengoos/thread.h + sysroot/include/viengoos/folio.h:libviengoos/viengoos/folio.h + sysroot/include/viengoos/activity.h:libviengoos/viengoos/activity.h + sysroot/include/viengoos/futex.h:libviengoos/viengoos/futex.h + sysroot/include/viengoos/messenger.h:libviengoos/viengoos/messenger.h + sysroot/include/viengoos/message.h:libviengoos/viengoos/message.h + sysroot/include/viengoos/ipc.h:libviengoos/viengoos/ipc.h + sysroot/include/viengoos/rpc.h:libviengoos/viengoos/rpc.h + sysroot/include/viengoos/misc.h:libviengoos/viengoos/misc.h +]) + diff --git a/hurd/t-addr-trans.c b/libviengoos/t-addr-trans.c index c3607ad..c3607ad 100644 --- a/hurd/t-addr-trans.c +++ b/libviengoos/t-addr-trans.c diff --git a/hurd/t-addr.c b/libviengoos/t-addr.c index 66e69cc..1c2494d 100644 --- a/hurd/t-addr.c +++ b/libviengoos/t-addr.c @@ -20,7 +20,7 @@ #include <hurd/stddef.h> #include <hurd/types.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <assert.h> #include <l4/math.h> diff --git a/hurd/t-rpc.c b/libviengoos/t-rpc.c index b286296..0f40fe9 100644 --- a/hurd/t-rpc.c +++ b/libviengoos/t-rpc.c @@ -8,7 +8,7 @@ int output_debug = 1; #define RPC_STUB_PREFIX rpc #define RPC_ID_PREFIX RPC -#include <hurd/rpc.h> +#include <viengoos/rpc.h> /* Exception message ids. */ enum diff --git a/libviengoos/viengoos.h b/libviengoos/viengoos.h new file mode 100644 index 0000000..bc734ad --- /dev/null +++ b/libviengoos/viengoos.h @@ -0,0 +1 @@ +#include <viengoos/thread.h> diff --git a/hurd/activity.h b/libviengoos/viengoos/activity.h index dc77fc0..a180527 100644 --- a/hurd/activity.h +++ b/libviengoos/viengoos/activity.h @@ -18,12 +18,10 @@ License along with GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _HURD_ACTIVITY_H -#define _HURD_ACTIVITY_H 1 +#ifndef _VIENGOOS_ACTIVITY_H +#define _VIENGOOS_ACTIVITY_H 1 -#include <hurd/types.h> -#include <hurd/startup.h> -#include <hurd/addr.h> +#include <stdint.h> enum { @@ -170,7 +168,7 @@ struct activity_stats #define RPC_STUB_PREFIX rm #define RPC_ID_PREFIX RM -#include <hurd/rpc.h> +#include <viengoos/rpc.h> enum { diff --git a/hurd/addr-trans.h b/libviengoos/viengoos/addr-trans.h index e7695e9..de49ce7 100644 --- a/hurd/addr-trans.h +++ b/libviengoos/viengoos/addr-trans.h @@ -18,8 +18,8 @@ License along with GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _HURD_ADDR_TRANS_H -#define _HURD_ADDR_TRANS_H +#ifndef _VIENGOOS_ADDR_TRANS_H +#define _VIENGOOS_ADDR_TRANS_H #include <stdint.h> #include <hurd/stddef.h> diff --git a/hurd/addr.h b/libviengoos/viengoos/addr.h index 40092b2..badfcd9 100644 --- a/hurd/addr.h +++ b/libviengoos/viengoos/addr.h @@ -19,8 +19,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef _HURD_ADDR_H -#define _HURD_ADDR_H 1 +#ifndef _VIENGOOS_ADDR_H +#define _VIENGOOS_ADDR_H 1 #include <hurd/types.h> #include <hurd/math.h> diff --git a/hurd/cap.h b/libviengoos/viengoos/cap.h index 0dd3e82..c15d66f 100644 --- a/hurd/cap.h +++ b/libviengoos/viengoos/cap.h @@ -18,13 +18,13 @@ License along with GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _HURD_CAP_H -#define _HURD_CAP_H 1 +#ifndef _VIENGOOS_CAP_H +#define _VIENGOOS_CAP_H 1 #include <hurd/types.h> #include <hurd/stddef.h> -#include <hurd/addr.h> -#include <hurd/addr-trans.h> +#include <viengoos/addr.h> +#include <viengoos/addr-trans.h> #include <hurd/startup.h> #include <hurd/error.h> #include <stdint.h> @@ -382,7 +382,7 @@ struct cap #define RPC_STUB_PREFIX rm #define RPC_ID_PREFIX RM -#include <hurd/rpc.h> +#include <viengoos/rpc.h> enum { diff --git a/hurd/folio.h b/libviengoos/viengoos/folio.h index 9ad36c3..4172e5d 100644 --- a/hurd/folio.h +++ b/libviengoos/viengoos/folio.h @@ -18,14 +18,13 @@ License along with GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _HURD_FOLIO_H -#define _HURD_FOLIO_H 1 +#ifndef _VIENGOOS_FOLIO_H +#define _VIENGOOS_FOLIO_H 1 -#include <hurd/types.h> -#include <hurd/addr.h> -#include <hurd/cap.h> -#include <hurd/startup.h> #include <stdint.h> +#include <bit-array.h> +#include <viengoos/addr.h> +#include <viengoos/cap.h> /* Number of user objects per folio. */ enum @@ -374,7 +373,7 @@ folio_object_cap (struct folio *folio, int object) #define RPC_STUB_PREFIX rm #define RPC_ID_PREFIX RM -#include <hurd/rpc.h> +#include <viengoos/rpc.h> enum { diff --git a/hurd/futex.h b/libviengoos/viengoos/futex.h index e1e71a3..3f77b6d 100644 --- a/hurd/futex.h +++ b/libviengoos/viengoos/futex.h @@ -19,7 +19,7 @@ #ifndef _HURD_FUTEX_H #define _HURD_FUTEX_H 1 -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/startup.h> #include <hurd/error.h> #include <stdbool.h> @@ -39,7 +39,7 @@ enum #define RPC_STUB_PREFIX rm #define RPC_ID_PREFIX RM -#include <hurd/rpc.h> +#include <viengoos/rpc.h> /* Operations. */ enum diff --git a/hurd/ipc.h b/libviengoos/viengoos/ipc.h index 95588a0..67c2bad 100644 --- a/hurd/ipc.h +++ b/libviengoos/viengoos/ipc.h @@ -23,10 +23,11 @@ #include <stdint.h> #include <errno.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/stddef.h> -#include <hurd/message.h> +#include <viengoos/message.h> #include <assert.h> +#include <hurd/startup.h> #ifdef USE_L4 #include <l4.h> diff --git a/hurd/message.h b/libviengoos/viengoos/message.h index d59e41d..bff1e9a 100644 --- a/hurd/message.h +++ b/libviengoos/viengoos/message.h @@ -23,7 +23,7 @@ #include <stdint.h> #include <assert.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> #include <hurd/stddef.h> /* A message. diff --git a/hurd/messenger.h b/libviengoos/viengoos/messenger.h index 78d42f1..fbdc5ff 100644 --- a/hurd/messenger.h +++ b/libviengoos/viengoos/messenger.h @@ -22,7 +22,7 @@ #define _VIENGOOS_MESSENGER_H 1 #include <stdint.h> -#include <hurd/addr.h> +#include <viengoos/addr.h> /* A messenger references a message buffer. It can transfer a message (contained in its message buffer) to another messenger. It can @@ -74,7 +74,7 @@ enum #define RPC_STUB_PREFIX vg #define RPC_ID_PREFIX VG -#include <hurd/rpc.h> +#include <viengoos/rpc.h> /* Set MESSENGER's ID to ID and return the old ID in OLD. */ RPC(messenger_id, 1, 1, 0, diff --git a/viengoos/rm.h b/libviengoos/viengoos/misc.h index bef530e..e367c19 100644 --- a/viengoos/rm.h +++ b/libviengoos/viengoos/misc.h @@ -18,15 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef RM_RM_H -#define RM_RM_H +#ifndef _VIENGOOS_MISC_H +#define _VIENGOOS_MISC_H #include <hurd/startup.h> -#include <hurd/folio.h> +#include <viengoos/folio.h> #include <hurd/exceptions.h> -#include <hurd/thread.h> -#include <hurd/activity.h> -#include <hurd/futex.h> +#include <viengoos/thread.h> +#include <viengoos/activity.h> +#include <viengoos/futex.h> #include <l4/message.h> enum rm_method_id @@ -94,7 +94,7 @@ rm_method_id_string (int id) #define RPC_STUB_PREFIX rm #define RPC_ID_PREFIX RM -#include <hurd/rpc.h> +#include <viengoos/rpc.h> struct io_buffer { diff --git a/hurd/rpc.h b/libviengoos/viengoos/rpc.h index 55fe8be..14feddd 100644 --- a/hurd/rpc.h +++ b/libviengoos/viengoos/rpc.h @@ -45,8 +45,8 @@ #define _HURD_RPC_H #include <hurd/stddef.h> -#include <hurd/message.h> -#include <hurd/ipc.h> +#include <viengoos/message.h> +#include <viengoos/ipc.h> #include <errno.h> #ifdef RM_INTERN diff --git a/libviengoos/viengoos/thread.h b/libviengoos/viengoos/thread.h new file mode 100644 index 0000000..d8a69eb --- /dev/null +++ b/libviengoos/viengoos/thread.h @@ -0,0 +1,281 @@ +/* thread.h - Thread definitions. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Written by Neal H. Walfield <neal@gnu.org>. + + GNU Hurd is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with GNU Hurd. If not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef __have_vg_thread_id_t +# define __have_vg_thread_id_t + +# ifdef USE_L4 +# include <l4.h> +typedef l4_thread_id_t vg_thread_id_t; +# define vg_niltid l4_nilthread +# define VG_THREAD_ID_FMT "%x" +# else +# include <stdint.h> +typedef uint64_t vg_thread_id_t; +# define vg_niltid -1 +# define VG_THREAD_ID_FMT "%llx" +# endif + +#endif /* !__have_vg_thread_id_t */ + +#if defined(__need_vg_thread_id_t) +# undef __need_vg_thread_id_t +#else + +#ifndef _VIENGOOS_THREAD_H +#define _VIENGOOS_THREAD_H 1 + +#include <stdint.h> +#include <viengoos/addr.h> +#include <viengoos/cap.h> +#include <viengoos/messenger.h> + +/* The user thread control block. */ +struct vg_utcb +{ + /* Generic data. */ + struct + { + union + { + struct + { + union + { + struct + { + /* Whether the thread is in activated mode. If so, any + activations that arrive during this time will be queued + or dropped. */ + uintptr_t activated_mode : 1; + /* Set by the kernel to indicated that there is a pending + message. */ + uintptr_t pending_message : 1; + /* Set by the kernel to indicate whether the thread was + interrupted while the EIP is in the transition range. */ + uintptr_t interrupt_in_transition : 1; + }; + uintptr_t mode; + }; + + /* The value of the IP and SP when the thread was running. */ + uintptr_t saved_ip; + uintptr_t saved_sp; + + uintptr_t activation_handler_sp; + uintptr_t activation_handler_ip; + uintptr_t activation_handler_end; + + /* The protected payload of the capability that invoked the + messenger that caused this activation. */ + uint64_t protected_payload; + /* The messenger's id. */ + uint64_t messenger_id; + + uintptr_t inline_words[VG_MESSENGER_INLINE_WORDS]; + addr_t inline_caps[VG_MESSENGER_INLINE_CAPS]; + + union + { + struct + { + int inline_word_count : 2; + int inline_cap_count : 1; + }; + int inline_data : 3; + }; + }; + + char data[256]; + }; + }; + + /* Architecture-specific data. */ + struct + { + union + { + struct + { + }; + + char data[256]; + }; + }; +}; + +/* A thread object's user accessible capability slots. */ +enum + { + /* Root of the address space. */ + THREAD_ASPACE_SLOT = 0, + /* The activity the thread is bound to. */ + THREAD_ACTIVITY_SLOT = 1, + /* The messenger to post exceptions to. */ + THREAD_EXCEPTION_MESSENGER = 2, + /* The user thread control block. Must be a cap_page. */ + THREAD_UTCB = 3, + + /* Total number of capability slots in a thread object. This must + be a power of 2. */ + THREAD_SLOTS = 4, + }; +#define THREAD_SLOTS_LOG2 2 + +enum +{ + HURD_EXREGS_SET_UTCB = 0x2000, + HURD_EXREGS_SET_EXCEPTION_MESSENGER = 0x1000, + HURD_EXREGS_SET_ASPACE = 0x800, + HURD_EXREGS_SET_ACTIVITY = 0x400, + HURD_EXREGS_SET_SP = _L4_XCHG_REGS_SET_SP, + HURD_EXREGS_SET_IP = _L4_XCHG_REGS_SET_IP, + HURD_EXREGS_SET_SP_IP = _L4_XCHG_REGS_SET_SP | _L4_XCHG_REGS_SET_IP, + HURD_EXREGS_SET_EFLAGS = _L4_XCHG_REGS_SET_FLAGS, + HURD_EXREGS_SET_USER_HANDLE = _L4_XCHG_REGS_SET_USER_HANDLE, + HURD_EXREGS_SET_REGS = (HURD_EXREGS_SET_UTCB + | HURD_EXREGS_SET_EXCEPTION_MESSENGER + | HURD_EXREGS_SET_ASPACE + | HURD_EXREGS_SET_ACTIVITY + | HURD_EXREGS_SET_SP + | HURD_EXREGS_SET_IP + | HURD_EXREGS_SET_EFLAGS + | HURD_EXREGS_SET_USER_HANDLE), + + HURD_EXREGS_GET_REGS = _L4_XCHG_REGS_DELIVER, + + HURD_EXREGS_START = _L4_XCHG_REGS_SET_HALT, + HURD_EXREGS_STOP = _L4_XCHG_REGS_SET_HALT | _L4_XCHG_REGS_HALT, + + HURD_EXREGS_ABORT_SEND = _L4_XCHG_REGS_CANCEL_SEND, + HURD_EXREGS_ABORT_RECEIVE = _L4_XCHG_REGS_CANCEL_RECV, + HURD_EXREGS_ABORT_IPC = HURD_EXREGS_ABORT_SEND | _L4_XCHG_REGS_CANCEL_RECV, +}; + +enum + { + RM_thread_exregs = 600, + RM_thread_id, + RM_thread_activation_collect, + }; + +#ifdef RM_INTERN +struct thread; +typedef struct thread *thread_t; +#else +typedef addr_t thread_t; +#endif + +#define RPC_STUB_PREFIX rm +#define RPC_ID_PREFIX RM + +#include <viengoos/rpc.h> + +struct hurd_thread_exregs_in +{ + uintptr_t aspace_cap_properties_flags; + struct cap_properties aspace_cap_properties; + + uintptr_t sp; + uintptr_t ip; + uintptr_t eflags; + uintptr_t user_handle; +}; + +struct hurd_thread_exregs_out +{ + uintptr_t sp; + uintptr_t ip; + uintptr_t eflags; + uintptr_t user_handle; +}; + +/* l4_exregs wrapper. */ +RPC (thread_exregs, 6, 1, 4, + /* cap_t principal, cap_t thread, */ + uintptr_t, control, struct hurd_thread_exregs_in, in, + cap_t, aspace, cap_t, activity, cap_t, utcb, cap_t, exception_messenger, + /* Out: */ + struct hurd_thread_exregs_out, out, + cap_t, aspace_out, cap_t, activity_out, cap_t, utcb_out, + cap_t, exception_messenger_out) + +static inline error_t +thread_start (addr_t thread) +{ + struct hurd_thread_exregs_in in; + struct hurd_thread_exregs_out out; + + return rm_thread_exregs (ADDR_VOID, thread, + HURD_EXREGS_START | HURD_EXREGS_ABORT_IPC, + in, ADDR_VOID, ADDR_VOID, ADDR_VOID, ADDR_VOID, + &out, NULL, NULL, NULL, NULL); +} + +static inline error_t +thread_start_sp_ip (addr_t thread, uintptr_t sp, uintptr_t ip) +{ + struct hurd_thread_exregs_in in; + struct hurd_thread_exregs_out out; + + in.sp = sp; + in.ip = ip; + + return rm_thread_exregs (ADDR_VOID, thread, + HURD_EXREGS_START | HURD_EXREGS_ABORT_IPC + | HURD_EXREGS_SET_SP_IP, + in, ADDR_VOID, ADDR_VOID, ADDR_VOID, ADDR_VOID, + &out, NULL, NULL, NULL, NULL); +} + +static inline error_t +thread_stop (addr_t thread) +{ + struct hurd_thread_exregs_in in; + struct hurd_thread_exregs_out out; + + return rm_thread_exregs (ADDR_VOID, thread, + HURD_EXREGS_STOP | HURD_EXREGS_ABORT_IPC, + in, ADDR_VOID, ADDR_VOID, ADDR_VOID, ADDR_VOID, + &out, NULL, NULL, NULL, NULL); +} + +/* Return the unique integer associated with thread THREAD. */ +RPC(thread_id, 0, 1, 0, + /* cap_t, principal, cap_t, thread, */ + vg_thread_id_t, tid) + +/* Cause the delivery of a pending message, if any. */ +RPC(thread_activation_collect, 0, 0, 0 + /* cap_t principal, cap_t thread */) + +#undef RPC_STUB_PREFIX +#undef RPC_ID_PREFIX + +static inline vg_thread_id_t +vg_myself (void) +{ + vg_thread_id_t tid; + error_t err = rm_thread_id (ADDR_VOID, ADDR_VOID, &tid); + if (err) + return vg_niltid; + return tid; +} + +#endif /* _VIENGOOS_THREAD_H */ +#endif /* __need_vg_thread_id_t */ diff --git a/newlib/addon/newlib/libc/sys/hurd/pipefile.c b/newlib/addon/newlib/libc/sys/hurd/pipefile.c index 1d01beb..f34d1a9 100644 --- a/newlib/addon/newlib/libc/sys/hurd/pipefile.c +++ b/newlib/addon/newlib/libc/sys/hurd/pipefile.c @@ -2,7 +2,7 @@ #include <unistd.h> #include <errno.h> #include <string.h> -#include <hurd/rm.h> +#include <viengoos/misc.h> #include "fd.h" diff --git a/ruth/ruth.c b/ruth/ruth.c index 3cf48b2..656a25e 100644 --- a/ruth/ruth.c +++ b/ruth/ruth.c @@ -22,17 +22,17 @@ #include <config.h> #endif +#include <viengoos/cap.h> +#include <viengoos/folio.h> +#include <viengoos/activity.h> +#include <viengoos/futex.h> #include <hurd/thread.h> #include <hurd/startup.h> -#include <hurd/cap.h> -#include <hurd/folio.h> -#include <hurd/rm.h> +#include <viengoos/misc.h> #include <hurd/stddef.h> #include <hurd/capalloc.h> #include <hurd/as.h> #include <hurd/storage.h> -#include <hurd/activity.h> -#include <hurd/futex.h> #include <hurd/anonymous.h> #include <bit-array.h> @@ -1068,6 +1068,8 @@ main (int argc, char *argv[]) assert (! "Didn't fault!?"); } assert (faulted); + + printf ("ok.\n"); } debug (1, DEBUG_BOLD ("\n\nAll tests ran successfully to completion!\n\n")); diff --git a/viengoos/ChangeLog b/viengoos/ChangeLog index a2e5496..ea0d57a 100644 --- a/viengoos/ChangeLog +++ b/viengoos/ChangeLog @@ -1,3 +1,10 @@ +2008-12-17 Neal H. Walfield <neal@gnu.org> + + * rm.h: Move from here... + * ../libviengoos/viengoos/misc.h: ... to here. Update users. + * headers.m4: Don't link rm.h to hurd/rm.h. + * Makefile.am (viengoos_SOURCES): Remove rm.h. + 2008-12-16 Neal H. Walfield <neal@gnu.org> * thread.c (thread_activate): Don't update diff --git a/viengoos/Makefile.am b/viengoos/Makefile.am index c3d37df..d132605 100644 --- a/viengoos/Makefile.am +++ b/viengoos/Makefile.am @@ -41,7 +41,6 @@ viengoos_SOURCES = $(ARCH_SOURCES) \ panic.c \ sigma0.h sigma0.c \ zalloc.h zalloc.c \ - rm.h \ viengoos.h viengoos.c \ boot-modules.h boot-modules.c \ memory.h memory.c \ diff --git a/viengoos/activity.c b/viengoos/activity.c index acd8645..220b362 100644 --- a/viengoos/activity.c +++ b/viengoos/activity.c @@ -20,7 +20,7 @@ #include <errno.h> #include <assert.h> -#include <hurd/cap.h> +#include <viengoos/cap.h> #include "activity.h" #include "thread.h" diff --git a/viengoos/activity.h b/viengoos/activity.h index 983395a..745486f 100644 --- a/viengoos/activity.h +++ b/viengoos/activity.h @@ -21,7 +21,7 @@ #ifndef RM_ACTIVITY_H #define RM_ACTIVITY_H -#include <hurd/activity.h> +#include <viengoos/activity.h> #include "cap.h" #include "object.h" diff --git a/viengoos/cap.c b/viengoos/cap.c index 2a9ae66..b765ae3 100644 --- a/viengoos/cap.c +++ b/viengoos/cap.c @@ -20,7 +20,7 @@ #include <assert.h> #include <hurd/stddef.h> -#include <hurd/messenger.h> +#include <viengoos/messenger.h> #include "cap.h" #include "object.h" diff --git a/viengoos/cap.h b/viengoos/cap.h index deb8c59..609e4a1 100644 --- a/viengoos/cap.h +++ b/viengoos/cap.h @@ -22,7 +22,7 @@ #define RM_CAP_H #include <l4.h> -#include <hurd/cap.h> +#include <viengoos/cap.h> /* The number of slots in a capability object of the given type. */ extern const int cap_type_num_slots[]; diff --git a/viengoos/headers.m4 b/viengoos/headers.m4 index 091ed24..ba32755 100644 --- a/viengoos/headers.m4 +++ b/viengoos/headers.m4 @@ -1,5 +1,5 @@ # headers.m4 - Autoconf snippets to install links for header files. -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007, 2008 Free Software Foundation, Inc. # Written by Neal H. Walfield <neal@gnu.org>. # # This file is free software; as a special exception the author gives @@ -10,7 +10,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -AC_CONFIG_LINKS([sysroot/include/hurd/rm.h:viengoos/rm.h]) +# AC_CONFIG_LINKS([]) AC_CONFIG_COMMANDS_POST([ mkdir -p sysroot/lib viengoos && diff --git a/viengoos/messenger.c b/viengoos/messenger.c index fbcd58f..4e109a2 100644 --- a/viengoos/messenger.c +++ b/viengoos/messenger.c @@ -21,7 +21,7 @@ #include <stdbool.h> #include <errno.h> #include <assert.h> -#include <hurd/cap.h> +#include <viengoos/cap.h> #include <hurd/as.h> #include "messenger.h" diff --git a/viengoos/messenger.h b/viengoos/messenger.h index abbf8ff..2ab669c 100644 --- a/viengoos/messenger.h +++ b/viengoos/messenger.h @@ -24,9 +24,9 @@ #include <stdint.h> #include <string.h> #include <assert.h> -#include <hurd/cap.h> -#include <hurd/messenger.h> -#include <hurd/message.h> +#include <viengoos/cap.h> +#include <viengoos/messenger.h> +#include <viengoos/message.h> #ifndef NDEBUG #include "../viengoos/list.h" diff --git a/viengoos/object.c b/viengoos/object.c index c91ff45..5d11edd 100644 --- a/viengoos/object.c +++ b/viengoos/object.c @@ -22,9 +22,9 @@ #include <string.h> #include <hurd/stddef.h> #include <hurd/ihash.h> -#include <hurd/folio.h> -#include <hurd/thread.h> -#include <hurd/messenger.h> +#include <viengoos/folio.h> +#include <viengoos/thread.h> +#include <viengoos/messenger.h> #include <bit-array.h> #include <assert.h> diff --git a/viengoos/object.h b/viengoos/object.h index 47f36b2..e8855f0 100644 --- a/viengoos/object.h +++ b/viengoos/object.h @@ -25,8 +25,8 @@ #include <hurd/error.h> #include <string.h> #include <assert.h> -#include <hurd/cap.h> -#include <hurd/folio.h> +#include <viengoos/cap.h> +#include <viengoos/folio.h> #include <hurd/btree.h> #include <stdint.h> diff --git a/viengoos/server.c b/viengoos/server.c index 9a46efa..764ba25 100644 --- a/viengoos/server.c +++ b/viengoos/server.c @@ -20,15 +20,15 @@ #include <l4.h> #include <l4/pagefault.h> -#include <hurd/cap.h> +#include <viengoos/cap.h> #include <hurd/stddef.h> #include <hurd/exceptions.h> -#include <hurd/thread.h> -#include <hurd/activity.h> -#include <hurd/futex.h> +#include <viengoos/thread.h> +#include <viengoos/activity.h> +#include <viengoos/futex.h> #include <hurd/trace.h> #include <hurd/as.h> -#include <hurd/ipc.h> +#include <viengoos/ipc.h> #include "server.h" diff --git a/viengoos/thread.c b/viengoos/thread.c index 19fca5b..ec8080f 100644 --- a/viengoos/thread.c +++ b/viengoos/thread.c @@ -21,10 +21,10 @@ #include <l4.h> #include <l4/thread-start.h> #include <hurd/ihash.h> -#include <hurd/cap.h> +#include <viengoos/cap.h> #include <hurd/stddef.h> #include <hurd/exceptions.h> -#include <hurd/thread.h> +#include <viengoos/thread.h> #include <bit-array.h> #include <backtrace.h> diff --git a/viengoos/thread.h b/viengoos/thread.h index 3bcb91d..f869d0b 100644 --- a/viengoos/thread.h +++ b/viengoos/thread.h @@ -23,8 +23,8 @@ #include <l4.h> #include <errno.h> -#include <hurd/cap.h> -#include <hurd/thread.h> +#include <viengoos/cap.h> +#include <viengoos/thread.h> /* Forward. */ struct activity; diff --git a/viengoos/viengoos.c b/viengoos/viengoos.c index 8730f64..ccab7a5 100644 --- a/viengoos/viengoos.c +++ b/viengoos/viengoos.c @@ -39,7 +39,7 @@ int ss_lock_trace_count; #include <hurd/startup.h> #include <hurd/stddef.h> -#include <hurd/thread.h> +#include <viengoos/thread.h> #include <hurd/as.h> #include <process-spawn.h> |