dragon-nx32: Only copy used memory on fork
authorTormod Volden <debian.tormod@gmail.com>
Thu, 4 Jun 2015 07:40:45 +0000 (09:40 +0200)
committerAlan Cox <alan@linux.intel.com>
Thu, 4 Jun 2015 09:15:30 +0000 (10:15 +0100)
Speed up forking by not copying the space between heap and stack.

Alan's suggestion.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Kernel/platform-dragon-nx32/kernel.def
Kernel/platform-dragon-nx32/tricks.s

index f5b907a..c1ee111 100644 (file)
@@ -8,6 +8,8 @@ U_DATA_STASH                equ 0xFC00       ; FC00-FEFF
 VIDEO_BASE                 equ 0x0400       ; 6K for the display
 VIDEO_END                  equ 0x1C00
 
+PROGBASE                    equ 0x8000       ; programs and data start here
+
 ; Have these defined so that lowlevel-6809.s can be used as-is
 SAM_USER macro
        endm
index 3a0660e..a050634 100644 (file)
@@ -256,9 +256,12 @@ fork_copy:
        ldx fork_proc_ptr
        ldb P_TAB__P_PAGE_OFFSET+1,x    ; new bank
        lda U_DATA__U_PAGE+1            ; old bank
-       ldx #0x8000                     ; PROGBASE
-       ldu U_DATA__U_TOP
+       ldx #PROGBASE
+       ldu U_DATA__U_BREAK             ; top of data
        jsr copybank                    ; preserves A,B, clobbers X,U
+       ldx U_DATA__U_SP
+       ldu U_DATA__U_TOP               ; top of process memory
+       jsr copybank
 
 ; stash parent uarea (including kernel stack)
        jsr map_process_a