Don't make it the default because some platforms use swap slot 0 for other things
{
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;
/* 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 */
{
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;
/* Are we out of swap ? */
map = swapmap_alloc();
- if (map == 0)
+ if (map == -1)
return ENOMEM;
blk = map * SWAP_SIZE;
{
uint16_t page = p->p_page;
uint16_t blk;
- uint16_t map;
+ int16_t map;
if (!page)
panic(PANIC_ALREADYSWAP);
#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 */
{
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;
/* 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 */
{
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);
{
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);
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 */
return swapmap[--swapptr];
}
else
- return 0;
+ return -1;
}
void swapmap_init(uint8_t swap)