From db4504c838c8a6a39f453bd7d6e957cd31d4182a Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 30 Mar 2018 22:58:06 +0100 Subject: [PATCH] kernel: add pre-emption signal checks to assembly paths With these in place we appear to be good except for some kind of net breakage that needs resolving. --- Kernel/lowlevel-65c816.s | 5 +++++ Kernel/lowlevel-6809.s | 2 ++ Kernel/lowlevel-68hc11.s | 3 ++- Kernel/lowlevel-z80-banked.s | 8 +++++++- Kernel/lowlevel-z80.s | 5 ++++- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Kernel/lowlevel-65c816.s b/Kernel/lowlevel-65c816.s index 210a06bc..397fa325 100644 --- a/Kernel/lowlevel-65c816.s +++ b/Kernel/lowlevel-65c816.s @@ -44,6 +44,7 @@ .import _inint .import _platform_monitor .import _platform_switchout + .import _chksigs .import push0 .import incaxy @@ -626,6 +627,10 @@ ret_to_user: lda #1 sta U_DATA__U_INSYS ; + ; Check for signals (the kstack is sane at this point) + ; + jsr _chksigs + ; ; Mark outselves as idle ; ldx U_DATA__U_PTAB diff --git a/Kernel/lowlevel-6809.s b/Kernel/lowlevel-6809.s index d32759a8..6ca05478 100644 --- a/Kernel/lowlevel-6809.s +++ b/Kernel/lowlevel-6809.s @@ -305,6 +305,8 @@ in_kernel: ; Pre emption occurs on the task stack. Conceptually its a ; not quite a syscall lds #kstack_top + jsr _chksigs ; check signal state + ; ldx U_DATA__U_PTAB ; Move to ready state lda #P_READY diff --git a/Kernel/lowlevel-68hc11.s b/Kernel/lowlevel-68hc11.s index 91a52b53..01838154 100644 --- a/Kernel/lowlevel-68hc11.s +++ b/Kernel/lowlevel-68hc11.s @@ -147,10 +147,11 @@ interrupt_handler: ldd istack_switched_sp std U_DATA__U_SYSCALL_SP lds #kstack_top + jsr chksigs ldx U_DATA__U_PTAB ldab #P_READY stab P_TAB__P_STATUS_OFFSET,x - jsr switchout + jsr platform_switchout jsr map_process_always ; caller will switch back to stack in X ldx U_DATA__U_SYSCALL_SP diff --git a/Kernel/lowlevel-z80-banked.s b/Kernel/lowlevel-z80-banked.s index c2ae3b58..c7d7d448 100644 --- a/Kernel/lowlevel-z80-banked.s +++ b/Kernel/lowlevel-z80-banked.s @@ -522,7 +522,6 @@ preemption: ; intret2:call map_kernel - ; ; Semantically we are doing a null syscall for pre-empt. We need ; to record ourselves as in a syscall so we can't be recursively @@ -530,6 +529,13 @@ intret2:call map_kernel ; ld a, #1 ld (U_DATA__U_INSYS), a + ; + ; Check for signals + ; + push af + call chksigs + pop af + ; ; Process status is offset 0 ; diff --git a/Kernel/lowlevel-z80.s b/Kernel/lowlevel-z80.s index a583a555..d78b8507 100644 --- a/Kernel/lowlevel-z80.s +++ b/Kernel/lowlevel-z80.s @@ -541,7 +541,6 @@ preemption: ; intret2:call map_kernel - ; ; Semantically we are doing a null syscall for pre-empt. We need ; to record ourselves as in a syscall so we can't be recursively @@ -550,6 +549,10 @@ intret2:call map_kernel ld a, #1 ld (U_DATA__U_INSYS), a ; + ; Check for signals + ; + call _chksigs + ; ; Process status is offset 0 ; ld hl, (U_DATA__U_PTAB) -- 2.34.1