dragon-nx32: Implement swapping in of processes
authorTormod Volden <debian.tormod@gmail.com>
Sun, 17 May 2015 23:19:17 +0000 (01:19 +0200)
committerAlan Cox <alan@linux.intel.com>
Mon, 18 May 2015 13:03:34 +0000 (14:03 +0100)
Also fix up swap parameters in config.h

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

index 702d5d2..74a94dc 100644 (file)
@@ -17,9 +17,9 @@
 #define CONFIG_BANKS   1
 /* And swapping */
 #define SWAPDEV 2049           /* DriveWire drive 1 */
-#define SWAP_SIZE   0x80       /* 64K blocks */
-#define SWAPBASE    0x8000     /* We swap the lot in one, include the */
-#define SWAPTOP     0xFF00     /* uarea so its a round number of sectors */
+#define SWAP_SIZE   0x40       /* 32K in 512 byte blocks */
+#define SWAPBASE    0x8000     /* We swap the lot, including stashed uarea */
+#define SWAPTOP     0xFF00     /* so it's a round number of 256 byte sectors */
 #define MAX_SWAPS   32
 
 /* Permit large I/O requests to bypass cache and go direct to userspace */
index ef6cbd6..49bcd50 100644 (file)
@@ -97,6 +97,14 @@ _switchin:
        cmpa U_DATA__U_PAGE+1
        beq nostash
 
+       ; process was swapped out?
+       cmpa #0
+       bne not_swapped
+       jsr _swapper            ; void swapper(ptptr p)
+       ldx _swapstack
+       lda P_TAB__P_PAGE_OFFSET+1,x
+
+not_swapped:
        jsr map_process_a
        
        ; fetch uarea from process memory
@@ -125,6 +133,10 @@ nostash:
        lda #P_RUNNING
        sta P_TAB__P_STATUS_OFFSET,x
 
+       ; fix any moved page pointers
+       lda P_TAB__P_PAGE_OFFSET+1,x
+       sta U_DATA__U_PAGE+1
+
        ldx #0
        stx _runticks