1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-23 18:06:20 +04:00

Fixed stack location, mapping

This commit is contained in:
Stephen Marz 2019-10-14 22:15:03 -04:00
parent fb4f3eea91
commit eb2b9a6aca
2 changed files with 3 additions and 9 deletions

View File

@ -336,9 +336,9 @@ extern "C" fn kmain() {
unsafe {
let mtimecmp = 0x0200_4000 as *mut u64;
let mtime = 0x0200_bff8 as *const u64;
// mtimecmp.write_volatile(mtime.read_volatile() + 10_000_000);
let v = 0x0 as *mut u64;
v.write_volatile(0);
mtimecmp.write_volatile(mtime.read_volatile() + 10_000_000);
// let v = 0x0 as *mut u64;
// v.write_volatile(0);
}
// If we get here, the Box, vec, and String should all be freed since
// they go out of scope. This calls their "Drop" trait.

View File

@ -22,17 +22,11 @@ fn m_trap(epc: usize, tval: usize, cause: usize, hart: usize, stat: usize, frame
// mode (s_trap).
if cause == 0x8000_0000_0000_0007 {
unsafe {
// let satp: usize = KERNEL_TABLE >> 12 | 8 << 60;
// println!("cause: {}", cause & 0xff);
// println!("Kernel table = 0x{:x}", KERNEL_TABLE);
// asm!("csrw satp, $0" :: "r"(satp) :: "volatile");
let addr = 0x0200_4000 + hart * 8;
let mtimecmp = addr as *mut u64;
let mtime = 0x0200_bff8 as *const u64;
mtimecmp.write_volatile(mtime.read_volatile() + 10_000_000);
asm!("csrw sip, $0" ::"r"(2));
// asm!("sfence.vma" :::: "volatile");
// asm!("csrw mie, zero" :::: "volatile");
}
epc
}