some stuff enhancement
This commit is contained in:
parent
6ee78caa4d
commit
b87af1d3d1
|
@ -132,7 +132,7 @@ void MmInitGdt(void);
|
||||||
//
|
//
|
||||||
// Loads the descriptor table
|
// Loads the descriptor table
|
||||||
//
|
//
|
||||||
extern void MmLoadGdt(ulong ds, ulong cs, ulong tr);
|
extern void MmLoadGdt();
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -49,6 +49,7 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
MmInitMemoryMap();
|
MmInitMemoryMap();
|
||||||
|
MmInitGdt();
|
||||||
MmInitPaging();
|
MmInitPaging();
|
||||||
MmInitHeap();
|
MmInitHeap();
|
||||||
|
|
||||||
|
|
|
@ -33,24 +33,13 @@ global MmStoreGdt
|
||||||
;; Loads the GDT
|
;; Loads the GDT
|
||||||
;;
|
;;
|
||||||
MmLoadGdt:
|
MmLoadGdt:
|
||||||
|
|
||||||
;; Loading the gdt via the gdtPtr pointer
|
;; Loading the gdt via the gdtPtr pointer
|
||||||
lgdt [rel gdtPtr]
|
lgdt [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
|
|
||||||
|
|
||||||
;; We must far jump because we changed the GDT
|
;; We must far jump because we changed the GDT
|
||||||
lea rax, [rel .next]
|
lea rax, [.next]
|
||||||
push rax
|
push rax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.next:
|
.next:
|
||||||
;ltr dx ; the TSS
|
;ltr dx ; the TSS
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -76,7 +76,7 @@ void MmInitGdt(void)
|
||||||
|
|
||||||
/* SetTssEntry(2, (ulong)&tssEntry, sizeof(TssEntry_t)); */
|
/* SetTssEntry(2, (ulong)&tssEntry, sizeof(TssEntry_t)); */
|
||||||
|
|
||||||
/* MmLoadGdt(0x8, 0x0, 2 << 3); */
|
MmLoadGdt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue