You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			37 lines
		
	
	
		
			964 B
		
	
	
	
		
			C++
		
	
			
		
		
	
	
			37 lines
		
	
	
		
			964 B
		
	
	
	
		
			C++
		
	
| #include "gdt.h"
 | |
| 
 | |
| #include "core.h"
 | |
| 
 | |
| namespace GDT {
 | |
| 
 | |
| // The static 32-bit Global Descriptor Table (GDT)
 | |
| alignas(16) constinit SegmentDescriptor protected_mode[] = {
 | |
|     // Null descriptor
 | |
|     {},
 | |
| 
 | |
|     // Global code segment von 0-4GB
 | |
|     SegmentDescriptor::Segment(0, UINT32_MAX, true, 0, SIZE_32BIT),
 | |
| 
 | |
|     // Global data segment von 0-4GB
 | |
|     SegmentDescriptor::Segment(0, UINT32_MAX, false, 0, SIZE_32BIT),
 | |
| };
 | |
| extern "C" constexpr Pointer gdt_protected_mode_pointer(protected_mode);
 | |
| 
 | |
| // The static 64-bit Global Descriptor Table (GDT)
 | |
| // \see [ISDMv3 3.2.4 Segmentation in IA-32e
 | |
| // Mode](intel_manual_vol3.pdf#page=91)
 | |
| alignas(16) constinit SegmentDescriptor long_mode[] = {
 | |
|     // Null descriptor
 | |
|     SegmentDescriptor::Null(),
 | |
| 
 | |
|     // Global code segment
 | |
|     SegmentDescriptor::Segment64(true, 0),
 | |
| 
 | |
|     // Global data segment
 | |
|     SegmentDescriptor::Segment64(false, 0),
 | |
| 
 | |
| };
 | |
| extern "C" constexpr Pointer gdt_long_mode_pointer(long_mode);
 | |
| 
 | |
| }  // namespace GDT
 |