Files
Espresso/include/gdt.h
2025-05-28 14:41:02 -05:00

24 lines
691 B
C

#ifndef _GDT_H
#define _GDT_H
#include <stdint.h>
struct gdt_entry {
uint16_t limit_low; /* Lower 16 bits of limit */
uint16_t base_low; /* Lower 16 bits of base */
uint8_t base_middle; /* Next 8 bits of base */
uint8_t access; /* Access flags */
uint8_t granularity; /* Granularity + high 4 bits of limit */
uint8_t base_high; /* Last 8 bits of base */
} __attribute__((packed));
struct gdt_ptr {
uint16_t limit; /* Size of GDT - 1 */
uint32_t base; /* Base address of GDT */
} __attribute__((packed));
void gdt_install();
void gdt_set_entry(int num, uint32_t base, uint32_t limit, uint8_t access, uint8_t gran);
#endif