mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-25 01:16:18 +04:00
add rkprobes to probe function and instructions,change parameter of trap_handler, update rust-toolchain
This commit is contained in:
parent
13ad2d1905
commit
d27908d11d
19
kernel/Cargo.lock
generated
19
kernel/Cargo.lock
generated
@ -514,6 +514,7 @@ dependencies = [
|
|||||||
"rcore-fs-sfs",
|
"rcore-fs-sfs",
|
||||||
"rcore-memory",
|
"rcore-memory",
|
||||||
"riscv",
|
"riscv",
|
||||||
|
"rkprobes",
|
||||||
"rlibc",
|
"rlibc",
|
||||||
"rvm",
|
"rvm",
|
||||||
"smoltcp",
|
"smoltcp",
|
||||||
@ -642,6 +643,12 @@ dependencies = [
|
|||||||
"riscv-target",
|
"riscv-target",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "riscv-decode"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "920466101a1ec4ffac2ab9b72fa780eff62defa0ae9c4f77a07fa41dfd5450e6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "riscv-target"
|
name = "riscv-target"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
@ -652,6 +659,18 @@ dependencies = [
|
|||||||
"regex",
|
"regex",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rkprobes"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/hm1229/rkprobes?rev=d6e0f96#d6e0f962618329315f7806cec66f2891822e8999"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"log",
|
||||||
|
"riscv-decode",
|
||||||
|
"spin",
|
||||||
|
"trapframe",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rlibc"
|
name = "rlibc"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
@ -90,6 +90,7 @@ x86_64 = "0.11"
|
|||||||
|
|
||||||
[target.'cfg(any(target_arch = "riscv32", target_arch = "riscv64"))'.dependencies]
|
[target.'cfg(any(target_arch = "riscv32", target_arch = "riscv64"))'.dependencies]
|
||||||
riscv = { git = "https://github.com/rcore-riscv-hypervisor-dev/riscv" , rev = "3f5efb1", features = ["inline-asm", "hypervisor"] }
|
riscv = { git = "https://github.com/rcore-riscv-hypervisor-dev/riscv" , rev = "3f5efb1", features = ["inline-asm", "hypervisor"] }
|
||||||
|
rkprobes = { git = "https://github.com/hm1229/rkprobes", rev = "d6e0f96" }
|
||||||
|
|
||||||
[target.'cfg(target_arch = "aarch64")'.dependencies]
|
[target.'cfg(target_arch = "aarch64")'.dependencies]
|
||||||
aarch64 = { git = "https://github.com/rcore-os/aarch64", version = "3.0.1" }
|
aarch64 = { git = "https://github.com/rcore-os/aarch64", version = "3.0.1" }
|
||||||
|
@ -36,12 +36,12 @@ pub unsafe fn restore(flags: usize) {
|
|||||||
/// This function is called from `trap.asm`.
|
/// This function is called from `trap.asm`.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn trap_handler(tf: &mut TrapFrame) {
|
pub extern "C" fn trap_handler(tf: &mut TrapFrame) {
|
||||||
trap_handler_no_frame(&mut tf.sepc);
|
trap_handler_no_frame(tf);
|
||||||
}
|
}
|
||||||
|
|
||||||
use crate::memory::AccessType;
|
use crate::memory::AccessType;
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn trap_handler_no_frame(sepc: &mut usize) {
|
pub fn trap_handler_no_frame(tf: &mut TrapFrame) {
|
||||||
use self::scause::{Exception as E, Interrupt as I, Trap};
|
use self::scause::{Exception as E, Interrupt as I, Trap};
|
||||||
let scause = scause::read();
|
let scause = scause::read();
|
||||||
let stval = stval::read();
|
let stval = stval::read();
|
||||||
@ -51,11 +51,12 @@ pub fn trap_handler_no_frame(sepc: &mut usize) {
|
|||||||
Trap::Interrupt(I::SupervisorExternal) => external(),
|
Trap::Interrupt(I::SupervisorExternal) => external(),
|
||||||
Trap::Interrupt(I::SupervisorSoft) => ipi(),
|
Trap::Interrupt(I::SupervisorSoft) => ipi(),
|
||||||
Trap::Interrupt(I::SupervisorTimer) => timer(),
|
Trap::Interrupt(I::SupervisorTimer) => timer(),
|
||||||
Trap::Exception(E::LoadPageFault) => page_fault(stval, sepc, AccessType::read(is_user)),
|
Trap::Exception(E::LoadPageFault) => page_fault(stval, &mut tf.sepc, AccessType::read(is_user)),
|
||||||
Trap::Exception(E::StorePageFault) => page_fault(stval, sepc, AccessType::write(is_user)),
|
Trap::Exception(E::StorePageFault) => page_fault(stval, &mut tf.sepc, AccessType::write(is_user)),
|
||||||
Trap::Exception(E::InstructionPageFault) => {
|
Trap::Exception(E::InstructionPageFault) => {
|
||||||
page_fault(stval, sepc, AccessType::execute(is_user))
|
page_fault(stval, &mut tf.sepc, AccessType::execute(is_user))
|
||||||
}
|
}
|
||||||
|
Trap::Exception(E::Breakpoint) => rkprobes::kprobes_trap_handler(tf),
|
||||||
_ => {
|
_ => {
|
||||||
let bits = scause.bits();
|
let bits = scause.bits();
|
||||||
panic!("unhandled trap {:?} ({})", scause.cause(), bits);
|
panic!("unhandled trap {:?} ({})", scause.cause(), bits);
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#![feature(negative_impls)]
|
#![feature(negative_impls)]
|
||||||
#![feature(alloc_prelude)]
|
#![feature(alloc_prelude)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(const_if_match)]
|
|
||||||
#![feature(const_in_array_repeat_expressions)]
|
#![feature(const_in_array_repeat_expressions)]
|
||||||
#![deny(unused_must_use)]
|
#![deny(unused_must_use)]
|
||||||
#![deny(stable_features)]
|
#![deny(stable_features)]
|
||||||
|
Loading…
Reference in New Issue
Block a user