GDT flush fix
This commit is contained in:
parent
cd3b8ad76a
commit
5a371e3a03
13
boot.s
13
boot.s
@ -13,19 +13,22 @@
|
||||
.section .bss
|
||||
.align 16
|
||||
stack_bottom:
|
||||
.skip 16384 # 16 KiB
|
||||
.skip 1024 * 32 # 32 KB
|
||||
stack_top:
|
||||
|
||||
.section .text
|
||||
.global _start
|
||||
.type _start, @function
|
||||
_start:
|
||||
cli
|
||||
mov $stack_top, %esp
|
||||
|
||||
call kernel_main
|
||||
call kernel_main
|
||||
|
||||
hlt
|
||||
jmp 1
|
||||
1:
|
||||
jmp 1
|
||||
|
||||
cli
|
||||
1: hlt
|
||||
jmp 1b
|
||||
|
||||
.size _start, . - _start
|
||||
|
2
gdt.c
2
gdt.c
@ -25,5 +25,5 @@ void gdt_install() {
|
||||
gdt_set_gate(1, 0, 0xFFFFFFFF, 0x9A, 0xCF); // Code segment
|
||||
gdt_set_gate(2, 0, 0xFFFFFFFF, 0x92, 0xCF); // Data segment
|
||||
|
||||
//gdt_flush((uint32_t)&gdtp); //TODO: KERNEL PANIC
|
||||
gdt_flush((uint32_t)&gdtp); //TODO: KERNEL PANIC
|
||||
}
|
||||
|
30
gdt_flush.s
30
gdt_flush.s
@ -1,17 +1,19 @@
|
||||
.section .text
|
||||
.global gdt_flush
|
||||
|
||||
gdt_flush:
|
||||
push %eax
|
||||
mov %esp, %eax
|
||||
add $4, %eax
|
||||
cli
|
||||
|
||||
mov 4(%esp), %eax
|
||||
lgdt (%eax)
|
||||
pop %eax
|
||||
movw $0x10, %ax
|
||||
movw %ax, %ds
|
||||
movw %ax, %es
|
||||
movw %ax, %fs
|
||||
movw %ax, %gs
|
||||
movw %ax, %ss
|
||||
ljmp $0x08, $flush2
|
||||
flush2:
|
||||
ret
|
||||
|
||||
mov $0x10, %ax
|
||||
mov %ax, %ds
|
||||
mov %ax, %es
|
||||
mov %ax, %fs
|
||||
mov %ax, %gs
|
||||
mov %ax, %ss
|
||||
|
||||
jmp $0x08, $.flush
|
||||
|
||||
.flush:
|
||||
ret
|
Loading…
Reference in New Issue
Block a user