gdt: Allocate GDT on the heap on UEFI
This commit is contained in:
parent
6c7fa6924a
commit
eea96cda9c
|
@ -8,6 +8,7 @@
|
|||
#include <sys/e820.h>
|
||||
#include <sys/a20.h>
|
||||
#include <sys/idt.h>
|
||||
#include <sys/gdt.h>
|
||||
#include <lib/print.h>
|
||||
#include <fs/file.h>
|
||||
#include <lib/elf.h>
|
||||
|
@ -67,6 +68,8 @@ void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
|
|||
|
||||
init_memmap();
|
||||
|
||||
init_gdt();
|
||||
|
||||
disk_create_index();
|
||||
|
||||
boot_volume = NULL;
|
||||
|
|
|
@ -24,4 +24,6 @@ struct gdt_desc {
|
|||
|
||||
extern struct gdtr gdt;
|
||||
|
||||
void init_gdt(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include <stdint.h>
|
||||
#include <sys/gdt.h>
|
||||
#include <mm/pmm.h>
|
||||
#include <lib/libc.h>
|
||||
|
||||
static struct gdt_desc gdt_descs[] = {
|
||||
{0},
|
||||
|
@ -69,3 +71,11 @@ struct gdtr gdt = {
|
|||
0
|
||||
#endif
|
||||
};
|
||||
|
||||
#if uefi == 1
|
||||
void init_gdt(void) {
|
||||
struct gdt_desc *gdt_copy = ext_mem_alloc(sizeof(gdt_descs));
|
||||
memcpy(gdt_copy, gdt_descs, sizeof(gdt_descs));
|
||||
gdt.ptr = (uintptr_t)gdt_copy;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue