Zitat
Hexzahlen als Ausgabe wären hier eigentlich sinnvollerja, sofort erledigt.
Zitat
Normal hätte ich jetzt an den GDT-Einträgen gezweifeltZurecht! ich hatte da noch einen Murks drinnen, nämlich:
Code: [Auswählen]
#ifdef USERMODE // in os.h
//gdt_set_gate(3, 0, 0xFFFFFFFF, 0xFA, 0xCF); // User mode code segment
//gdt_set_gate(4, 0, 0xFFFFFFFF, 0xF2, 0xCF); // User mode data segment
#endifd.h. gate 3 und 4 waren überhaupt nicht gesetzt!Nun habe ich das korrigiert:
Code: [Auswählen]
void gdt_install()
{
/* Setup the GDT pointer and limit */
gdt_register.limit = (sizeof(struct gdt_entry) * NUMBER_GDT_GATES)-1;
gdt_register.base = (ULONG) &gdt;
/* GDT GATES - desriptors with pointers to the linear memory address */
gdt_set_gate(0, 0, 0, 0, 0); // NULL descriptor
gdt_set_gate(1, 0, 0xFFFFFFFF, 0x9A, 0xCF); // CODE, privilege level 0 for kernel code
gdt_set_gate(2, 0, 0xFFFFFFFF, 0x92, 0xCF); // DATA, privilege level 0 for kernel code
#ifdef KERNELMODE // in os.h
gdt_set_gate(3, 0, 0xFFFFFFFF, 0x9A, 0xCF); // CODE, privilege level 0 for kernel code
gdt_set_gate(4, 0, 0xFFFFFFFF, 0x92, 0xCF); // DATA, privilege level 0 for kernel code
#endif
#ifdef USERMODE // in os.h
gdt_set_gate(3, 0, 0xFFFFFFFF, 0xFA, 0xCF); // User mode code segment
gdt_set_gate(4, 0, 0xFFFFFFFF, 0xF2, 0xCF); // User mode data segment
#endif
write_tss(5, 0x10, 0x0); // num, ss0, esp0
gdt_flush((ULONG)&gdt_register); // inclusive gdt_load() in assembler code
tss_flush(); //in flush.asm: privilege level 3 for kernel mode 0x2B
}
Leider ist das noch nicht die Lösung. Nächste Fehlermeldung:
Code: [Auswählen]
TSS log:
esp0: 40212000h ss0: 10h ... es: 10h cs: 08h ss: 10h ds: 10h fs: 10h gs: 10h
err_code: 00000FF4h address(eip): 000082ABh ... cs: 08h ds: 23h es: 23h fs: 23h gs 23h ss 1Bh int_no 13 eflags 00010012h useresp 0000836Ah
General Protection Fault >>> Exception. System Halted! <<<
Übersicht
Wiki
Hilfe
Suche
Einloggen
Registrieren
Drucken
Gespeichert







