/* * Swap ourself in: must be on the swap stack when we do this */ static void swapin(ptptr p) { uint16_t blk = p->p_page2 * SWAP_SIZE; #ifdef UDATA_SWAPSIZE uint8_t *ptr; #endif #ifdef DEBUG kprintf("Swapin %x, %d\n", p, p->p_page); #endif if (!p->p_page) { kprintf("%x: nopage!\n", p); return; } /* Return our swap */ swapmap[swapptr++] = p->p_page2; swapproc = p; /* always ourself */ swapread(SWAPDEV, blk + UDATA_BLOCKS, SWAPTOP - SWAPBASE, SWAPBASE); #ifdef UDATA_SWAPSIZE ptr = swapin_prepare_uarea(p); if (ptr) swapread(SWAPDEV, blk, UDATA_SWAPSIZE, (uint8_t *) &udata); #endif #ifdef DEBUG kprintf("%x: swapin done %d\n", p, p->p_page); #endif }
/* * Swap ourself in: must be on the swap stack when we do this. We always * do the swap in to the non exchange bank, as we know we will be running * next. */ void swapin(ptptr p, uint16_t map) { uint16_t blk = map * SWAP_SIZE; #ifdef DEBUG kprintf("Swapin %x, %d\n", p, p->p_page); #endif if (!p->p_page) { kprintf("%x: nopage!\n", p); return; } /* Does another process own the low page. If so we need to copy it over (we don't want to load and exchange as the exchange is slower than a copy then loading */ if (low_bank != NULL) { kprintf("Low page owned by %x\n", low_bank); dup_low_page(); } /* Load the upper 16K back in including the udata cache */ swapread(SWAPDEV, blk, 0x4000, 0xC000, p->p_page); /* Load the lower 16K either into the main lower bank (page 2) */ swapread(SWAPDEV, blk + 0x20, 0x4000, 0xC000, 2); /* We now own the low page */ low_bank = p; #ifdef DEBUG kprintf("%x: swapin done %d\n", p, p->p_page); #endif }
/* * Swap ourself in: must be on the swap stack when we do this */ void swapin(ptptr p, uint16_t map) { uint16_t blk = map * SWAP_SIZE; uint16_t base = SWAPBASE; uint16_t size = (0x4000 - SWAPBASE) >> 9; uint16_t i; uint8_t *pt = (uint8_t *)&p->p_page; #ifdef DEBUG kprintf("Swapin %x, %d\n", p, p->p_page); #endif if (!p->p_page) { kprintf("%x: nopage!\n", p); return; } for (i = 0; i < 4; i ++) { swapread(SWAPDEV, blk, size, base, *pt++); base += 0x4000; /* Last bank is determined by SWAP SIZE. We do the maths in 512's (0x60 = 0xC000) */ if (i == 3) size = SWAP_SIZE - 0x60; else size = 0x20; /* 16 K */ } #ifdef DEBUG kprintf("%x: swapin done %d\n", p, p->p_page); #endif }
/* * Swap ourself in: must be on the swap stack when we do this */ void swapin(ptptr p, uint16_t map) { uint16_t blk = map * SWAP_SIZE; uint16_t base = SWAPBASE; uint16_t size = (0x4000 - SWAPBASE) >> 9; uint16_t i; uint8_t *pt = (uint8_t *)&p->page; #ifdef DEBUG kprintf("Swapin %x, %d\n", p, p->p_page); #endif if (!p->p_page) { kprintf("%x: nopage!\n", p); return; } /* This may need other tweaks as its a special nasty case where we don't want to overwrite the live stack but buffer and fix up in tricks.s */ #ifdef CONFIG_HAS_LOW_PAGE swapread(SWAPDEV, blk, 1, 0x0000); blk++; #endif for (i = 0; i < 4; i ++) { swapread(SWAPDEV, blk, size, base, *pt++); base += 0x4000; /* Last bank is determined by SWAP SIZE. We do the maths in 512's (0x60 = 0xC000) */ if (i == 3) size = SWAP_SIZE_EXCL_ZP - 0x60; else size = 0x20; /* 16 K */ } #ifdef DEBUG kprintf("%x: swapin done %d\n", p, p->p_page); #endif }