some stuff enhancement

This commit is contained in:
Adrien Bourmault 2019-05-18 19:22:49 +02:00
parent 6ee78caa4d
commit b87af1d3d1
4 changed files with 5 additions and 15 deletions

View File

@ -132,7 +132,7 @@ void MmInitGdt(void);
//
// Loads the descriptor table
//
extern void MmLoadGdt(ulong ds, ulong cs, ulong tr);
extern void MmLoadGdt();
//

View File

@ -49,6 +49,7 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
// Memory
MmInitMemoryMap();
MmInitGdt();
MmInitPaging();
MmInitHeap();

View File

@ -33,24 +33,13 @@ global MmStoreGdt
;; Loads the GDT
;;
MmLoadGdt:
;; Loading the gdt via the gdtPtr pointer
lgdt [rel gdtPtr]
;; Reloading the segment registers
mov ax, si ; data segment
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov cs, di ; code segment
lgdt [gdtPtr]
;; We must far jump because we changed the GDT
lea rax, [rel .next]
lea rax, [.next]
push rax
ret
.next:
;ltr dx ; the TSS
ret

View File

@ -76,7 +76,7 @@ void MmInitGdt(void)
/* SetTssEntry(2, (ulong)&tssEntry, sizeof(TssEntry_t)); */
/* MmLoadGdt(0x8, 0x0, 2 << 3); */
MmLoadGdt();
}