kernel: add p_top so we can do swap in banking modes not just fixed bank
authorAlan Cox <alan@linux.intel.com>
Sun, 31 May 2015 17:29:51 +0000 (18:29 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 31 May 2015 17:29:51 +0000 (18:29 +0100)
Kernel/bank16k.c
Kernel/bank16k_low.c
Kernel/bank32k.c
Kernel/bankfixed.c
Kernel/include/kernel.h
Kernel/start.c
Kernel/syscall_exec16.c
Library/include/proc.h

index 6d78024..c7f7e31 100644 (file)
@@ -75,13 +75,12 @@ static int maps_needed(uint16_t top)
  *     We have a hackish fix for init that would be nice
  *     resolve.
  *
- *     FIXME: we need to move udata.u_top into p-> in order to
- *     support banked swapping.
+ *     Use p-> not udata. The udata is not yet swapped in!
  */
 int pagemap_alloc(ptptr p)
 {
        uint8_t *ptr = (uint8_t *) & p->p_page;
-       int needed = maps_needed(udata.u_top);
+       int needed = maps_needed(p->p_top);
        int i;
 
 #ifdef SWAPDEV
@@ -164,6 +163,8 @@ uint16_t pagemap_mem_used(void)
  *     Swap out the memory of a process to make room
  *     for something else. For bank16k do this as four operations
  *     ready for when we pass page values not processes to the drivers
+ *
+ *     FIXME: bank16k should only read/write out the banks that are in use
  */
 
 int swapout(ptptr p)
@@ -210,6 +211,8 @@ int swapout(ptptr p)
 
 /*
  * Swap ourself in: must be on the swap stack when we do this
+ *
+ * FIXME: bank16k should only read/write out the banks that are in use
  */
 void swapin(ptptr p, uint16_t map)
 {
index 57255ba..0798f88 100644 (file)
@@ -81,7 +81,7 @@ static int maps_needed(uint16_t top)
 int pagemap_alloc(ptptr p)
 {
        uint8_t *ptr = (uint8_t *) & p->p_page;
-       int needed = maps_needed(udata.u_top);
+       int needed = maps_needed(p->p_top);
        int i;
 
 #ifdef SWAPDEV
index 34d7072..086c342 100644 (file)
@@ -87,7 +87,7 @@ static int maps_needed(uint16_t top)
 int pagemap_alloc(ptptr p)
 {
        uint8_t *ptr = (uint8_t *) & p->p_page;
-       int needed = maps_needed(udata.u_top);
+       int needed = maps_needed(p->p_top);
 
 #ifdef SWAPDEV
        /* Throw our toys out of our pram until we have enough room */
index a0fa6f1..5552afe 100644 (file)
@@ -85,6 +85,9 @@ uint16_t pagemap_mem_used(void)
 /*
  *     Swap out the memory of a process to make room
  *     for something else
+ *
+ *     FIXME: we can write out base - p_top, then the udata providing
+ *     we also modify our read logic here as well
  */
 int swapout(ptptr p)
 {
index 7aa6611..22c2488 100644 (file)
@@ -353,6 +353,7 @@ typedef struct p_tab {
 /**HP**/
     uint16_t   p_pgrp;         /* Process group */
     uint8_t    p_nice;
+    usize_t    p_top;          /* Copy of u_top */
 #ifdef CONFIG_PROFIL
     uint8_t    p_profscale;
     void *     p_profbuf;
index b49043e..d80f484 100644 (file)
@@ -67,6 +67,7 @@ void create_init(void)
        init_process = ptab_alloc();
        udata.u_ptab = init_process;
        udata.u_top = PROGLOAD + 4096;  /* Plenty for the boot */
+       init_process->p_top = udata.u_top;
        map_init();
        newproc(init_process);
 
index 603c634..a1d42ad 100644 (file)
@@ -154,6 +154,7 @@ arg_t _execve(void)
 
        /* From this point on we are commmited to the exec() completing */
        udata.u_top = top;
+       udata.u_ptab->p_top = top;
 
        /* setuid, setgid if executable requires it */
        if (ino->c_node.i_mode & SET_UID)
index 7bc36d3..9b8408b 100644 (file)
@@ -47,6 +47,7 @@ typedef struct p_tab {
 /**HP**/
     uint16_t    p_pgrp;         /* Process group */
     uint8_t     p_nice;
+    uint16_t   p_top;          /* Copy of u_top : FIXME: usize_t */
 #ifdef CONFIG_PROFIL
     uint8_t     p_profscale;
     void *      p_profbuf;