diff options
author | Marvin Borner | 2021-07-10 15:51:54 +0200 |
---|---|---|
committer | Marvin Borner | 2021-07-10 15:51:54 +0200 |
commit | ad56eb28f0614db4b7656ade390f1c79b446cbc9 (patch) | |
tree | 7d42ab3c9f36c188dbf54a25b1db1c3db5acb1bd /src/loader/gdt.c | |
parent | 176b6eb808f4d02d871c30f6ec19daa179f374d1 (diff) |
A20, E820h, Real Mode Emulation
Diffstat (limited to 'src/loader/gdt.c')
-rw-r--r-- | src/loader/gdt.c | 49 |
1 files changed, 49 insertions, 0 deletions
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 <gdt.h> + +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 }; |