1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-25 17:33:28 +04:00

Unify trap_handler interfaces

This commit is contained in:
Jiajie Chen 2020-06-21 11:38:31 +08:00
parent 1560e1c3f8
commit fd59658355
3 changed files with 5 additions and 3 deletions

2
kernel/Cargo.lock generated
View File

@ -722,7 +722,7 @@ checksum = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316"
[[package]]
name = "trapframe"
version = "0.3.0"
source = "git+https://github.com/rcore-os/trapframe-rs?rev=ece17c9#ece17c9aa3995cb67a5e46ec7fbf1dd590936549"
source = "git+https://github.com/rcore-os/trapframe-rs?rev=9bf833f#9bf833fcf6a31a9e411f42e4ca1432cba9afe8f5"
dependencies = [
"log",
"raw-cpuid",

View File

@ -74,7 +74,7 @@ rcore-fs-devfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "517af47"
rlibc = "1.0"
smoltcp = { git = "https://github.com/rcore-os/smoltcp", rev = "5bd87c7c", default-features = false, features = ["alloc", "log", "ethernet", "proto-ipv4", "proto-igmp", "socket-icmp", "socket-udp", "socket-tcp", "socket-raw"] }
spin = "0.5"
trapframe = { git = "https://github.com/rcore-os/trapframe-rs", rev = "ece17c9" }
trapframe = { git = "https://github.com/rcore-os/trapframe-rs", rev = "9bf833f" }
virtio-drivers = { git = "https://github.com/rcore-os/virtio-drivers", rev = "dfa70e14" }
volatile = "0.2"
woke = "0.0.2"

View File

@ -33,8 +33,10 @@ pub unsafe fn restore(flags: usize) {
///
/// This function is called from `trap.asm`.
#[no_mangle]
pub extern "C" fn trap_handler(scause: Scause, stval: usize, tf: &mut TrapFrame) {
pub extern "C" fn trap_handler(tf: &mut TrapFrame) {
use self::scause::{Exception as E, Interrupt as I, Trap};
let scause = scause::read();
let stval = stval::read();
trace!("Interrupt @ CPU{}: {:?} ", super::cpu::id(), scause.cause());
match scause.cause() {
Trap::Interrupt(I::SupervisorExternal) => external(),