Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rkprobes to probe function #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions kernel/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ x86_64 = "0.11"

[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"] }
rkprobes = { git = "https://github.com/hm1229/rkprobes", rev = "d6e0f96" }

[target.'cfg(target_arch = "aarch64")'.dependencies]
aarch64 = { git = "https://github.com/rcore-os/aarch64", version = "3.0.1" }
Expand Down
11 changes: 6 additions & 5 deletions kernel/src/arch/riscv/interrupt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ pub unsafe fn restore(flags: usize) {
/// This function is called from `trap.asm`.
#[no_mangle]
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;
#[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};
let scause = scause::read();
let stval = stval::read();
Expand All @@ -51,11 +51,12 @@ pub fn trap_handler_no_frame(sepc: &mut usize) {
Trap::Interrupt(I::SupervisorExternal) => external(),
Trap::Interrupt(I::SupervisorSoft) => ipi(),
Trap::Interrupt(I::SupervisorTimer) => timer(),
Trap::Exception(E::LoadPageFault) => page_fault(stval, sepc, AccessType::read(is_user)),
Trap::Exception(E::StorePageFault) => page_fault(stval, sepc, AccessType::write(is_user)),
Trap::Exception(E::LoadPageFault) => page_fault(stval, &mut tf.sepc, AccessType::read(is_user)),
Trap::Exception(E::StorePageFault) => page_fault(stval, &mut tf.sepc, AccessType::write(is_user)),
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();
panic!("unhandled trap {:?} ({})", scause.cause(), bits);
Expand Down
1 change: 0 additions & 1 deletion kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#![feature(negative_impls)]
#![feature(alloc_prelude)]
#![feature(const_fn)]
#![feature(const_if_match)]
#![feature(const_in_array_repeat_expressions)]
#![deny(unused_must_use)]
#![deny(stable_features)]
Expand Down