summaryrefslogtreecommitdiff
path: root/viengoos/thread.h
diff options
context:
space:
mode:
authorneal <neal>2007-11-22 16:56:14 +0000
committerneal <neal>2007-11-22 16:56:14 +0000
commit236dd43f48b4a9e3c61e55eaa753c0baf98ecb73 (patch)
tree7cc8c8f6db688a14bce76aa7bd9172861f518acb /viengoos/thread.h
parenteb992fd769149136bc13ed915bf83bb892563f26 (diff)
viengoos/
2007-11-22 Neal H. Walfield <neal@gnu.org> * thread.h (struct thread): Add fields efalgs, user_handle and init. (thread_create_in): Rename from this... (thread_init): ... to this. Remove the activity argument. Update all users. (thread_create): Remove declaration. (thread_destroy): Rename from this... (thread_deinit): ... to this. Update all users. (thread_send_sp_ip): Remove declaration. (thread_exregs): New declaration. * thread.c: Include <hurd/thread.h>. (thread_lookup): Add additional asserts. (thread_create_in): Rename from this... (thread_init): ... to this. Remove the activity argument. Don't set THREAD->ACTIVITY. Set THREAD->INIT to true. (thread_create): Remove function. (thread_destroy): Rename from this... (thread_deinit): ... to this. Correctly calculate the bit to deallocate. Fix assert. Set THREAD->INIT to false. (thread_commission): If THREAD->INIT is false, first call thread_init. Correctly calculate the thread ids to initialize. (thread_send_sp_ip): Remove function. (thread_exregs): New function. * rm.h (RPC_STUB_PREFIX): Include <hurd/thread.h>. (rm_method_id_string): Support RM_thread_exregs. (THREAD_ASPACE_SLOT, THREAD_ACTIVITY_SLOT): Move from... * ../hurd/thread.h: ... to this new file. * server.c: Include <hurd/thread.h>. (server_loop): Implement the thread_exregs RPC. * viengoos.c (system_task_load): Set THREAD->ACTIVITY to a capability designating ROOT_ACTIVITY. hurd/ 2007-11-22 Neal H. Walfield <neal@gnu.org> * Makefile.am (includehurd_HEADERS): Add thread.h. * headers.m4: Link $(BUILDIR)/include/hurd/thread.h to thread.h. * thread.h: New file. * rpc.h: Include <errno.h>. ruth/ 2007-11-22 Neal H. Walfield <neal@gnu.org> * ruth.c: Include <hurd/thread.h>. (main): Add test case for thread creation.
Diffstat (limited to 'viengoos/thread.h')
-rw-r--r--viengoos/thread.h45
1 files changed, 19 insertions, 26 deletions
diff --git a/viengoos/thread.h b/viengoos/thread.h
index fe31403..4ccdd93 100644
--- a/viengoos/thread.h
+++ b/viengoos/thread.h
@@ -52,9 +52,13 @@ struct thread
/* XXX: Register state, blah, blah, blah. */
l4_word_t sp;
l4_word_t ip;
+ l4_word_t eflags;
+ l4_word_t user_handle;
- /* Debugging: whether the thread has been commissioned. */
- int commissioned;
+ /* Whether the thread data structure has been initialized. */
+ l4_word_t init : 1;
+ /* Whether the thread has been commissioned (a tid allocated). */
+ l4_word_t commissioned : 1;
bool have_exception;
/* 64 words (256/512 bytes). */
@@ -70,25 +74,11 @@ struct thread
/* Create a new thread. Uses the object THREAD to store the thread
information. */
-extern void thread_create_in (struct activity *activity,
- struct thread *thread);
-
-/* Create a new thread. FOLIO designates a folio in CALLER's CSPACE.
- INDEX specifies which object in the folio to use for the new
- thread's storage. Sets the thread's current activity to ACTIVITY.
- On success, a capability to this object is saved in the capability
- slot at address THREAD in CALLER's address space, the thread object
- is returned in *THREADP and 0 is returned. Otherwise, an error
- code. */
-extern error_t thread_create (struct activity *activity,
- struct thread *caller,
- addr_t folio, l4_word_t index,
- addr_t thread,
- struct thread **threadp);
+extern void thread_init (struct thread *thread);
/* Destroy the thread object THREAD (and the accompanying thread). */
-extern void thread_destroy (struct activity *activity,
- struct thread *thread);
+extern void thread_deinit (struct activity *activity,
+ struct thread *thread);
/* Prepare the thread object THREAD to run. (Called after bringing a
thread object into core.) */
@@ -99,13 +89,16 @@ extern void thread_commission (struct thread *thread);
store.) */
extern void thread_decommission (struct thread *thread);
-/* Send a thread start message to the thread THREAD (in CALLER's
- address space). This may be called at most once per thread. If
- called multiple times, the results are undefined. If thread is not
- decommissioned, returns EINVAL. Commissions thread. */
-extern error_t thread_send_sp_ip (struct activity *activity,
- struct thread *caller, addr_t thread,
- l4_word_t sp, l4_word_t ip);
+/* Perform an exregs on thread THREAD. CONTROL, SP, IP, EFLAGS and
+ USER_HANDLER are as per l4_exchange_regs, however, the caller may
+ not set the pager. */
+extern error_t thread_exregs (struct activity *principal,
+ struct thread *thread, l4_word_t control,
+ struct cap *aspace, struct cap *activity,
+ l4_word_t *sp, l4_word_t *ip,
+ l4_word_t *eflags, l4_word_t *user_handle,
+ struct cap *aspace_out,
+ struct cap *activity_out);
/* Given the L4 thread id THREADID, find the associated thread. */
extern struct thread *thread_lookup (l4_thread_id_t threadid);