diff options
author | marcus <marcus> | 2004-11-02 00:19:13 +0000 |
---|---|---|
committer | marcus <marcus> | 2004-11-02 00:19:13 +0000 |
commit | 4ca71c0e0360e4c16e4813880278e3b5151ba4be (patch) | |
tree | 6555328ecad3d5db01be49c421d75c550a6ce095 /deva/task-user.c | |
parent | bc3f1d92f35fdbf42edbdf73a20c15d0cd229a9b (diff) |
2004-11-02 Marcus Brinkmann <marcus@gnu.org>
* Makefile.am (deva_SOURCES): Add task-user.h and task-user.c.
* task-user.h, task-user.c: New files.
* deva.c: Include "task-user.h".
(create_bootstrap_caps): Remove variable startup_cap.
(setup_threads): Implement it.
Diffstat (limited to 'deva/task-user.c')
-rw-r--r-- | deva/task-user.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/deva/task-user.c b/deva/task-user.c new file mode 100644 index 0000000..3541893 --- /dev/null +++ b/deva/task-user.c @@ -0,0 +1,61 @@ +/* task-user.c - User stubs for task RPCs. + Copyright (C) 2004 Free Software Foundation, Inc. + Written by Marcus Brinkmann. + + 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. */ + +#if HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdint.h> + +#include <l4.h> + +#include "task-user.h" + +#define HURD_L4_ERROR_LABEL ((uint16_t) INT16_MIN) + + +/* Allocate a new thread for the task TASK, and return its thread ID + in THREAD_ID. */ +error_t +task_thread_alloc (l4_thread_id_t task_server, hurd_cap_id_t task, + void *utcb, l4_thread_id_t *thread_id) +{ + l4_msg_t msg; + l4_msg_tag_t tag; + + l4_accept (L4_UNTYPED_WORDS_ACCEPTOR); + + l4_msg_clear (msg); + l4_set_msg_label (msg, 512 /* TASK_THREAD_ALLOC */); + l4_msg_append_word (msg, task); + l4_msg_append_word (msg, (l4_word_t) utcb); + l4_msg_load (msg); + tag = l4_call (task_server); + + l4_msg_store (tag, msg); + + if (l4_msg_label (msg) == HURD_L4_ERROR_LABEL) + return l4_msg_word (msg, 0); + + *thread_id = l4_msg_word (msg, 0); + + return 0; +} |