From 08f5ac5d46a12c68d69da8a3bb46131ceeeb4a23 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 15 Jun 2016 15:35:47 +0100 Subject: [PATCH] lowlevel-z80: fix null handler --- Kernel/lowlevel-z80-banked.s | 19 +++++++++++-------- Kernel/lowlevel-z80.s | 21 ++++++++++++--------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Kernel/lowlevel-z80-banked.s b/Kernel/lowlevel-z80-banked.s index 1d865058..736081c6 100644 --- a/Kernel/lowlevel-z80-banked.s +++ b/Kernel/lowlevel-z80-banked.s @@ -296,23 +296,26 @@ _doexec: ; ; Called from process context (hopefully) ; -; FIXME: hardcoded RST38 won't work on all boxes +; FIXME: hardcoded RST30 won't work on all boxes ; null_handler: ; kernel jump to NULL is bad ld a, (U_DATA__U_INSYS) or a - jp z, trap_illegal + jp nz, trap_illegal ; user is merely not good ld hl, #7 push hl - ld hl, (U_DATA__U_PTAB) + ld ix, (U_DATA__U_PTAB) + ld l,P_TAB__P_PID_OFFSET(ix) + ld h,P_TAB__P_PID_OFFSET+1(ix) push hl - ld hl, #10 ; signal (getpid(), SIGBUS) + ld hl, #39 ; signal (getpid(), SIGBUS) rst #0x30 ; syscall - pop hl - pop hl - ld hl, #0 + ld hl, #0xFFFF + push hl + dec hl ; #0 + push hl rst #0x30 ; exit @@ -471,7 +474,7 @@ interrupt_pop: null_pointer_trap: ld a, #0xC3 ld (0), a - + ld hl, #11 ; SIGSEGV trap_signal: push hl ld hl, (U_DATA__U_PTAB); diff --git a/Kernel/lowlevel-z80.s b/Kernel/lowlevel-z80.s index 094787e4..199668a1 100644 --- a/Kernel/lowlevel-z80.s +++ b/Kernel/lowlevel-z80.s @@ -291,23 +291,27 @@ _doexec: ; ; Called from process context (hopefully) ; -; FIXME: hardcoded RST38 won't work on all boxes +; FIXME: hardcoded RST30 won't work on all boxes ; null_handler: ; kernel jump to NULL is bad ld a, (U_DATA__U_INSYS) or a - jp z, trap_illegal + jp nz, trap_illegal ; user is merely not good ld hl, #7 push hl - ld hl, (U_DATA__U_PTAB) + ld ix, (U_DATA__U_PTAB) + ld l,P_TAB__P_PID_OFFSET(ix) + ld h,P_TAB__P_PID_OFFSET+1(ix) + push hl + ld hl, #39 ; signal (getpid(), SIGBUS) push hl - ld hl, #10 ; signal (getpid(), SIGBUS) rst #0x30 ; syscall - pop hl - pop hl - ld hl, #0 + ld hl, #0xFFFF + push hl + dec hl ; #0 + push hl rst #0x30 ; exit @@ -462,11 +466,10 @@ interrupt_pop: null_pointer_trap: ld a, #0xC3 ld (0), a - + ld hl, #11 ; SIGSEGV trap_signal: push hl ld hl, (U_DATA__U_PTAB); - push hl call _ssig pop hl pop hl -- 2.34.1