From 343ec3ccf99a86fb9c67a7b0372e9b7a745f0640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E7=9D=BF?= Date: Tue, 9 Sep 2025 10:35:26 +0800 Subject: [PATCH 1/4] feat: add gpt level api --- Cargo.toml | 2 +- src/percpu.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 174b683..d5878b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "axvcpu" authors = ["aarkegz "] -version = "0.1.1" +version = "0.1.2" edition = "2024" categories = ["virtualization", "no-std"] description = "Virtual CPU abstraction for ArceOS hypervisor" diff --git a/src/percpu.rs b/src/percpu.rs index baf748f..3e24260 100644 --- a/src/percpu.rs +++ b/src/percpu.rs @@ -16,6 +16,10 @@ pub trait AxArchPerCpu: Sized { fn hardware_enable(&mut self) -> AxResult; /// Disable hardware virtualization on the current CPU. fn hardware_disable(&mut self) -> AxResult; + /// Return max guest page table levels used by the architecture. + fn max_guest_page_table_levels(&self) -> usize { + 4 + } } /// Host per-CPU states to run the guest. From a8a53207cf599240b8dfd725e1888a9701bda87f Mon Sep 17 00:00:00 2001 From: aarkegz Date: Fri, 16 Jan 2026 15:59:24 +0800 Subject: [PATCH 2/4] update dependencies --- Cargo.toml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d5878b6..69eea50 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,12 @@ keywords = ["vcpu", "hypervisor", "arceos"] license = "GPL-3.0-or-later OR Apache-2.0 OR MulanPSL-2.0" # MulanPubL2 is not included in SPDX [dependencies] -axerrno = "0.1.0" +axerrno = "0.2" memory_addr = "0.4" percpu = "0.2.0" -axaddrspace = "0.1" -axvisor_api = "0.1" +axaddrspace = "0.2" +axvisor_api = "0.2" + +[patch.crates-io] +axvisor_api = { git = "https://github.com/arceos-hypervisor/axvisor_api", branch = "aar-master" } +axaddrspace = { git = "https://github.com/arceos-hypervisor/axaddrspace", branch = "aar-master" } From 62425896e4fb112efd414c0a49290086bfec6b5c Mon Sep 17 00:00:00 2001 From: aarkegz Date: Sat, 17 Jan 2026 17:52:29 +0800 Subject: [PATCH 3/4] remove hal --- src/hal.rs | 32 -------------------------------- src/lib.rs | 2 -- 2 files changed, 34 deletions(-) delete mode 100644 src/hal.rs diff --git a/src/hal.rs b/src/hal.rs deleted file mode 100644 index ccd7502..0000000 --- a/src/hal.rs +++ /dev/null @@ -1,32 +0,0 @@ -/// Hardware abstraction layer interfaces for VCpu operations. -/// -/// This trait defines the interfaces that the underlying software (kernel or hypervisor) -/// must implement to support VCpu operations such as interrupt handling and memory management. -pub trait AxVCpuHal { - /// Memory management interfaces required by the VCpu subsystem. - /// Must implement the AxMmHal trait from the axaddrspace crate. - type MmHal: axaddrspace::AxMmHal; - - /// Fetches the current interrupt (IRQ) number from the hardware. - fn irq_fetch() -> usize { - 0 - } - - /// Dispatches an interrupt request (IRQ) to the underlying host OS. - /// - /// This function should handle the actual interrupt processing and delegation - /// to the appropriate interrupt handler in the host system. - /// - /// # Implementation Required - /// - /// The default implementation panics as this function **must** be implemented - /// by the underlying hypervisor or kernel to provide proper interrupt handling. - /// - /// # Safety - /// - /// Implementations should ensure proper interrupt handling and avoid - /// reentrancy issues during interrupt processing. - fn irq_hanlder() { - unimplemented!("irq_handler is not implemented"); - } -} diff --git a/src/lib.rs b/src/lib.rs index d723e06..772c16a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,6 @@ extern crate alloc; // Core modules mod arch_vcpu; // Architecture-specific VCpu trait definition mod exit; // VM exit reason enumeration and handling -mod hal; // Hardware abstraction layer interfaces mod percpu; // Per-CPU virtualization state management mod test; // Unit tests for VCpu functionality mod vcpu; // Main VCpu implementation and state management @@ -29,6 +28,5 @@ mod vcpu; // Main VCpu implementation and state management // Public API exports pub use arch_vcpu::AxArchVCpu; // Architecture-specific VCpu trait pub use exit::AxVCpuExitReason; -pub use hal::AxVCpuHal; // Hardware abstraction layer trait pub use percpu::*; // Per-CPU state management types pub use vcpu::*; // Main VCpu types and functions // VM exit reasons From fb359660473c32ef3effcabfa22ffb16d56d6f23 Mon Sep 17 00:00:00 2001 From: aarkegz Date: Thu, 5 Mar 2026 20:20:21 +0800 Subject: [PATCH 4/4] update axaddrspace and axvisor_api dependencies to version 0.3 --- Cargo.toml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 69eea50..1bff703 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,5 @@ license = "GPL-3.0-or-later OR Apache-2.0 OR MulanPSL-2.0" # MulanPubL2 is not i axerrno = "0.2" memory_addr = "0.4" percpu = "0.2.0" -axaddrspace = "0.2" -axvisor_api = "0.2" - -[patch.crates-io] -axvisor_api = { git = "https://github.com/arceos-hypervisor/axvisor_api", branch = "aar-master" } -axaddrspace = { git = "https://github.com/arceos-hypervisor/axaddrspace", branch = "aar-master" } +axaddrspace = "0.3" +axvisor_api = "0.3"