13.07.2015 Views

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

VIRTUAL MEMORYthose segments that are bootloaded are just the segments that should not be swapped out. Other operatingsystems may allocate many segments dynamically: stacks, mailboxes, variable-length arrays, etc.These systems may need both approaches.In designing a dynamic swap-space allocation scheme, you should consider at what time it is best toallocate swap space. The procedure that first allocates RAM space for a segment (a loader, for example)often creates a writable data segment descriptor. Later, when the procedure has initialized the segment(for example, by writing descriptors into a segment that is to be used as an LDT), it modifies the typecode in the descriptor to reflect the intended use of the segment (in this example, it would change thetype to LDT). By delaying the allocation of swap space until first swap out, the operating system neverallocates swap space for segments that it never swaps out (there is no need to allocate swap space foran LDT, for example, if the operating system does not support swapping of LDTs).Once the operating system allocates swap space for a segment, it must store the swap-space address ina location that is easily accessible when it is time to swap the segment out. Two possible mechanismsfor storing the swap-space address are• In a boundary tag of the segment, if boundary tags are used. (Refer to Chapter 3 for an exampleof a space-management scheme that uses boundary tags.)• In a table parallel to the descriptor table.To determine whether to call the swap-space allocation procedure when it is time to swap a segmentout, the operating system can test whether the swap-space address field contains a null value.When a segment is not present, the operating system can use the 24-bit base-address field in the segmentdescriptor to store the address of the swap space in which the segment is stored. As long as the presentbit of a descriptor is reset, the processor does not use the base-address field. Storing the swap-spaceaddress in the descriptor also makes the swap-space address readily accessible to the "not-present" traphandler because the error code presented to the trap handler contains a selector to the descriptor forthe not-present segment.Level Zero Support ProceduresWhile the swapping procedures are I/O procedures that should run at privilege levels greater thanzero, protection of the system demands that highly privileged procedures carry out some details of theswapping process. Only privilege-level 0 (PL-O) procedures have the right to perform such activities as• Create read-data or write-data alias descriptors with which the swappers can access the segmentsthey are operating on• Change the present bit in a descriptor• Overwrite the base-address field of a descriptor• Prevent the swapper from operating on segments that must remain RAM-resident• Update all the alias descriptors for a segment with its new statusThe following checklist identifies some of those segments that should remain permanently in RAM (inyour application, there may be others):• The GDT. (It is the key to all addressing operations.)• LDTs that refer to present segments. (The processor cannot access an LDT segment without fetchingits descriptor from the LDT.)9-3 121960-001

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!