bank code; Add comments and information to these
authorAlan Cox <alan@linux.intel.com>
Mon, 26 Jan 2015 22:53:07 +0000 (22:53 +0000)
committerAlan Cox <alan@linux.intel.com>
Mon, 26 Jan 2015 22:53:07 +0000 (22:53 +0000)
Kernel/bank16k.c
Kernel/bank16k_low.c
Kernel/bankfixed.c
Kernel/simple.c
Kernel/single.c
Kernel/unbanked.c

index cfb8059..6db6796 100644 (file)
@@ -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 <kernel.h>
 #include <kdata.h>
 #include <printf.h>
index b99c86c..0b16ac0 100644 (file)
@@ -3,8 +3,24 @@
 #include <printf.h>
 
 /*
- *     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;
 }
 
index 397e0c3..758dfd4 100644 (file)
@@ -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 <kernel.h>
 #include <kdata.h>
 #include <printf.h>
index 9b3092d..7a95718 100644 (file)
@@ -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 <kernel.h>
index e4bf7a9..bc6b47f 100644 (file)
@@ -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
  *
  *
  *     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
  */
 
 
index de3caf3..cb754c5 100644 (file)
  *     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 <kernel.h>