summaryrefslogtreecommitdiff
path: root/hurd/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 /hurd/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 'hurd/thread.h')
-rw-r--r--hurd/thread.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/hurd/thread.h b/hurd/thread.h
new file mode 100644
index 0000000..bc1fb38
--- /dev/null
+++ b/hurd/thread.h
@@ -0,0 +1,91 @@
+/* thread.h - Thread definitions.
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Written by Neal H. Walfield <neal@gnu.org>.
+
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _HURD_THREAD_H
+#define _HURD_THREAD_H 1
+
+#include <hurd/types.h>
+#include <hurd/startup.h>
+#include <l4/syscall.h>
+
+enum
+ {
+ RM_thread_exregs = 600,
+ };
+
+enum
+ {
+ THREAD_ASPACE_SLOT = 0,
+ THREAD_ACTIVITY_SLOT = 1,
+ };
+
+enum
+{
+ 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_ASPACE
+ | HURD_EXREGS_SET_ACTIVITY
+ | HURD_EXREGS_SET_SP
+ | HURD_EXREGS_SET_IP
+ | HURD_EXREGS_SET_SP_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,
+};
+
+#define RPC_STUB_PREFIX rm
+#define RPC_ID_PREFIX RM
+#undef RPC_TARGET_NEED_ARG
+#define RPC_TARGET \
+ ({ \
+ extern struct hurd_startup_data *__hurd_startup_data; \
+ __hurd_startup_data->rm; \
+ })
+
+#include <hurd/rpc.h>
+
+/* l4_exregs wrapper. */
+RPC11_4 (thread_exregs, addr_t, principal, addr_t, thread,
+ l4_word_t, control, addr_t, aspace, addr_t, activity,
+ l4_word_t, sp, l4_word_t, ip, l4_word_t, eflags,
+ l4_word_t, user_handler,
+ addr_t, aspace_out, addr_t, activity_out,
+ l4_word_t *, sp_out, l4_word_t *, ip_out, l4_word_t *, eflags_out,
+ l4_word_t *, user_handler_out)
+
+#undef RPC_STUB_PREFIX
+#undef RPC_ID_PREFIX
+#undef RPC_TARGET
+
+#endif