GDT flush fix
This commit is contained in:
parent
cd3b8ad76a
commit
5a371e3a03
13
boot.s
13
boot.s
@ -13,19 +13,22 @@
|
|||||||
.section .bss
|
.section .bss
|
||||||
.align 16
|
.align 16
|
||||||
stack_bottom:
|
stack_bottom:
|
||||||
.skip 16384 # 16 KiB
|
.skip 1024 * 32 # 32 KB
|
||||||
stack_top:
|
stack_top:
|
||||||
|
|
||||||
.section .text
|
.section .text
|
||||||
.global _start
|
.global _start
|
||||||
.type _start, @function
|
.type _start, @function
|
||||||
_start:
|
_start:
|
||||||
|
cli
|
||||||
mov $stack_top, %esp
|
mov $stack_top, %esp
|
||||||
|
|
||||||
call kernel_main
|
call kernel_main
|
||||||
|
|
||||||
|
hlt
|
||||||
|
jmp 1
|
||||||
|
1:
|
||||||
|
jmp 1
|
||||||
|
|
||||||
cli
|
|
||||||
1: hlt
|
|
||||||
jmp 1b
|
|
||||||
|
|
||||||
.size _start, . - _start
|
.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(1, 0, 0xFFFFFFFF, 0x9A, 0xCF); // Code segment
|
||||||
gdt_set_gate(2, 0, 0xFFFFFFFF, 0x92, 0xCF); // Data 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
|
.global gdt_flush
|
||||||
|
|
||||||
gdt_flush:
|
gdt_flush:
|
||||||
push %eax
|
cli
|
||||||
mov %esp, %eax
|
|
||||||
add $4, %eax
|
mov 4(%esp), %eax
|
||||||
lgdt (%eax)
|
lgdt (%eax)
|
||||||
pop %eax
|
|
||||||
movw $0x10, %ax
|
mov $0x10, %ax
|
||||||
movw %ax, %ds
|
mov %ax, %ds
|
||||||
movw %ax, %es
|
mov %ax, %es
|
||||||
movw %ax, %fs
|
mov %ax, %fs
|
||||||
movw %ax, %gs
|
mov %ax, %gs
|
||||||
movw %ax, %ss
|
mov %ax, %ss
|
||||||
ljmp $0x08, $flush2
|
|
||||||
flush2:
|
jmp $0x08, $.flush
|
||||||
ret
|
|
||||||
|
.flush:
|
||||||
|
ret
|
2
kernel.c
2
kernel.c
@ -235,7 +235,7 @@ void pit_set_frequency(uint32_t frequency) {
|
|||||||
|
|
||||||
void kernel_main(void) {
|
void kernel_main(void) {
|
||||||
terminal_initialize();
|
terminal_initialize();
|
||||||
//gdt_install();
|
gdt_install();
|
||||||
idt_install();
|
idt_install();
|
||||||
pic_remap(0x20, 0x28);
|
pic_remap(0x20, 0x28);
|
||||||
pit_set_frequency(1000);
|
pit_set_frequency(1000);
|
||||||
|
Loading…
Reference in New Issue
Block a user