32 lines
669 B
C
32 lines
669 B
C
/*
|
|
* @author xamidev <xamidev@riseup.net>
|
|
* @brief Global Descriptor Table (for legacy reasons)
|
|
* @license GPL-3.0-only
|
|
*/
|
|
|
|
#ifndef GDT_H
|
|
#define GDT_H
|
|
|
|
#include <stdint.h>
|
|
|
|
// We're using the GDT for segmentation, but as we want to target Long Mode,
|
|
// we'll only use this as a requirement for paging, not more.
|
|
// This means base 0 and no limit (whole address space)
|
|
|
|
#define NUM_GDT_ENTRIES 5
|
|
|
|
#define NULL_SELECTOR 0x00
|
|
#define KERNEL_CODE_SEGMENT 0x08
|
|
#define KERNEL_DATA_SEGMENT 0x10
|
|
#define USER_CODE_SEGMENT 0x18
|
|
#define USER_DATA_SEGMENT 0x20
|
|
|
|
struct GDTR
|
|
{
|
|
uint16_t limit;
|
|
uint64_t address;
|
|
} __attribute__((packed));
|
|
|
|
void gdt_init();
|
|
|
|
#endif |