diff --git a/alloc.ccp b/alloc.ccp index 8a6b21f..90f1acb 100644 --- a/alloc.ccp +++ b/alloc.ccp @@ -189,6 +189,7 @@ Thread *Memory::alloc_thread (unsigned size): ret->flags = 0 ret->schedule_prev = NULL ret->schedule_next = NULL + ret->slots = size for unsigned i = 0; i < size; ++i: ret->caps[i] = NULL return ret diff --git a/boot-programs/init.ccp b/boot-programs/init.ccp index fa1d7f1..f518666 100644 --- a/boot-programs/init.ccp +++ b/boot-programs/init.ccp @@ -61,7 +61,7 @@ char const *decode_kbd = "0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*() T\n[],. int main (): // Set up lcd first - //schedule () + schedule () kdebug ("start init\n") setup () kdebug ("run init\n") diff --git a/boot-programs/lcd.ccp b/boot-programs/lcd.ccp index 7410463..dd7914b 100644 --- a/boot-programs/lcd.ccp +++ b/boot-programs/lcd.ccp @@ -128,10 +128,6 @@ int main (): unsigned pages = (frame_size + ~PAGE_MASK) >> PAGE_BITS unsigned physical = alloc_range (__my_memory, pages) assert (physical) - //Capability cappage[2] - //unsigned base[2] - //cappage[0] = memory_create_cappage (__my_memory, &base[0]) - //cappage[1] = memory_create_cappage (__my_memory, &base[1]) for unsigned i = 0; i < pages; ++i: memory_create_page (6, __my_memory) alloc_physical (6, physical + i * PAGE_SIZE, 0, 1) @@ -168,7 +164,7 @@ int main (): invoke_11 (__my_parent, cap_copy (6), INIT_SET_LCD) receiver_create_capability (15, __my_receiver, LCD_LOG) - __asm__ volatile ("li $a0, 1\nlw $a1, 15\nbreak" ::: "a0", "a1", "memory") + __asm__ volatile ("li $a0, 1\nli $a1, 15\nbreak" ::: "a0", "a1", "memory") while true: Message msg diff --git a/invoke.ccp b/invoke.ccp index 8869b2d..fb23b23 100644 --- a/invoke.ccp +++ b/invoke.ccp @@ -50,8 +50,9 @@ CapRef Thread::find_capability (unsigned code, bool *copy): unsigned c = code & ~CAPABILITY_COPY unsigned slot = c >> 16 unsigned num = c & 0xffff - if slot >= slots || !caps[slot] || num >= caps[slot]->size || !caps[slot]->caps[num].target: + if slot >= slots || !caps[slot] || num >= caps[slot]->size: if c != CAPABILITY_NONE: + panic (code, "debug") dbg_log_num ((unsigned)old_current) dbg_log (": invalid capability ") dbg_log_num (code) diff --git a/iris.h b/iris.h index d3277c3..bd8233c 100644 --- a/iris.h +++ b/iris.h @@ -234,10 +234,10 @@ static void call (Capability target, Message *msg, Capability r0, Capability r1, Capability t = cap_copy (target); __asm__ volatile ("lw $v0, %0\n" "\tlw $v1, %1\n" - "\tlw $t4, %1\n" - "\tlw $t5, %2\n" - "\tlw $t6, %3\n" - "\tlw $t7, %4\n" + "\tlw $t4, %2\n" + "\tlw $t5, %3\n" + "\tlw $t6, %4\n" + "\tlw $t7, %5\n" "\tlw $t0, 0($v1)\n" "\tlw $t1, 4($v1)\n" "\tlw $t2, 8($v1)\n" @@ -265,10 +265,10 @@ static void invoke_00 (Capability t) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[0] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[0] = CAPABILITY_NONE; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -279,10 +279,10 @@ static void invoke_01 (Capability t, unsigned d) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[0] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[0] = CAPABILITY_NONE; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -293,10 +293,10 @@ static void invoke_02 (Capability t, unsigned d0, unsigned d1) msg.data[1] = d1; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[0] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[0] = CAPABILITY_NONE; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -307,10 +307,10 @@ static void invoke_03 (Capability t, unsigned d0, unsigned d1, unsigned d2) msg.data[1] = d1; msg.data[2] = d2; msg.data[3] = 0; - msg.cap[0] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[0] = CAPABILITY_NONE; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -321,10 +321,10 @@ static void invoke_04 (Capability t, unsigned d0, unsigned d1, unsigned d2, unsi msg.data[1] = d1; msg.data[2] = d2; msg.data[3] = d3; - msg.cap[0] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[0] = CAPABILITY_NONE; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -336,9 +336,9 @@ static void invoke_10 (Capability t, Capability c) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -350,9 +350,9 @@ static void invoke_11 (Capability t, Capability c, unsigned d) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -364,9 +364,9 @@ static void invoke_12 (Capability t, Capability c, unsigned d0, unsigned d1) msg.data[1] = d1; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -378,9 +378,9 @@ static void invoke_13 (Capability t, Capability c, unsigned d0, unsigned d1, uns msg.data[1] = d1; msg.data[2] = d2; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -392,9 +392,9 @@ static void invoke_14 (Capability t, Capability c, unsigned d0, unsigned d1, uns msg.data[1] = d1; msg.data[2] = d2; msg.data[3] = d3; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -407,8 +407,8 @@ static void invoke_20 (Capability t, Capability c0, Capability c1) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -421,8 +421,8 @@ static void invoke_21 (Capability t, Capability c0, Capability c1, unsigned d) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -436,7 +436,7 @@ static void invoke_31 (Capability t, Capability c0, Capability c1, Capability c2 msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[3] = 0; + msg.cap[3] = CAPABILITY_NONE; invoke (t, &msg); } @@ -462,9 +462,9 @@ static void call_00 (Capability c) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); } @@ -476,9 +476,9 @@ static unsigned call_n00 (Capability c) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return msg.data[0]; } @@ -491,9 +491,9 @@ static void call_c00 (Capability c, Capability target) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, target, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); } @@ -505,9 +505,9 @@ static void call_c01 (Capability c, Capability target, unsigned d) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, target, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); } @@ -519,9 +519,9 @@ static unsigned long long call_l01 (Capability c, unsigned d) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return (unsigned long long)msg.data[0] | ((unsigned long long)msg.data[1] << 32); } @@ -534,9 +534,9 @@ static void call_c02 (Capability c, Capability target, unsigned d0, unsigned d1) msg.data[1] = d1; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, target, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); } @@ -548,9 +548,9 @@ static unsigned long long call_l02 (Capability c, unsigned d0, unsigned d1) msg.data[1] = d1; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return (unsigned long long)msg.data[0] | ((unsigned long long)msg.data[1] << 32); } @@ -563,9 +563,9 @@ static void call_c03 (Capability c, Capability target, unsigned d0, unsigned d1, msg.data[1] = d1; msg.data[2] = d2; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, target, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); } @@ -577,9 +577,9 @@ static unsigned long long call_l04 (Capability c, unsigned d0, unsigned d1, unsi msg.data[1] = d1; msg.data[2] = d2; msg.data[3] = d3; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return (unsigned long long)msg.data[0] | ((unsigned long long)msg.data[1] << 32); } @@ -593,8 +593,8 @@ static void call_c12 (Capability c, Capability target, Capability c1, unsigned d msg.data[1] = d1; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, target, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); } @@ -607,8 +607,8 @@ static void call_c13 (Capability c, Capability target, Capability c1, unsigned d msg.data[1] = d1; msg.data[2] = d2; msg.data[3] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, target, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); } @@ -620,9 +620,9 @@ static unsigned call_n01 (Capability c, unsigned d) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return msg.data[0]; } @@ -636,8 +636,8 @@ static unsigned call_n11 (Capability c, Capability c1, unsigned d) msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return msg.data[0]; } @@ -651,8 +651,8 @@ static unsigned call_n12 (Capability c, Capability c1, unsigned d0, unsigned d1) msg.data[1] = d1; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return msg.data[0]; } @@ -666,8 +666,8 @@ static unsigned call_n14 (Capability c, Capability c1, unsigned d0, unsigned d1, msg.data[1] = d1; msg.data[2] = d2; msg.data[3] = d3; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return msg.data[0]; } @@ -680,9 +680,9 @@ static unsigned call_n02 (Capability c, unsigned d0, unsigned d1) msg.data[1] = d1; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return msg.data[0]; } @@ -695,9 +695,9 @@ static Capability call_p02 (Capability c, unsigned d0, unsigned d1, unsigned *ba msg.data[1] = d1; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); *base_return = msg.data[0]; return msg.cap[0]; @@ -711,9 +711,9 @@ static unsigned call_n03 (Capability c, unsigned d0, unsigned d1, unsigned d2) msg.data[1] = d1; msg.data[2] = d2; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return msg.data[0]; } @@ -727,9 +727,9 @@ static unsigned call_n04 (Capability c, unsigned d0, unsigned d1, unsigned d2, u msg.data[2] = d2; msg.data[3] = d3; msg.data[3] = 0; - msg.cap[1] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[1] = CAPABILITY_NONE; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return msg.data[0]; } @@ -743,8 +743,8 @@ static void call_c11 (Capability target, Capability c, Capability c1, unsigned d msg.data[1] = 0; msg.data[2] = 0; msg.data[3] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, target, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); } @@ -757,8 +757,8 @@ static unsigned call_n13 (Capability c, Capability c1, unsigned d0, unsigned d1, msg.data[1] = d1; msg.data[2] = d2; msg.data[3] = 0; - msg.cap[2] = 0; - msg.cap[3] = 0; + msg.cap[2] = CAPABILITY_NONE; + msg.cap[3] = CAPABILITY_NONE; call (__my_call, &msg, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE, CAPABILITY_NONE); return msg.data[0]; } @@ -879,7 +879,7 @@ static void receiver_create_async_call_capability (Capability target, Capability return call_c02 (receiver, target, CAP_RECEIVER_CREATE_CALL_CAPABILITY, 1); } -static void memory_create (Capability target, Capability memory, unsigned type) +static void memory_create (Capability memory, Capability target, unsigned type) { return call_c02 (memory, target, CAP_MEMORY_CREATE, type); } @@ -998,7 +998,7 @@ static void caps_set (Capability caps, Capability cap, unsigned index) invoke_12 (caps, cap, CAP_CAPS_SET, index); } -#if 0 +#if 1 /* Use a define instead of an inline function, because this is better visible in disassembly, even when not optimizing. */ #define kdebug_char(c) do { unsigned d = (c); __asm__ volatile ("move $a0, $zero\nlw $a1, %0\nbreak" :: "m"(d) : "a0", "a1", "memory"); } while (0) #else diff --git a/mips/Makefile.arch b/mips/Makefile.arch index e76fc7f..ebf09bc 100644 --- a/mips/Makefile.arch +++ b/mips/Makefile.arch @@ -17,7 +17,7 @@ load = 0x80000000 -ARCH_CXXFLAGS = -DNUM_THREADS=2 +ARCH_CXXFLAGS = -DNUM_THREADS=3 ARCH_CPPFLAGS = -Imips -Wa,-mips32 CROSS = mipsel-linux-gnu- OBJDUMP = $(CROSS)objdump diff --git a/mips/interrupts.ccp b/mips/interrupts.ccp index 505de59..c1beedd 100644 --- a/mips/interrupts.ccp +++ b/mips/interrupts.ccp @@ -137,24 +137,26 @@ static void arch_invoke (): c3 = old_current->find_capability (old_current->arch.t7, &dummy) old_current->wait (c0, c1, c2, c3) if !target: + if (old_current->arch.v0 & ~CAPABILITY_COPY) != ~CAPABILITY_COPY: + panic (old_current->arch.v0, "debug") // There must be no action here. - else: - Capability::Context c - c.cap[0] = old_current->find_capability (old_current->arch.a0, &c.copy[0]) - c.cap[1] = old_current->find_capability (old_current->arch.a1, &c.copy[1]) - c.cap[2] = old_current->find_capability (old_current->arch.a2, &c.copy[2]) - c.cap[3] = old_current->find_capability (old_current->arch.a3, &c.copy[3]) - c.data[0] = old_current->arch.t0 - c.data[1] = old_current->arch.t1 - c.data[2] = old_current->arch.t2 - c.data[3] = old_current->arch.t3 - target->invoke (&c) - if do_schedule && !wait: - // If the call was to schedule without wait, it isn't done yet. - schedule () - else if old_current != current && (old_current->flags & (THREAD_FLAG_RUNNING | THREAD_FLAG_WAITING)) == THREAD_FLAG_RUNNING: - // If the caller received an immediate reply from the kernel, it is no longer set as current. Don't let it lose its timeslice. - current = old_current + return + Capability::Context c + c.cap[0] = old_current->find_capability (old_current->arch.a0, &c.copy[0]) + c.cap[1] = old_current->find_capability (old_current->arch.a1, &c.copy[1]) + c.cap[2] = old_current->find_capability (old_current->arch.a2, &c.copy[2]) + c.cap[3] = old_current->find_capability (old_current->arch.a3, &c.copy[3]) + c.data[0] = old_current->arch.t0 + c.data[1] = old_current->arch.t1 + c.data[2] = old_current->arch.t2 + c.data[3] = old_current->arch.t3 + target->invoke (&c) + if do_schedule && !wait: + // If the call was to schedule without wait, it isn't done yet. + schedule () + else if old_current != current && (old_current->flags & (THREAD_FLAG_RUNNING | THREAD_FLAG_WAITING)) == THREAD_FLAG_RUNNING: + // If the caller received an immediate reply from the kernel, it is no longer set as current. Don't let it lose its timeslice. + current = old_current /// A general exception has occurred. Thread *exception (): @@ -211,7 +213,7 @@ Thread *exception (): break case 9: // Breakpoint. - #if 1 + #if 0 current->raise (ERR_BREAKPOINT, 0) #else current->pc += 4 diff --git a/plan b/plan index c4b06cb..58e3c5f 100644 --- a/plan +++ b/plan @@ -1,4 +1,6 @@ kernel capabilities: 1 per aktie; bevat code in plaats van bitmask. CREATE ipv DEGRADE. activation address in receiver -message: a0-a3: data; protectedL; protectedH; caps +message: a0-a3: data0; data1; protectedL; protectedH +caps is stored in designated (by receiver) slot caps zonder size limit? +invoke ipc: try sync; try receiver memory; try caller memory; fail.