On Time RTOS-32 Documentation
Welcome
RTTarget-32
RTTarget-32 Programming Manual
Introduction
Running Win32 Programs without Win32
The i386 Microprocessor
RTLoc: Locating a Program
Running a Program on the Target
Cross Debugging
Using an IDE
The RTTarget-32 API
Demo Programs
Advanced Topics
Choosing a Locate Method
Running with or without Paging
Running at CPL 0 or 3
Installing Hardware Interrupt Handlers
Catching NULL Pointer Assignments
Catching Stack Overflows
Running without Run-Time System
Avoid Repeated Downloads
Configuration for Debug and Release Builds
Using Data Compression
Using DLLs through RTLoc
Loading DLLs through a File System
RAM File System
Installable File System
Multithread Applications
Using the MetaWINDOW Graphics Library
Using the 387 Emulator
Using Non-Volatile Memory
APIC Mode
Multiprocessor Applications
Custom MP Floating Pointer Structure
RTVmf-32
RTRth-32
Performance Optimizations
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
|
Running at CPL 0 or 3
Similar to paging, selecting the program's privilege level (CPL) is a trade-off between maximum protection and performance.
Advantages of Privilege Level 3
- Maximum page level protection. At CPL 3, the CPU distinguishes four different access rights for memory pages. System data structures can be completely protected. AT CPL 0, the CPU allows read and write access to all pages actually mapped to memory. For example, there is no protection against corruption of the system tables or the code segment.
Advantages of Privilege Level 0
- The program can execute privileged instructions (CLTS, HLT, LGDT, LIDT, LLDT, LMSW, LTR, MOV to/from CR0/DRn/TRn). While most privileged instructions have little value for application programs, HLT can be useful. Multitasking systems such as RTKernel-32 can execute HLT in their idle task. Any program that waits for an interrupt can call function RTHalt, which executes HLT. While in the HLT state, the CPU consumes only a small fraction of the power it would need otherwise. Note that function RTHaltCPL3 can be employed to execute Halt while running at CPL 3. Other privileged instructions can be executed indirectly through function RTCallRing0.
- Lower interrupt latency. Some functions of RTTarget-32's native API are handled by the boot code and accessed through a software interrupt. To guarantee proper interrupt processing, the boot code executes with interrupts disabled if called from CPL 3, but with interrupts enabled if called from CPL 0. The effect on the interrupt latency depends on which functions of RTTarget-32's boot API are actually used. There is no penalty for applications that do not use it.
CPL 3 is generally recommended.
Advanced Topics
Running with or without Paging
Installing Hardware Interrupt Handlers
|