On Time RTOS-32 Documentation
Welcome
RTTarget-32
RTTarget-32 Programming Manual
Introduction
Running Win32 Programs without Win32
The i386 Microprocessor
Real Address Mode
Virtual 8086 Mode
Protected Mode
16-Bit Protected Mode
32-Bit Protected Mode
Descriptors and Descriptor Tables
Privilege Levels
Paging
Virtual, Linear, and Physical Addresses
Exceptions and Interrupts
RTLoc: Locating a Program
Running a Program on the Target
Cross Debugging
Using an IDE
The RTTarget-32 API
Demo Programs
Advanced Topics
Compiling and Linking with On Time RTOS-32
Redistributable Components of RTTarget-32
RTLoc Error Messages
RTTarget-32 Reference Manual
RTKernel-32
RTFiles-32
RTIP-32
RTPEG-32
RTUSB-32
|
Descriptors and Descriptor Tables
The 386 maintains three different descriptor tables: the Global Descriptor Table (GDT), the Local Descriptor Table (LDT), and the Interrupt Descriptor Table (IDT). The IDT can hold up to 256 interrupt, trap, or task gates; GDT and LDT can hold up to 8191 descriptors each. Most GDT and LDT entries hold segment descriptors, although other descriptors (gates, TSS, etc.) are possible. Among other things, a segment descriptor contains the following information:
- the linear start address of the segment (the Base)
- the size of the segment (the Limit)
- the descriptor privilege level (the DPL)
- execute, read only, or read/write access permission
The main purpose of the IDT is to hold Interrupt or Trap Gates. Basically, these gates simply point to the entrypoint of an interrupt service routine.
RTTarget-32 manages a GDT with a total of 16 descriptors. The following table summarizes the properties of RTTarget-32's GDT descriptors:
Index |
Selector |
DPL |
Description |
0h |
0h |
- |
Reserved by Intel (NULL selector) |
1h |
8h |
0 |
Ring 0 code segment |
2h |
10h |
0 |
Ring 0 data segment |
3h |
1Bh |
3 |
Ring 3 code segment |
4h |
23h |
3 |
Ring 3 data segment |
5h |
28h |
0 |
Boot CPU TSS |
6h |
30h |
0 |
Reserved for RTKernel-32 (LDT) |
7h |
3Bh |
3 |
Callgate to call Ring 0 from Ring 3 |
8h |
40h |
3 |
BIOS Data Segment (Base == 400h) |
9h |
4Bh |
3 |
Win32 main thread TEB segment |
Ah |
50h | CPL1 |
CPL |
16-bit call stub segment2 |
Bh |
5Bh |
3 |
16-bit data stub segment12 |
Ch |
60h | CPL1 |
CPL |
16-bit PnP BIOS code segment12 |
Dh |
6Bh |
3 |
16-bit PnP BIOS data segment12 |
Eh |
70h |
0 |
Application Processor TSS |
Fh |
7Bh |
3 |
Reserved for MetaWINDOW |
RTTarget-32's IDT has 256 entries as follows:
Index |
Description |
0h - 1Fh |
CPU Exceptions |
20h |
Reserved |
21h |
DOS Emulation |
22h - 30h |
Reserved |
31h |
DPMI Emulation |
32h - 3Fh |
Reserved |
40h - 4Fh |
IRQ 0..15 |
50h - 5Fh |
IRQ 16..31 (APIC Mode) |
60h |
RTTarget-32 Boot Code API |
61h |
RTTarget-32 Program Terminate |
64h - 6Ch |
Reserved by RTTarget-32 |
6Dh - 6Eh |
Reserved by RTTarget-32 Debug Monitor |
6Fh |
Reserved by RTTarget-32 (Boot Code Data Base) |
70h - 7Fh |
Free for Application Use |
80h - DFh |
Reserved |
E0h - FAh |
IRQ 0..26 (under RTOS32Win) |
FBh |
RTKernel-32 MP-IPIs |
FCh |
RTTarget-32 MP-IPIs |
By default, RTTarget-32 does not maintain an LDT (but RTKernel-32 does).
Protected Mode
32-Bit Protected Mode
Privilege Levels
|