thunked: fix stack handling bug in the pre-emption path
authorAlan Cox <alan@linux.intel.com>
Tue, 11 Dec 2018 18:06:08 +0000 (18:06 +0000)
committerAlan Cox <alan@linux.intel.com>
Tue, 11 Dec 2018 18:06:08 +0000 (18:06 +0000)
Kernel/lowlevel-z80-thunked.s
Kernel/platform-cromemco/kernel.def
Kernel/platform-sam/kernel.def
Kernel/platform-sc108/kernel.def

index efe6540..4ebdff6 100644 (file)
@@ -86,7 +86,7 @@ _doexec:
        ld sp,hl
        ex de,hl
        ld de,#PROGLOAD
-       ld a,(U_DATA__U_PAGE+1) ; pass high page to trampoline
+       ld a,(U_DATA__U_PAGE+HIGHPAGE) ; pass high page to trampoline
        jp _platform_doexec     ; jump into the low memory stub
 
 ;
@@ -158,7 +158,7 @@ syscall_return:
        exx
        ; Return page for caller (may not be the page we can in on if we
        ; swapped
-       ld a,(U_DATA__U_PAGE+1)
+       ld a,(U_DATA__U_PAGE+HIGHPAGE)
        ret
 signal_path:
        ld h,a          ; save signal number
@@ -234,7 +234,7 @@ no_sig:
        xor a
        ld (_int_disabled),a
        ld e,a
-       ld a,(U_DATA__U_PAGE+1)
+       ld a,(U_DATA__U_PAGE+HIGHPAGE)
 intret:
        ret
 
@@ -317,6 +317,10 @@ intret2:
        ; The istack was lost but that is ok as we saved the return onto the
        ; kernel stack, so when we finally ret we end up in the right place
        ld sp,#kstack_top - 2           ; saved return address
+
+       ld hl,(U_DATA__U_SYSCALL_SP)
+       ld (istack_switched_sp),hl
+
        ; Now continue on the interrupt return path
        ; looking for signals
        jr intsig
index def2cec..939d0b7 100644 (file)
@@ -21,3 +21,7 @@ CONFIG_SWAP               .equ 0
 .macro HIGH
                .area _COMMONMEM
 .endm
+
+; We only have a single page entry
+
+HIGHPAGE                   .equ 0
\ No newline at end of file
index 50f075f..d00b87b 100644 (file)
@@ -20,3 +20,7 @@ Z80_TYPE                  .equ 1
 .macro HIGH
                .area _HIGH
 .endm
+
+; We keep the low and high bytes of the 32K map in the two adjacent bytes
+;
+HIGHPAGE                   .equ 1
\ No newline at end of file
index 35fe066..37a5db6 100644 (file)
@@ -44,3 +44,6 @@ NBUFS         .equ    4
 .macro HIGH
                .area _COMMONMEM
 .endm
+
+HIGHPAGE       .equ    0       ; We only have 1 page byte and the low page
+                               ; isn't used