80x86 16-bit Real Mode Port

This port facilitates the deployment of Sirius RTOS and other products on all compatible processors and microcontrollers within the 80x86 family.

Source files

The following table lists the port files associated with this architecture:

File nameExtensionDescription
AR_APIHPort API File
AR_TypesHType declarations for 16-bit x86 architectures
AR_x86RMCPort source file
AR_x86RMaASMPort assembly file

General description

The Programmable Interval Timer (PIT) is utilized to implement preemption. It is configured for a one-millisecond interval by default. This port uses the user timer interrupt (0x1C) for the operating system scheduler. The default interrupt service routine is hooked during the arInit function call and restored by arDeinit.

The arLock and arRestore functions manage preemption disabling and re-enabling by modifying the interrupt enable flag within the flags register.

The arYield function performs a context switch without utilizing an additional software interrupt.

The arGetTickCount function utilizes the BIOS tick counter located at memory address 0040:006C to provide system time, configured for a one-millisecond resolution.

When the operating system invokes the port-specific arSetPreemptiveHandler function, a new stack and task context are allocated for the operating system scheduler.

Most early 80x86 processors do not support specific power-saving modes; consequently, the body of the arSavePower function is empty. Power-saving modes are available in succeeding processor generations (e.g., i386).

Task context

The task context contains all information required to resume the execution of an interrupted task. The table below details the 26-byte task context structure for 80x86 processors:

OffsetSizeDescription
00002Flags register
00024Task startup procedure (CS:IP registers)
00062AX register
00082CX register
000A2DX register
000C2BX register
000E2SP register
00102BP register
00122SI register
00142DI register
00162DS register
00182ES register

SpaceShadow documentation