rulimine/common/sys/gdt.h

30 lines
479 B
C
Raw Normal View History

#ifndef __SYS__GDT_H__
#define __SYS__GDT_H__
#include <stdint.h>
struct gdtr {
2021-03-07 08:50:04 +03:00
uint16_t limit;
2021-07-20 14:35:43 +03:00
#if defined (__x86_64__)
2021-03-07 08:50:04 +03:00
uint64_t ptr;
2021-07-20 14:35:43 +03:00
#elif defined (__i386__)
2021-03-08 02:50:23 +03:00
uint32_t ptr;
uint32_t ptr_hi;
2021-03-08 02:50:23 +03:00
#endif
} __attribute__((packed));
struct gdt_desc {
uint16_t limit;
uint16_t base_low;
uint8_t base_mid;
uint8_t access;
uint8_t granularity;
uint8_t base_hi;
} __attribute__((packed));
extern struct gdtr gdt;
2021-11-25 23:51:41 +03:00
void init_gdt(void);
#endif