From: Alan Cox Date: Sun, 2 Nov 2014 18:37:32 +0000 (+0000) Subject: px4plus: update comments, remember to swap the uarea X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=a65c89e0bc20e508ea8a3e21e107ab6bb8787a5a;p=FUZIX.git px4plus: update comments, remember to swap the uarea --- diff --git a/Kernel/platform-px4plus/README b/Kernel/platform-px4plus/README index 6a796302..799b1f9f 100644 --- a/Kernel/platform-px4plus/README +++ b/Kernel/platform-px4plus/README @@ -1,4 +1,4 @@ -A FUZIX target for the PX4plus +A FUZIX target for the PX4plus (and PX4 with 128K RAM disc) Just playing to see if we can make it fit. @@ -14,7 +14,11 @@ Intended Memory Map 0x0000-0x00FF Vectors -0x0100-0x???? (RAM) User program (and discard area) +0x0100-0x7CFF (RAM) User program (and discard area) +(could go to 0xBFFF for 48K but our swap is very limiting and might need + smarter algorithms for swap - eg 16K banking for swap alone) +0x7D00-0xCFFF Space for things we can bank under the ROM + (secondary floppy cache ??) 0xD000-0xDFFF Framebuffer, font, video code 0xE000-0xF7FFish Data for kernel 0xF800-0xFCFF Common (currently ends FBCC) @@ -39,3 +43,14 @@ In practice it appears the answer is 2. But only if the linker is taught to do banking. In fact once the linker does its own banking there is plenty of space although the bootloader might be a bit odd to make it work. + +A better layout given the 128K total swap limit might appear to be + +0x0000-0x00FF Vectors +0x0100-0x7CFF Application +0x7D00-0x7FFF Uarea + +but we actually can't do this because the 32K ROM is always mapped from +0x6000-0xDFFF and needs to access the Uarea + + diff --git a/Kernel/platform-px4plus/config.h b/Kernel/platform-px4plus/config.h index bf0b80e6..1e074de6 100644 --- a/Kernel/platform-px4plus/config.h +++ b/Kernel/platform-px4plus/config.h @@ -34,11 +34,14 @@ #define PROGBASE ((char *)(0x0100)) /* also data base */ #define PROGTOP ((char *)(0x4000)) /* Top of program for debug */ -#define SWAP_SIZE 0x40 /* 32K in blocks (we actually don't need the low 256) */ -#define SWAPBASE 0x0000 /* We swap the lot in one, include the */ -#define SWAPTOP 0x8000 /* vectors so its a round number of sectors */ +#define SWAP_SIZE 0x40 /* 32K in blocks (with uarea means 31K max app size) */ +#define SWAPBASE 0x0100 /* We swap the lot in one, include the */ +#define SWAPTOP 0x7C00 /* vectors so its a round number of sectors */ #define MAX_SWAPS 4 /* We have a whopping 128K of RAMDISC! */ +#define UDATA_SWAPSIZE 0x0400 /* Write udata plus 0-0x0100 */ +#define UDATA_BLOCKS 2 + #define BOOT_TTY (512 + 1)/* Set this to default device for stdio, stderr */ /* In this case, the default is the first TTY device */ diff --git a/Kernel/platform-px4plus/main.c b/Kernel/platform-px4plus/main.c index 6cb5ac5c..185dc2d6 100644 --- a/Kernel/platform-px4plus/main.c +++ b/Kernel/platform-px4plus/main.c @@ -30,3 +30,13 @@ void platform_interrupt(void) void map_init(void) { } + +void *swapout_prepare_uarea(ptptr p) +{ + return &udata; +} + +void *swapin_prepare_uarea(ptptr p) +{ + return &udata; +}