Kernel: Bug fix -- on system call, touch kernel_flag only after switching to the...
authorWill Sowerbutts <will@sowerbutts.com>
Sat, 27 Dec 2014 11:26:25 +0000 (11:26 +0000)
committerWill Sowerbutts <will@sowerbutts.com>
Sat, 27 Dec 2014 11:40:28 +0000 (11:40 +0000)
Kernel/lowlevel-z80.s

index 3088cdc..c43c4f6 100644 (file)
@@ -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