asm
This commit is contained in:
parent
7fb7d9d460
commit
b51fe947f0
3 changed files with 5 additions and 4 deletions
|
|
@ -31,9 +31,9 @@ set_up_page_tables:
|
||||||
or eax, 0b11 ; present + writable
|
or eax, 0b11 ; present + writable
|
||||||
mov [p2_table + 1023 * 4], eax
|
mov [p2_table + 1023 * 4], eax
|
||||||
|
|
||||||
; map ecx-th P2 entry to a huge page that starts at address 2MiB*ecx
|
; identity map first P2 entry to a huge page
|
||||||
mov eax, 0b10000011 ; huge + present + writable
|
mov eax, 0b10000011 ; huge + present + writable
|
||||||
mov [p2_table], eax ; map ecx-th entry
|
mov [p2_table], eax ; map first entry
|
||||||
|
|
||||||
mov eax, p2_table
|
mov eax, p2_table
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
|
|
@ -54,7 +54,7 @@ align 4096
|
||||||
p2_table:
|
p2_table:
|
||||||
resb 4096
|
resb 4096
|
||||||
stack_bottom:
|
stack_bottom:
|
||||||
resb 4096 * 8
|
resb 4096 * 16
|
||||||
stack_top:
|
stack_top:
|
||||||
|
|
||||||
section .gdt
|
section .gdt
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use x86::structures::gdt;
|
||||||
use x86::structures::tss;
|
use x86::structures::tss;
|
||||||
use x86::instructions::segmentation::set_cs;
|
use x86::instructions::segmentation::set_cs;
|
||||||
use x86::instructions::tables::load_tss;
|
use x86::instructions::tables::load_tss;
|
||||||
use spin::Once;
|
// use spin::Once;
|
||||||
|
|
||||||
// static GDT: Once<gdt::Gdt> = Once::new();
|
// static GDT: Once<gdt::Gdt> = Once::new();
|
||||||
// static TSS: Once<tss::TaskStateSegment> = Once::new();
|
// static TSS: Once<tss::TaskStateSegment> = Once::new();
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ pub fn remap_the_kernel(boot_info: &BootInformation) -> ActivePageTable {
|
||||||
let frame = ::memory::allocate_frames(1).expect("no more frames");
|
let frame = ::memory::allocate_frames(1).expect("no more frames");
|
||||||
InactivePageTable::new(frame, &mut active_table, &mut temporary_page)
|
InactivePageTable::new(frame, &mut active_table, &mut temporary_page)
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
asm!("hlt");
|
asm!("hlt");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue