diff --git a/kernel/Cargo.lock b/kernel/Cargo.lock index 9f9bc730..dcafa37a 100644 --- a/kernel/Cargo.lock +++ b/kernel/Cargo.lock @@ -472,7 +472,7 @@ dependencies = [ "log", "rlibc", "uefi", - "x86_64 0.11.7", + "x86_64", "xmas-elf", ] @@ -523,7 +523,7 @@ dependencies = [ "virtio-drivers", "volatile", "woke", - "x86_64 0.11.7", + "x86_64", "xmas-elf", ] @@ -681,7 +681,7 @@ dependencies = [ [[package]] name = "rvm" version = "1.2.0" -source = "git+https://github.com/rcore-riscv-hypervisor-dev/RVM?rev=5cde71c#5cde71c7f4c1a691e12adbe542d28b381bc8e383" +source = "git+https://github.com/rcore-riscv-hypervisor-dev/RVM?rev=5ccac8b#5ccac8ba6529cf06d5dabb8c137227c36f5ad2eb" dependencies = [ "bit-set", "bit_field 0.10.1", @@ -695,13 +695,13 @@ dependencies = [ "rvm_macros", "spin", "x86 0.36.0", - "x86_64 0.13.6", + "x86_64", ] [[package]] name = "rvm_macros" version = "0.1.0" -source = "git+https://github.com/rcore-riscv-hypervisor-dev/RVM?rev=5cde71c#5cde71c7f4c1a691e12adbe542d28b381bc8e383" +source = "git+https://github.com/rcore-riscv-hypervisor-dev/RVM?rev=5ccac8b#5ccac8ba6529cf06d5dabb8c137227c36f5ad2eb" dependencies = [ "quote", "syn", @@ -777,7 +777,7 @@ version = "0.4.3" source = "git+https://github.com/rcore-os/trapframe-rs?rev=bdfe5aa#bdfe5aaebcdd64636c8831c2b8c17e4fede40c0b" dependencies = [ "raw-cpuid 8.0.0", - "x86_64 0.11.7", + "x86_64", ] [[package]] @@ -793,7 +793,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e58fc40dc1712664fc9b0a7bd8ca2f21ab49960924fb245a80a05e1e92f3dfe9" dependencies = [ "bitflags", - "x86_64 0.11.7", + "x86_64", ] [[package]] @@ -937,16 +937,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "x86_64" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021b49a4cb0a0d9490265cc169ca816014cbf61d3f3b75424815912977b81871" -dependencies = [ - "bit_field 0.9.0", - "bitflags", -] - [[package]] name = "xmas-elf" version = "0.7.0" diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index cab9773b..3268076d 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -77,7 +77,7 @@ virtio-drivers = { git = "https://github.com/rcore-riscv-hypervisor-dev/virtio-d volatile = "0.2" woke = "0.0.2" xmas-elf = "0.7" -rvm = { git = "https://github.com/rcore-riscv-hypervisor-dev/RVM", rev = "5cde71c", optional = true } +rvm = { git = "https://github.com/rcore-riscv-hypervisor-dev/RVM", rev = "5ccac8b", optional = true } [target.'cfg(target_arch = "x86_64")'.dependencies] apic = { git = "https://github.com/rcore-os/apic-rs", rev = "fb86bd7" } diff --git a/kernel/src/rvm/inode.rs b/kernel/src/rvm/inode.rs index dc38245e..2d274e5a 100644 --- a/kernel/src/rvm/inode.rs +++ b/kernel/src/rvm/inode.rs @@ -26,10 +26,15 @@ const RVM_VCPU_READ_STATE: u32 = RVM_IO + 0x13; const RVM_VCPU_WRITE_STATE: u32 = RVM_IO + 0x14; const RVM_VCPU_INTERRUPT: u32 = RVM_IO + 0x15; -const RVM_RISCV_SET_SSIP: u32 = 0; -const RVM_RISCV_CLEAR_SSIP: u32 = 1; -const RVM_RISCV_SET_SEIP: u32 = 2; -const RVM_RISCV_CLEAR_SEIP: u32 = 3; +#[cfg(any(target_arch = "riscv64", target_arch = "riscv32"))] +mod riscv_intr_constants { + pub const RVM_RISCV_SET_SSIP: u32 = 0; + pub const RVM_RISCV_CLEAR_SSIP: u32 = 1; + pub const RVM_RISCV_SET_SEIP: u32 = 2; + pub const RVM_RISCV_CLEAR_SEIP: u32 = 3; +} +#[cfg(any(target_arch = "riscv64", target_arch = "riscv32"))] +use riscv_intr_constants::*; pub struct RvmINode { guests: RwLock>, diff --git a/kernel/src/rvm/mod.rs b/kernel/src/rvm/mod.rs index ad89114f..26116240 100644 --- a/kernel/src/rvm/mod.rs +++ b/kernel/src/rvm/mod.rs @@ -55,12 +55,16 @@ mod rvm_extern_fn { } #[cfg(target_arch = "x86_64")] - #[rvm::extern_fn(x86_all_traps_handler_addr)] - unsafe fn rvm_x86_all_traps_handler_addr() -> usize { - extern "C" { - fn __alltraps(); - } - __alltraps as usize + #[rvm::extern_fn(is_host_timer_interrupt)] + fn rvm_x86_is_host_timer_interrupt(_vec: u8) -> bool { + // TODO: fill in the blanks. + false + } + #[cfg(target_arch = "x86_64")] + #[rvm::extern_fn(is_host_serial_interrupt)] + fn rvm_x86_is_host_serial_interrupt(_vec: u8) -> bool { + // TODO: fill in the blanks. + false } #[cfg(any(target_arch = "riscv64", target_arch = "riscv32"))] diff --git a/user b/user index b4a7bd80..1c5e883f 160000 --- a/user +++ b/user @@ -1 +1 @@ -Subproject commit b4a7bd80a9dd34a9e4fe37fc623f0c33e6e23880 +Subproject commit 1c5e883fcfb0dc18895dce7b1931d7cf3a4261b1