z80-thunked: More assorted fixes
authorAlan Cox <alan@linux.intel.com>
Sat, 25 Aug 2018 14:13:57 +0000 (15:13 +0100)
committerAlan Cox <alan@linux.intel.com>
Sat, 25 Aug 2018 14:13:57 +0000 (15:13 +0100)
We are now at the point some syscalls sort of work

Kernel/lowlevel-z80-thunked.s
Kernel/usermem_std-z80-thunked.s

index b131703..4e23ce1 100644 (file)
@@ -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
index 1d09734..db83917 100644 (file)
@@ -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