From: Will Sowerbutts Date: Sat, 27 Dec 2014 11:26:25 +0000 (+0000) Subject: Kernel: Bug fix -- on system call, touch kernel_flag only after switching to the... X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=4154d9829c22a395fefdc811c6d56eff4cc26eaa;p=FUZIX.git Kernel: Bug fix -- on system call, touch kernel_flag only after switching to the kernel memory bank --- diff --git a/Kernel/lowlevel-z80.s b/Kernel/lowlevel-z80.s index 3088cdc2..c43c4f60 100644 --- a/Kernel/lowlevel-z80.s +++ b/Kernel/lowlevel-z80.s @@ -77,10 +77,6 @@ unix_syscall_entry: push ix push iy - ; make sure the interrupt logic knows we are in kernel mode - ld a, #1 - ld (_kernel_flag), a - ; locate function call arguments on the userspace stack ld hl, #18 ; 16 bytes machine state, plus 2 bytes return address add hl, sp @@ -103,6 +99,10 @@ unix_syscall_entry: ; map in kernel keeping common call map_kernel + ; make sure the interrupt logic knows we are in kernel mode (flag lives in kernel bank) + ld a, #1 + ld (_kernel_flag), a + ; re-enable interrupts ei