From f8f8a202ed3958865ab59874c0f873e0d6d036f5 Mon Sep 17 00:00:00 2001 From: hky1999 <976929993@qq.com> Date: Tue, 21 Apr 2026 22:56:07 +0800 Subject: [PATCH 1/3] refactor(hvc): drop clear-guest-areas hypercall --- src/lib.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5d6af12..d4e3d0b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -45,15 +45,6 @@ numeric_enum! { /// Refer to `shmat` syscall, /// this is used to attach a shared memory region to the current instance. HIVCSHMAt = HYPER_CALL_CODE_PRIVILEGED_MASK | 10, - /// Clear all guest memory areas, - /// I know this HVC seems strange, the thing is, we prepare a early-stage `eqloader` - /// in guest address space as a user-space executor, when the instance starts running, - /// the pre-loader `eqloader` is useless and should be cleared, because it will take up - /// the guest memory space and the mapping is not known by the `EqAddrSpace` in `ProcessInnerRegion`. - /// So we use this hypercall to notify the hypervisor that the loading is done and - /// the pre-loader should be cleared. - /// Generally, this HVC is triggered by `shim` in the first `brk` syscall. - HClearGuestAreas = HYPER_CALL_CODE_PRIVILEGED_MASK | 11, HMMapSync = HYPER_CALL_CODE_PRIVILEGED_MASK | 12, @@ -101,7 +92,6 @@ impl core::fmt::Debug for HyperCallCode { HyperCallCode::HIVCGet => write!(f, "HIVCGet {:#x}", *self as u32), HyperCallCode::HIVCDt => write!(f, "HIVCDt {:#x}", *self as u32), HyperCallCode::HIVCSHMAt => write!(f, "HIVCSHMAt {:#x}", *self as u32), - HyperCallCode::HClearGuestAreas => write!(f, "HClearGuestAreas {:#x}", *self as u32), HyperCallCode::HBenchVMCall => write!(f, "HBenchVMCall {:#x}", *self as u32), HyperCallCode::HBenchEPTMmap => write!(f, "HBenchEPTMmap {:#x}", *self as u32), HyperCallCode::HBenchEPTMUnmap => write!(f, "HBenchEPTMUnmap {:#x}", *self as u32), From 50274221eae0679a2177fdb4b0782bc9b608fb5a Mon Sep 17 00:00:00 2001 From: hky1999 <976929993@qq.com> Date: Tue, 5 May 2026 18:10:57 +0800 Subject: [PATCH 2/3] Add current-process exit hypercall --- src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d4e3d0b..a3945aa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,6 +58,9 @@ numeric_enum! { HSetEptFaultMode = HYPER_CALL_CODE_PRIVILEGED_MASK | 0x14, /// Force a single-context EPT synchronization for the current process. HEptSync = HYPER_CALL_CODE_PRIVILEGED_MASK | 0x15, + /// Tear down the current process private user mappings without + /// removing the process object from the instance process table. + HExitCurrentProcess = HYPER_CALL_CODE_PRIVILEGED_MASK | 0x16, /// Just a benchmark hypercall for VM call overhead measurement. HBenchVMCall = HYPER_CALL_CODE_PRIVILEGED_MASK | 0xff, /// Just a benchmark hypercall for EPT mmap overhead measurement. @@ -86,6 +89,9 @@ impl core::fmt::Debug for HyperCallCode { HyperCallCode::HMMapSync => write!(f, "HMMapSync {:#x}", *self as u32), HyperCallCode::HSetEptFaultMode => write!(f, "HSetEptFaultMode {:#x}", *self as u32), HyperCallCode::HEptSync => write!(f, "HEptSync {:#x}", *self as u32), + HyperCallCode::HExitCurrentProcess => { + write!(f, "HExitCurrentProcess {:#x}", *self as u32) + } HyperCallCode::HInitShim => write!(f, "HInitShim {:#x}", *self as u32), HyperCallCode::HSetupInstance => write!(f, "HSetupInstance {:#x}", *self as u32), HyperCallCode::HAllocMMRegion => write!(f, "HAllocMMRegion {:#x}", *self as u32), From 83190e287cb873dc1a9d4b58a84fe0d49f33ab5d Mon Sep 17 00:00:00 2001 From: hky1999 <976929993@qq.com> Date: Wed, 6 May 2026 16:09:56 +0800 Subject: [PATCH 3/3] Remove obsolete exit hypercall --- src/lib.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a3945aa..d4e3d0b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,9 +58,6 @@ numeric_enum! { HSetEptFaultMode = HYPER_CALL_CODE_PRIVILEGED_MASK | 0x14, /// Force a single-context EPT synchronization for the current process. HEptSync = HYPER_CALL_CODE_PRIVILEGED_MASK | 0x15, - /// Tear down the current process private user mappings without - /// removing the process object from the instance process table. - HExitCurrentProcess = HYPER_CALL_CODE_PRIVILEGED_MASK | 0x16, /// Just a benchmark hypercall for VM call overhead measurement. HBenchVMCall = HYPER_CALL_CODE_PRIVILEGED_MASK | 0xff, /// Just a benchmark hypercall for EPT mmap overhead measurement. @@ -89,9 +86,6 @@ impl core::fmt::Debug for HyperCallCode { HyperCallCode::HMMapSync => write!(f, "HMMapSync {:#x}", *self as u32), HyperCallCode::HSetEptFaultMode => write!(f, "HSetEptFaultMode {:#x}", *self as u32), HyperCallCode::HEptSync => write!(f, "HEptSync {:#x}", *self as u32), - HyperCallCode::HExitCurrentProcess => { - write!(f, "HExitCurrentProcess {:#x}", *self as u32) - } HyperCallCode::HInitShim => write!(f, "HInitShim {:#x}", *self as u32), HyperCallCode::HSetupInstance => write!(f, "HSetupInstance {:#x}", *self as u32), HyperCallCode::HAllocMMRegion => write!(f, "HAllocMMRegion {:#x}", *self as u32),