From 18e92cf693a17f4fd7b995ef31903fd280752d74 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 16 Nov 2014 16:20:58 +0000 Subject: [PATCH] lowlevel-z80: di/ei handling Handle both di/ei restore cases don't assume we are just stacking disables --- Kernel/lowlevel-z80.s | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Kernel/lowlevel-z80.s b/Kernel/lowlevel-z80.s index 558fbf2c..cb83d978 100644 --- a/Kernel/lowlevel-z80.s +++ b/Kernel/lowlevel-z80.s @@ -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) -- 2.34.1