If we do swap it breaks. Not yet sure why.
See platform-v68
This is a test tree for a configuration using banked memory (N8VEM 680x0
-style)
+style). In this configuration we place the kernel in the low 64K of the
+emulator space (protected), and we put the applications and the udata stash
+in each bank. This allows us to keep the kernel protected. We'd have far
+faster task switch if we kept udata banks all in the kernel and moved a5
+(plus did fork differently) but would then lose the 64K protection.
+We simulate 4 banks of 128K plus swap.
TODO
+
+- Debug swap (swap out works, swap in fails)
+
- Make bankfixed support only writing out used areas of memory
-Look at bankfixed/bankfixed32 split - put the smarts in bankfixed32 and then
-look at a proper swap allocator so we don't waste tons of memory.
+- Make fork copy only the needed bits
+
+Look at a bankfixed/bankfixed32 split - put the smarts in bankfixed32 and then
+look at a proper swap allocator so we don't waste tons of memory with big
+banks.
-- Write the bank copy routines (copy needed bits zero rest and optimise)
- Write optimised udata copier ? (movem based and reverse ?)
- Save restore bank on interrupt entry/exit
#define CONFIG_BANK_FIXED
#define MAX_MAPS 4
#define MAPBASE 0x00200000
-#define MAP_SIZE 0x00100000
+#define MAP_SIZE 0x00020000
#define CONFIG_BANKS 1
-#define PROC_SIZE MAP_SIZE /* 1MB */
+#define PROC_SIZE MAP_SIZE /* 128K */
#define CONFIG_SPLIT_UDATA
#define UDATA_SIZE 1024
#define SWAP_SIZE ((MAP_SIZE/512) + 2) /* 2 for the udata */
#define SWAPBASE PROGBASE
#define SWAPTOP PROGTOP
-#define MAX_SWAPS 3 /* So can reuse the same fs */
- /* Use a bigger swap area for real uses ! */
+#define MAX_SWAPS 16
+
#define swap_map(x) ((uint8_t *)(x))
#define SWAPDEV (1)
void pagemap_init(void)
{
+ /* 0 means swapped */
+ /* We number 1-4 and reply on the hardware wrapping to 0,3,2,1...
+ in the more general case if you use 0 then you need to invent
+ it */
pagemap_add(3);
pagemap_add(2);
pagemap_add(1);
- pagemap_add(0); /* Used for init */
+ pagemap_add(4);
}
uaddr_t ramtop;
; parent state is valid
;
move.w P_TAB__P_PID_OFFSET(a0),-(sp) ; child pid (parent return)
- move.l usp,a0
- movem.l a0/a2-a4/a6/d2-d7,-(sp) ; save state
+ move.l usp,a1
+ movem.l a1-a4/a6/d2-d7,-(sp) ; save state
move.l sp,U_DATA__U_SP(a5) ; save pointer
;
; At this point we can make a copy of the parent udata into the
; We enter this on the child's mappings with its udata
;
jsr newproc ; Called with the child udata
- add.w #54,sp ; toss the stack frames
+ add.w #50,sp ; toss the stack frames
clr.w runticks
moveq #0,d0 ; child
copyloop:
move.b d1,$FFF05000 ; parent bank
- move.l (a0),d0
- move.b d2,$FFF05000 ; child bank
- move.l d0,(a0)+
- cmp.l #$00300000,a0
+ move.l (a0),d2
+ move.b d0,$FFF05000 ; child bank
+ move.l d2,(a0)+
+ cmp.l #$00220000,a0
bne copyloop
; Return with child bank paged as we want it
move.l (sp)+,d2 ; we swapped stack but copied d2