-
Notifications
You must be signed in to change notification settings - Fork 1
HalGenerateGDTDesc
This function generates a valid GDT descriptor structure for later use
gdt_descriptor HalGenerateGDTDesc(dword baseAddress,
dword segmentLimit,
gdtflags gdtFlags
);
baseAddress
Base address of the descriptor
segmentLimit
The ammount of memory the decriptor covers
!WARNING! Only first 28 bytes of this value are used ! If you want to use a value larger then 0x0FFFFFFF, specify gdt_granularity
in gdtFlags (see gdtFlags)
gdtFlags
The bitflags used for the descriptor
gdt_accessBit
Do not specify this flag, it's meant for internal CPU usage.
gdt_isDescriptorWriteable
Data descriptors: If this flag is set, the descriptor is read/write. Otherwise, it's read-only.
Code descriptors: If this flag is set, the descriptor is readable. Otherwise, it isn't.
gdt_expandDown
If this flag is set, the descriptor expands downwards (eg. for use as a stack descriptor). Otherwise, the descriptor expands upwards. Only valid for data descriptors, it is treated as gdt_isConforming
on code descriptors.
gdt_isConforming
If this flag is set, lower privilege levels then specified can use this selector, eg if gdt_ring2
is specified, the selector will be accessible from rings 3 and 2 only. If not, it is only accessible from the specified ring. Only valid for code descriptors, it is treated as gdt_expandDown
on data descriptors.
gdt_isExecutable
If gdt_isCodeOrDataDescriptor
is set: If this flag is set, the descriptor is a code descriptor. Otherwise it's a data descriptor.
If gdt_isCodeOrDataDescriptor
is not set: If this flag is set, the descriptor is executable. Otherwsie, it isn't.
gdt_ring0
This flag specifies the descriptor is accessible from ring 0. Not valid with gdt_ring1
, gdt_ring2
or gdt_ring3
gdt_ring1
This flag specifies the descriptor is accessible from ring 1. Not valid with gdt_ring0
, gdt_ring2
or gdt_ring3
gdt_ring2
This flag specifies the descriptor is accessible from ring 2. Not valid with gdt_ring0
, gdt_ring1
or gdt_ring3
gdt_ring3
This flag specifies the descriptor is accessible from ring 3. Not valid with gdt_ring0
, gdt_ring1
or gdt_ring2
gdt_segmentIsInMemory
This flag must be set, otherwise the descriptor is disabled and ignored.
gdt_reservedOSUse
This flag is reserved for OS use. Do not specify this flag.
gdt_segmentIs32Bit
If this flag is set, the descirptor is a 32 bit descriptor. Otherwise it's a 16 bit descriptor.
gdt_granularity
If this flag is set, segmentLimit
is multiplied by 4096 (4k, the size of a page)
This function always returns a GDT descriptor structure.
Roadmap:
- Stage 1 FAT12 bootloader
- Stage 2 bootloader (SOARELDR)
- Hardware Abstraction Layer
- GDT and IDT abstraction
- Memory manager
- Disk IO
- PE Loader
- Convert HAL to be a module
- Keyboard IO