Comments
Loading Dream Comments...
You must be logged in to write a comment - Log In
::SHE:: is called with a SEGID between 0 to 65535 in BX, and a FBI (Fundamental Buffer Interface) function code in AX. If we aren't already in protected mode, we set up the GDT etc. and use the selector which points to the page table to get the physical RAM address of the in-RAM page frame. If it is non NULL we update the LRU chain (so we know which page to swap out if necessary) and return the address of the RAM page frame in ES:BX. If were were in real mode, we switch back to real mode, if in protected mode we just return. Exception : If AX contained a FBI op (such as "insert" or "extract") we may do a "quicky garbage collect" on the page frame before returning.
If the page table entry was NULL, we must swap-in the page from the secondary master HDD (device $81). Currently the entire HDD is dedicated to ::SHE:: (so look out if you've FDISK'ed it) and is conceptually divided into pages each of 32KB, addressed by LBA. We scan the LRU chain looking for a page to checkpoint to disk, update the LRU chain, and read the SEGID'th page from disk into its RAM page frame. (At the moment we can have 65535 * 32K = 2^31 = 2 GB of content in the datastore.) Note that access to the swapfile is mutexed in order to avoid trashing the disk if more than one instance of ::SHE:: is running. Also we may temporarily switch into real mode if we are accessing the HDD via the BIOS. Check the original C++ source for more info (look for the very small Sheila plushie on the floor).