sam: more work on fork support for 32/32
authorAlan Cox <alan@linux.intel.com>
Mon, 13 Aug 2018 12:52:37 +0000 (13:52 +0100)
committerAlan Cox <alan@linux.intel.com>
Mon, 13 Aug 2018 12:52:37 +0000 (13:52 +0100)
Kernel/platform-sam/sam.s
Kernel/platform-sam/tricks.s

index b2eec66..a841e4b 100644 (file)
@@ -239,10 +239,9 @@ _platform_copier_l:                ; Must be low
            and #0x60           ; preserve the colour bits
            or #KERNEL_HIGH
            out (251),a
-           ret
+           jp (ix)
 syscall_stash:
            .byte 0             ; must be low
-           nop
 rst18:
 _platform_doexec:
            out (251),a         ; caller needs to handle CLUT bits
@@ -302,7 +301,7 @@ _platform_copier_h:
            and #0x60
            or #KERNEL_HIGH
            out (251),a
-           ret
+           jp (ix)
 interrupt_high:
            push af
            push de
index dbe2770..e32fa35 100644 (file)
@@ -152,7 +152,9 @@ _dofork:
 
        ; Parent state built and in u_data
 
+       push ix
        call copy_process
+       pop ix
 
        ; Low page is undefined at this point which is ok as we are
        ; about to change it again
@@ -209,24 +211,30 @@ _dofork:
 ;      exx
 ;      ld a,#kernel
 ;      out (whatever),a
-;      ret
+;      jp (ix)
 ;
 ;      There have to be two of these - one in high stubs one in low because
 ;      the high banks will both be mapped so the low one isn't available
 ;
+;      We also have no sane stack for these so we use ix as the return.
+;
 copy_process:
        ld de,#P_TAB__P_PAGE2_OFFSET
        add hl,de
        ld a,(U_DATA__U_PAGE)
        call map_page_low
        call setup_platform_copier
-       call _platform_copier_l
+       ld ix,#cp1ret
+       jp _platform_copier_l
+cp1ret:
        inc hl
        inc hl
        ld a,(U_DATA__U_PAGE2)
        call map_page_low
        call setup_platform_copier
-       call _platform_copier_h
+       ld ix,#cp2ret
+       jp _platform_copier_h
+cp2ret:
        ret
 
 setup_platform_copier:
@@ -236,4 +244,4 @@ setup_platform_copier:
        ld b,d
        ld c,e
        exx
-       ret
\ No newline at end of file
+       ret