From: Alan Cox Date: Mon, 26 Jan 2015 22:53:07 +0000 (+0000) Subject: bank code; Add comments and information to these X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=39971c750170529d30e8d737660c7de1e44196a8;p=FUZIX.git bank code; Add comments and information to these --- diff --git a/Kernel/bank16k.c b/Kernel/bank16k.c index cfb8059a..6db6796c 100644 --- a/Kernel/bank16k.c +++ b/Kernel/bank16k.c @@ -1,3 +1,24 @@ +/* + * This module manages a system with flexible 16K sized banks. It assumes + * that the udata and kernel common/stacks/other overheads are mapped at the + * very top of available memory. (PROGTOP to 0xFFFF) + * + * If the memory is mapped with the common at the bottom (16K banks for 6502 + * for example) then use bank16k_low.c + * + * Other requirements: + * - If you are using swap your swap driver must know how to remap and access + * any process memory for the other processes + * - 16bit address space (under 64K is fine, over is not) + * + * Set: + * CONFIG_BANK16 + * MAX_MAPS to the largest number of free pages there can be + * SWAPDEV if using swap + * PROGTOP first byte above process space + * + * Page numbers must not include 0 (0 is taken as swapped) + */ #include #include #include diff --git a/Kernel/bank16k_low.c b/Kernel/bank16k_low.c index b99c86cc..0b16ac0c 100644 --- a/Kernel/bank16k_low.c +++ b/Kernel/bank16k_low.c @@ -3,8 +3,24 @@ #include /* - * 16K memory banks with the common in the bottom bank. Currently only used - * for the 6502 CPU. + * This module manages a system with flexible 16K sized banks. It assumes + * that the udata and kernel common/stacks/other overheads are mapped at the + * bottom of available memory. (0 to PROGBASE - 1) + * + * If the memory is mapped with the common at the top (16K banks for Z80 + * for example) then use bank16k.c + * + * Other requirements: + * - If you are using swap your swap driver must know how to remap and access + * any process memory for the other processes + * - 16bit address space (under 64K is fine, over is not) + * + * Set: + * CONFIG_BANK16_LOW + * MAX_MAPS to the largest number of free pages there can be + * SWAPDEV if using swap + * + * Page numbers must not include 0 (0 is taken as swapped) */ @@ -113,10 +129,6 @@ int pagemap_realloc(uint16_t size) unchanged at the top */ if (want - have > pfptr) return ENOMEM; - /* We don't want to take an interrupt here while our page mappings are - incomplete. We may restore bogus mappings and then take a second IRQ - into hyperspace */ - irq = di(); /* We have common low so we must only touch the higher pages. This is different from the high common case */ @@ -129,12 +141,7 @@ int pagemap_realloc(uint16_t size) /* Copy the updated allocation into the ptab */ udata.u_ptab->p_page = udata.u_page; udata.u_ptab->p_page2 = udata.u_page2; - /* Now fix the vectors up - they've potentially teleported up to 48K up - the user address space, we need to put a copy back in low memory before - we switch to this memory map */ - program_vectors(&udata.u_page); - irqrestore(irq); return 0; } diff --git a/Kernel/bankfixed.c b/Kernel/bankfixed.c index 397e0c3f..758dfd45 100644 --- a/Kernel/bankfixed.c +++ b/Kernel/bankfixed.c @@ -1,3 +1,32 @@ +/* + * This module manages a system with fixed sized banking where all but one + * area of memory is pinned and the other area can be set to multiple + * different banks. + * + * FFFF +-----------------------------------+ + * | Common Memory | + * MAPBASE+MAP_SIZE +-----------------------------------+ + * | Banked Memory | + * MAPBASE +-----------------------------------+ + * | Common Memory | + * 0000 +-----------------------------------+ + * + * + * Other requirements: + * - 16bit address space (under 64K is fine, over is not) [Wants fixing] + * + * Set: + * CONFIG_BANK_FIXED + * MAX_MAPS to the number of banks available for user programs + * SWAPDEV if using swap + * MAP_SIZE the size of the bankable area + * + * Most platforms using this module can use the standard lib/ tricks.s for + * their processor. + * + * Bank numbers must not include 0 (0 is taken as swapped) + */ + #include #include #include diff --git a/Kernel/simple.c b/Kernel/simple.c index 9b3092d6..7a957186 100644 --- a/Kernel/simple.c +++ b/Kernel/simple.c @@ -1,5 +1,20 @@ /* - * Simple swap only system + * This module manages a system with no user banking. + * + * User memory lies between PROGBASE and PROGTOP which does not overlap + * common memory. The kernel may be banked over user memory areas if needed. + * + * All task switching occurs by swapping the existing process out to storage + * and reading in the new one. This can be done for either single tasking or + * (with a hard disk) multitasking. + * + * Other requirements: + * - 16bit address space (FIXME: should be made 32bit clean) + * + * Set: + * CONFIG_SWAP_ONLY + * + * Zero is used as swapped, 1 is used as in memory. */ #include diff --git a/Kernel/single.c b/Kernel/single.c index e4bf7a96..bc6b47f2 100644 --- a/Kernel/single.c +++ b/Kernel/single.c @@ -4,9 +4,9 @@ /* * Support for single tasking systems where there is not enough memory for - * multiple tasks and where there is no suitable swap device. This configuration - * is suitable for systems with over about 96K of RAM and nothing but a floppy - * drive. + * multiple tasks and where there is no suitable swap device. This + * configuration can be useful for boot disks/standalone tools or to run + * apps on boxes otherwise incapable of running Fuzix code. * * To use this method of operation you should do the following * @@ -15,6 +15,16 @@ * * If you don't have a "true" common area then your code that calls swap * helpers while banked will need to copy ramtop between the banks + * + * Set: + * SWAPDEV to provide your own swap routines (eg to high memory) rather + * than use the simple (slow) ones provided as reference. + * + * Note: + * Unlike most other ports ramtop moves as processes are squashed up in + * high memory. + * This is actually not the simplest way to bring up a platform. If you + * have real banking then start with bankfixed.c */ diff --git a/Kernel/unbanked.c b/Kernel/unbanked.c index de3caf34..cb754c57 100644 --- a/Kernel/unbanked.c +++ b/Kernel/unbanked.c @@ -34,6 +34,12 @@ * For 8086 we actually want two holes in some cases, one for cs: and one * for ds: but we don't have all the vector hassle as we have a vaguely * real notion of user/supervisor state. + * + * Set: + * CONFIG_BANKED_LINEAR + * COMMON_BANKS - number of 256 byte pages of udata etc needed + * with each process + * */ #include