1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-23 08:26:17 +04:00

bump rvm version and modify ffi

This commit is contained in:
gjz010 2021-05-17 11:04:31 +08:00
parent b7dc9b0fd2
commit 3a10757921
3 changed files with 21 additions and 33 deletions

4
kernel/Cargo.lock generated
View File

@ -681,7 +681,7 @@ dependencies = [
[[package]]
name = "rvm"
version = "1.2.0"
source = "git+https://github.com/rcore-riscv-hypervisor-dev/RVM?rev=5ccac8b#5ccac8ba6529cf06d5dabb8c137227c36f5ad2eb"
source = "git+https://github.com/rcore-riscv-hypervisor-dev/RVM?rev=2867e78#2867e782463fe81e572d7c3cd68abaf79252f50c"
dependencies = [
"bit-set",
"bit_field 0.10.1",
@ -701,7 +701,7 @@ dependencies = [
[[package]]
name = "rvm_macros"
version = "0.1.0"
source = "git+https://github.com/rcore-riscv-hypervisor-dev/RVM?rev=5ccac8b#5ccac8ba6529cf06d5dabb8c137227c36f5ad2eb"
source = "git+https://github.com/rcore-riscv-hypervisor-dev/RVM?rev=2867e78#2867e782463fe81e572d7c3cd68abaf79252f50c"
dependencies = [
"quote",
"syn",

View File

@ -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 = "5ccac8b", optional = true }
rvm = { git = "https://github.com/rcore-riscv-hypervisor-dev/RVM", rev = "2867e78", optional = true }
[target.'cfg(target_arch = "x86_64")'.dependencies]
apic = { git = "https://github.com/rcore-os/apic-rs", rev = "fb86bd7" }

View File

@ -28,25 +28,20 @@ fn into_fs_error(e: RvmError) -> FsError {
}
mod rvm_extern_fn {
use crate::memory::{alloc_frame, dealloc_frame, phys_to_virt};
#[rvm::extern_fn(alloc_frame)]
fn rvm_alloc_frame() -> Option<usize> {
alloc_frame()
use crate::memory::{alloc_frame_contiguous, dealloc_frame, phys_to_virt};
use rvm::PAGE_SIZE;
#[rvm::extern_fn(alloc_frames)]
fn rvm_alloc_frames(n: usize, align_log2: usize) -> Option<usize> {
alloc_frame_contiguous(n, align_log2)
}
#[rvm::extern_fn(dealloc_frame)]
fn rvm_dealloc_frame(paddr: usize) {
dealloc_frame(paddr)
#[rvm::extern_fn(dealloc_frames)]
fn rvm_dealloc_frames(paddr: usize, n: usize, _align_log2: usize) {
for i in 0..n {
dealloc_frame(paddr + i * PAGE_SIZE)
}
#[rvm::extern_fn(alloc_frame_x4)]
fn rvm_alloc_frame_x4() -> Option<usize> {
use crate::memory::alloc_frame_contiguous;
alloc_frame_contiguous(4, 2)
}
#[rvm::extern_fn(dealloc_frame_x4)]
fn rvm_dealloc_frame_x4(paddr: usize) {
dealloc_frame(paddr)
//use crate::memory::dealloc_frame_contiguous;
//dealloc_frame_contiguous(paddr, n, align_log2)
}
#[rvm::extern_fn(phys_to_virt)]
@ -73,20 +68,13 @@ mod rvm_extern_fn {
crate::arch::interrupt::trap_handler_no_frame(sepc);
}
#[cfg(all(
any(target_arch = "riscv64", target_arch = "riscv32"),
feature = "hypervisor"
))]
#[cfg(any(target_arch = "riscv64", target_arch = "riscv32"))]
#[rvm::extern_fn(riscv_check_hypervisor_extension)]
fn rvm_riscv_check_hypervisor_extension() -> bool {
return true;
}
#[cfg(all(
any(target_arch = "riscv64", target_arch = "riscv32"),
not(feature = "hypervisor")
))]
#[rvm::extern_fn(riscv_check_hypervisor_extension)]
fn rvm_riscv_check_hypervisor_extension() -> bool {
return false;
if cfg!(feature = "hypervisor") {
true
} else {
false
}
}
}