diff options
author | Alexis211 <alexis211@gmail.com> | 2010-04-05 16:56:17 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2010-04-05 16:56:17 +0200 |
commit | 8d94ae49601e0e4023bcdc35191669b2c24f6c96 (patch) | |
tree | 64d625ee6aa5a897666be2768d009b2353ba97d9 /src/kernel | |
parent | b945eafa126d6a17aa8826a405df7d5d4d999008 (diff) | |
download | TCE-8d94ae49601e0e4023bcdc35191669b2c24f6c96.tar.gz TCE-8d94ae49601e0e4023bcdc35191669b2c24f6c96.zip |
More work on IPC.
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/ipc/request.c | 2 | ||||
-rw-r--r-- | src/kernel/ipc/request.h | 2 | ||||
-rw-r--r-- | src/kernel/task/task.c | 12 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/kernel/ipc/request.c b/src/kernel/ipc/request.c index 4e8b407..9ca724e 100644 --- a/src/kernel/ipc/request.c +++ b/src/kernel/ipc/request.c @@ -26,6 +26,7 @@ int request_get(int id, uint32_t ptr, int wait) { else p->shmsize[i] = 0; } p->isBlocking = (obj->request->requester != 0); + p->pid = obj->request->pid; //if request is nonblocking and no shm is to be mapped, delete request and unlock objects busymutex, else set it to acknowledged if (p->isBlocking) return 0; for (i = 0; i < 3; i++) { @@ -149,6 +150,7 @@ static struct request *mkrequest(int id, struct thread *requester, rq->func = func; for (i = 0; i < 3; i++) { rq->params[i] = 0; rq->obj_close[i] = 0; rq->shm_sndr[i] = 0; rq->shm_rcv[i] = 0; } rq->acknowledged = RS_PENDING; + rq->pid = current_thread->process->pid; // integers: use as is // objects: open a new descriptor in receiver process (if same process, keep number), put that number as an int // if receiver already had descriptor to this object, use it and set obj_close to 0, else set obj_close to new number diff --git a/src/kernel/ipc/request.h b/src/kernel/ipc/request.h index b08264f..18eaf84 100644 --- a/src/kernel/ipc/request.h +++ b/src/kernel/ipc/request.h @@ -25,11 +25,13 @@ struct request { uint32_t n; } answer; int errcode; //returned when function has finished + int pid; //pid of caller }; struct user_request { uint32_t func, params[3], shmsize[3]; int isBlocking; // 1 : blocking request, 0 : nonblocking request (message) + int pid; //pid of caller process }; struct user_sendrequest { diff --git a/src/kernel/task/task.c b/src/kernel/task/task.c index 9221813..f10ec6f 100644 --- a/src/kernel/task/task.c +++ b/src/kernel/task/task.c @@ -9,6 +9,8 @@ #define KSTACKSIZE 0x8000 +static struct object *manager_object = 0; + //Static routines for handling threads exiting and all cleanup static void thread_exit_stackJmp(uint32_t reason); static void thread_exit2(uint32_t reason); @@ -109,6 +111,7 @@ uint32_t tasking_handleException(struct registers *regs) { "Page Fault","Unknown Interrupt","Coprocessor Fault","Alignment Check","Machine Check"}; monitor_write(exception_messages[regs->int_no]); monitor_write(" at "); monitor_writeHex(regs->eip); + PANIC("kk"); if (regs->int_no == 14) { monitor_write("\n>>> Process exiting.\n"); thread_exit_stackJmp(EX_PR_EXCEPTION); @@ -283,7 +286,10 @@ struct process *process_new(struct process* parent, uint32_t uid, uint32_t privi p->next_objdesc = 0; p->objects = 0; - obj_createP(p); //create process' root object and add descriptor 0 to it + struct object* o = obj_new(p); + if (manager_object == 0) manager_object = o; + objdesc_add(p, o); //create process' root object and add descriptor 0 to it + objdesc_add(p, manager_object); processes = p; return p; @@ -307,8 +313,8 @@ static void process_delete(struct process *pr) { struct thread *it; while (threads != 0 && threads->process == pr) thread_delete(threads); it = threads; - while (it != 0) { - while (it->next->process == pr) thread_delete(it->next); + while (it != 0 && it->next != 0) { + while (it->next != 0 && it->next->process == pr) thread_delete(it->next); it = it->next; } obj_closeall(pr); |