protected_mode()

Updated: April 19, 2023

Switches the x86 processor to protected mode (non-BIOS systems)

Description:

This assembly call switches the x86 processor to protected mode. It is for non-BIOS systems only. The code is designed to be completely position-independent.

This call must be called with a pointer to a 16-byte area of memory that's used to store the Global Descriptor Table (GDT). This pointer is in ds:ax.

When this call returns, the DS and ES registers will have been set to selectors that can access the entire 4 GB address space. The following selectors are defined:

8
Data selector for 0-4 GB.
16
Code selector for 0-4 GB.