swap: allow offet 0 to be used for swap
authorAlan Cox <alan@linux.intel.com>
Wed, 20 Feb 2019 22:30:48 +0000 (22:30 +0000)
committerAlan Cox <alan@linux.intel.com>
Wed, 20 Feb 2019 22:30:48 +0000 (22:30 +0000)
Don't make it the default because some platforms use swap slot 0 for other things

Kernel/bank16k.c
Kernel/bank16k_low.c
Kernel/bank65c816.c
Kernel/bank8k.c
Kernel/bankfixed.c
Kernel/simple.c
Kernel/swap.c

index 096986d..a218ca4 100644 (file)
@@ -229,7 +229,7 @@ int swapout(ptptr p)
 {
        uint16_t page = p->p_page;
        uint16_t blk;
-       uint16_t map;
+       int16_t map;
        uint16_t base = SWAPBASE;
        uint16_t size = (0x4000 - SWAPBASE) >> 9;
        uint16_t i;
@@ -243,7 +243,7 @@ int swapout(ptptr p)
 
        /* Are we out of swap ? */
        map = swapmap_alloc();
-       if (map == 0)
+       if (map == -1)
                return ENOMEM;
        blk = map * SWAP_SIZE;
        /* Write the app (and possibly the uarea etc..) to disk */
index 6023f26..84375c5 100644 (file)
@@ -174,7 +174,7 @@ int swapout(ptptr p)
 {
        uint16_t page = p->p_page;
        uint16_t blk;
-       uint16_t map;
+       int16_t map;
        uint16_t base = SWAPBASE;
        uint16_t size = (0x4000 - SWAPBASE) >> 9;
        uint8_t *pt = (uint8_t *)&p->page;
@@ -187,7 +187,7 @@ int swapout(ptptr p)
 
        /* Are we out of swap ? */
        map = swapmap_alloc();
-       if (map == 0)
+       if (map == -1)
                return ENOMEM;
        blk = map * SWAP_SIZE;
 
index e15af86..7e0683b 100644 (file)
@@ -85,7 +85,7 @@ int swapout(ptptr p)
 {
        uint16_t page = p->p_page;
        uint16_t blk;
-       uint16_t map;
+       int16_t map;
 
        if (!page)
                panic(PANIC_ALREADYSWAP);
@@ -94,7 +94,7 @@ int swapout(ptptr p)
 #endif
        /* Are we out of swap ? */
        map = swapmap_alloc();
-       if (map == 0)
+       if (map == -1)
                return ENOMEM;
        blk = map * SWAP_SIZE;
        /* Write the user CPU stack and DP to disk */
index 11834b7..b4a0cb2 100644 (file)
@@ -276,7 +276,7 @@ int swapout(ptptr p)
 {
        uint16_t page = p->p_page;
        uint16_t blk;
-       uint16_t map;
+       int16_t map;
        uint16_t base = SWAPBASE;
        uint16_t size = (0x2000 - SWAPBASE) >> 9;
        uint8_t i;
@@ -293,7 +293,7 @@ int swapout(ptptr p)
 
        /* Are we out of swap ? */
        map = swapmap_alloc();
-       if (map == 0)
+       if (map == -1)
                return ENOMEM;
        blk = map * SWAP_SIZE;
        /* Write the app (and possibly the uarea etc..) to disk */
index bafe065..f487f51 100644 (file)
@@ -92,13 +92,13 @@ int swapout(ptptr p)
 {
        uint16_t page = p->p_page;
        uint16_t blk;
-       uint16_t map;
+       int16_t map;
 
        if (!page)
                panic(PANIC_ALREADYSWAP);
        /* Are we out of swap ? */
        map = swapmap_alloc();
-       if (map == 0)
+       if (map == -1)
                return ENOMEM;
 #ifdef DEBUG
        kprintf("Swapping out %x (%d) to map %d\n", p, p->p_page, map);
index e3562a2..9b5afa6 100644 (file)
@@ -70,7 +70,7 @@ int swapout_new(ptptr p, void *u)
 {
        uint16_t page = p->p_page;
        uint16_t blk;
-       uint16_t map;
+       int16_t map;
 
 #ifdef DEBUG
        kprintf("Swapping out %x (%d)\n", p, p->p_pid);
@@ -79,7 +79,7 @@ int swapout_new(ptptr p, void *u)
                panic(PANIC_ALREADYSWAP);
        /* Are we out of swap ? */
        map = swapmap_alloc();
-       if (map == 0)
+       if (map == -1)
                return ENOMEM;
        blk = map * SWAP_SIZE;
        /* Write the app (and uarea etc..) to disk */
index 3b3bca0..3d0b9d1 100644 (file)
@@ -39,7 +39,7 @@ int swapmap_alloc(void)
                 return swapmap[--swapptr];
        }
         else
-                return 0;
+                return -1;
 }
 
 void swapmap_init(uint8_t swap)