Next: Bibliography
Up: 80386 Memory Mangament
Previous: Segment descriptors
Some assembler macros are defined in sched.h and system.h to ease access
and setting of descriptors. Each TSS entry and LDT entry takes 8 bytes.
Manipulating GDT system descriptors:
- _TSS(n),
_LDT(n) These provide the index into the GDT for the n'th task. - _LDT(n) is stored in the the ldt field of the
tss_struct by fork.
- _set_tssldt_desc(n, addr, limit, type)
ulong *n points to the GDT entry to set (see fork.c).
The segment base (TSS or LDT) is set to 0xc0000000 + addr.
Specific instances of the above are, where ltype refers to the byte
containing P, DPL, S and type:
- load_TR(n),
load_ldt(n) load descriptors for task
number n into the task register and ldt register. - ulong get_base (struct desc_struct ldt) gets the base
from a descriptor.
- ulong get_limit (ulong segment)
gets the limit (size) from a segment selector.
Returns the size of the segment in bytes.
- set_base(struct desc_struct ldt, ulong base),
set_limit(struct desc_struct ldt, ulong limit)
Will set the base and limit for descriptors (4K granular segments).
The limit here is actually the size in bytes of the segment. - _set_seg_desc(gate_addr, type, dpl, base, limit)
Default values 0x00408000 => D=1, P=1, G=0
Present, operation size is 32 bit and max size is 1M.
gate_addr must be a (ulong *)
Converted on:
Mon Apr 1 10:20:16 EST 1996