lowlevel-z80: di/ei handling
authorAlan Cox <alan@etchedpixels.co.uk>
Sun, 16 Nov 2014 16:20:58 +0000 (16:20 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Sun, 16 Nov 2014 16:20:58 +0000 (16:20 +0000)
Handle both di/ei restore cases don't assume we are just stacking disables

Kernel/lowlevel-z80.s

index 558fbf2..cb83d97 100644 (file)
@@ -284,6 +284,12 @@ interrupt_handler:
             ; don't allow us to run re-entrant, we've only got one interrupt stack
             ld a, (U_DATA__U_ININTERRUPT)
             or a
+           jr z, noree
+           push af
+           ld a, #'#'
+           out (21), a
+           pop af
+noree:
             jp nz, interrupt_return
             inc a
             ld (U_DATA__U_ININTERRUPT), a
@@ -308,6 +314,8 @@ interrupt_handler:
            push af
            jr nz, in_kernel
 
+           ld a, #'U'
+           out (0x01), a
             ; we're not in kernel mode, check for signals and fault
            ld a, #0xC3
            cp b                ; should be a jump
@@ -344,7 +352,7 @@ in_kernel:
            ; mapping as it will vary during kernel activity and the kernel
            ; wants it put back as it was before
 in_kernel_2:
-          call map_restore
+           call map_restore
 int_switch:
             ld sp, (istack_switched_sp)        ; stack back
 
@@ -446,8 +454,9 @@ _irqrestore:        pop hl          ; sdcc needs to get register arg passing
                pop af          ; so badly
                jp po, was_di
                ei
-was_di:
-               push af
+               jr irqres_out
+was_di:                di
+irqres_out:    push af
                jp (hl)