From 5ee08673199299769549f996a83c326c833801dc Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 9 Jul 2021 16:07:29 +0200 Subject: fix the r0 data segment --- kernel/gdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'kernel/gdt.c') diff --git a/kernel/gdt.c b/kernel/gdt.c index eaf81ba..c564f5f 100644 --- a/kernel/gdt.c +++ b/kernel/gdt.c @@ -68,7 +68,7 @@ static void gdt_prepare() { // copy to r0 code GDT[SEG_r0code] = GDT[SEG_r0data]; - GDT[SEG_r0code].code = SEG_r0data; + GDT[SEG_r0code].code = 1; GDT[SEG_r3data] = GDT[SEG_r0data]; GDT[SEG_r3data].ring = 3; @@ -106,6 +106,8 @@ static void gdt_load() { } static void gdt_check() { + // note: this only checks the r0data segment, + // it's far from a comprehensive test tty_const("checking gdt..."); asm("mov %0, %%ds;" : : "r" (SEG_r0data << 3) : "memory"); -- cgit v1.2.3