From 699ee10eaa9a36903d834dbc452a8d5e7f31aec2 Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Mon, 18 May 2015 01:19:17 +0200 Subject: [PATCH] dragon-nx32: Implement swapping in of processes Also fix up swap parameters in config.h Signed-off-by: Tormod Volden --- Kernel/platform-dragon-nx32/config.h | 6 +++--- Kernel/platform-dragon-nx32/tricks.s | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Kernel/platform-dragon-nx32/config.h b/Kernel/platform-dragon-nx32/config.h index 702d5d26..74a94dc8 100644 --- a/Kernel/platform-dragon-nx32/config.h +++ b/Kernel/platform-dragon-nx32/config.h @@ -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 */ diff --git a/Kernel/platform-dragon-nx32/tricks.s b/Kernel/platform-dragon-nx32/tricks.s index ef6cbd66..49bcd506 100644 --- a/Kernel/platform-dragon-nx32/tricks.s +++ b/Kernel/platform-dragon-nx32/tricks.s @@ -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 -- 2.34.1