From: Alan Cox Date: Sat, 25 Aug 2018 14:13:57 +0000 (+0100) Subject: z80-thunked: More assorted fixes X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=073e512683ad45c1d87594aee4733dfe889c6a2b;p=FUZIX.git z80-thunked: More assorted fixes We are now at the point some syscalls sort of work --- diff --git a/Kernel/lowlevel-z80-thunked.s b/Kernel/lowlevel-z80-thunked.s index b1317031..4e23ce1a 100644 --- a/Kernel/lowlevel-z80-thunked.s +++ b/Kernel/lowlevel-z80-thunked.s @@ -113,8 +113,8 @@ unix_syscall_entry: ld (U_DATA__U_CALLNO),a ld (U_DATA__U_ARGN),bc ld (U_DATA__U_ARGN1),de - ld (U_DATA__U_ARGN2),hl - ld (U_DATA__U_ARGN3),ix + ld (U_DATA__U_ARGN2),ix + ld (U_DATA__U_ARGN3),hl ; Stack the alternate registers exx push bc @@ -157,7 +157,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_PAGE2) + ld a,(U_DATA__U_PAGE+1) ret signal_path: ld h,a ; save signal number @@ -233,6 +233,7 @@ intreti:di ld a, (U_DATA__U_INSYS) or a jr nz, interrupt_kernel + call map_user_low intsig: ld a,(U_DATA__U_CURSIG) or a @@ -241,8 +242,9 @@ intsig: no_sig: xor a ld e,a - ld a,(U_DATA__U_PAGE2) + ld a,(U_DATA__U_PAGE+1) intret: + ex af,af' exx pop iy pop ix diff --git a/Kernel/usermem_std-z80-thunked.s b/Kernel/usermem_std-z80-thunked.s index 1d09734f..db83917c 100644 --- a/Kernel/usermem_std-z80-thunked.s +++ b/Kernel/usermem_std-z80-thunked.s @@ -197,6 +197,7 @@ __ugetc: ld a,(U_DATA__U_PAGE) jr z, ugetcl ld a,(U_DATA__U_PAGE + 1) + res 7,h ugetcl: call map_page_low ld l,(hl) @@ -211,26 +212,31 @@ __ugetw: push bc bit 7,h jr z, ugetwl + ; High page - no wrap possible ld a,(U_DATA__U_PAGE + 1) call map_page_low res 7,h ld a,(hl) inc hl normal_wl: + ; Get the high byte ld h,(hl) ld l,a jp map_kernel_low ugetwl: + ; Low page - we might be fetching 7FFF/8000 ld a,(U_DATA__U_PAGE) call map_page_low ld a,(hl) inc hl bit 7,h - jr z, normal_wl + jr z, normal_wl ; No split + ; We fetched 7FFF/8000 ld l,a + ld a,(U_DATA__U_PAGE + 1) + call map_page_low ld a,(0) ; Split can only mean one address ld h,a - ld a,(U_DATA__U_PAGE + 1) jp map_kernel_low __uputc: @@ -244,6 +250,7 @@ __uputc: ld a,(U_DATA__U_PAGE) jr z, uputcl ld a,(U_DATA__U_PAGE + 1) + res 7,h uputcl: call map_page_low ld (hl),e @@ -274,6 +281,7 @@ uputwl: bit 7,h jr z, normal_pwl ld a,(U_DATA__U_PAGE + 1) + call map_page_low ld a,d ld (0),a ; Split can only mean one address jp map_kernel_low