mirror of
https://github.com/sgmarz/osblog.git
synced 2024-11-24 02:16:19 +04:00
Updates to system call. Change stack pointer for MMU
This commit is contained in:
parent
88c672171e
commit
429b056921
@ -24,7 +24,7 @@ use alloc::collections::vec_deque::VecDeque;
|
||||
const STACK_PAGES: usize = 2;
|
||||
// We want to adjust the stack to be at the bottom of the memory allocation
|
||||
// regardless of where it is on the kernel heap.
|
||||
const STACK_ADDR: usize = 0x8000_0000;
|
||||
const STACK_ADDR: usize = 0x1_0000_0000;
|
||||
// All processes will have a defined starting point in virtual memory.
|
||||
const PROCESS_STARTING_ADDR: usize = 0x8000_0000;
|
||||
|
||||
|
@ -33,9 +33,6 @@ pub fn schedule() {
|
||||
}
|
||||
}
|
||||
PROCESS_LIST.replace(pl);
|
||||
println!("Sched ->\n frame = 0x{:08x}\n mepc = 0x{:08x}\n satp = 0x{:08x}\n pid = {}",
|
||||
frame_addr, mepc, satp, pid
|
||||
);
|
||||
if frame_addr != 0 {
|
||||
// MODE 8 is 39-bit virtual address MMU
|
||||
// I'm using the PID as the address space identifier to hopefully
|
||||
|
@ -7,16 +7,15 @@ use crate::cpu::TrapFrame;
|
||||
|
||||
pub fn do_syscall(mepc: usize, frame: *mut TrapFrame) -> usize {
|
||||
let syscall_number;
|
||||
println!("Frame is at {:p}", frame);
|
||||
unsafe {
|
||||
// A0 is X10, so it's register number 10.
|
||||
syscall_number = (*frame).regs[10];
|
||||
for i in 0..32 {
|
||||
print!("regs[{:02}] = 0x{:08x} ", i, (*frame).regs[i]);
|
||||
if (i+1) % 4 == 0 {
|
||||
println!();
|
||||
}
|
||||
}
|
||||
// for i in 0..32 {
|
||||
// print!("regs[{:02}] = 0x{:08x} ", i, (*frame).regs[i]);
|
||||
// if (i+1) % 4 == 0 {
|
||||
// println!();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
match syscall_number {
|
||||
0 => {
|
||||
|
@ -123,7 +123,7 @@ extern "C" fn m_trap(epc: usize,
|
||||
},
|
||||
8 => {
|
||||
// Environment (system) call from User mode
|
||||
println!("E-call from User mode! CPU#{} -> 0x{:08x}", hart, epc);
|
||||
// println!("E-call from User mode! CPU#{} -> 0x{:08x}", hart, epc);
|
||||
return_pc = do_syscall(return_pc, frame);
|
||||
},
|
||||
9 => {
|
||||
|
Loading…
Reference in New Issue
Block a user