From ad56eb28f0614db4b7656ade390f1c79b446cbc9 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 10 Jul 2021 15:51:54 +0200 Subject: A20, E820h, Real Mode Emulation --- src/loader/gdt.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/loader/gdt.c (limited to 'src/loader/gdt.c') diff --git a/src/loader/gdt.c b/src/loader/gdt.c new file mode 100644 index 0000000..853b793 --- /dev/null +++ b/src/loader/gdt.c @@ -0,0 +1,49 @@ +// MIT License, Copyright (c) 2021 Marvin Borner + +#include + +static struct gdt_desc gdt_descs[] = { { 0 }, + + { .limit = 0xffff, + .base_low = 0x0000, + .base_mid = 0x00, + .access = 0x9a, + .granularity = 0x00, + .base_hi = 0x00 }, + + { .limit = 0xffff, + .base_low = 0x0000, + .base_mid = 0x00, + .access = 0x92, + .granularity = 0x00, + .base_hi = 0x00 }, + + { .limit = 0xffff, + .base_low = 0x0000, + .base_mid = 0x00, + .access = 0x9a, + .granularity = 0xcf, + .base_hi = 0x00 }, + + { .limit = 0xffff, + .base_low = 0x0000, + .base_mid = 0x00, + .access = 0x92, + .granularity = 0xcf, + .base_hi = 0x00 }, + + { .limit = 0x0000, + .base_low = 0x0000, + .base_mid = 0x00, + .access = 0x9a, + .granularity = 0x20, + .base_hi = 0x00 }, + + { .limit = 0x0000, + .base_low = 0x0000, + .base_mid = 0x00, + .access = 0x92, + .granularity = 0x00, + .base_hi = 0x00 } }; + +REAL struct gdtr gdt = { sizeof(gdt_descs) - 1, (u32)gdt_descs, 0 }; -- cgit v1.2.3