Skip to content

Remove unused page_size guest parameter #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions src/hyperlight_guest/src/entrypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use crate::guest_logger::init_logger;
use crate::host_function_call::{outb, OutBAction};
use crate::idtr::load_idt;
use crate::{
__security_cookie, HEAP_ALLOCATOR, MIN_STACK_ADDRESS, OS_PAGE_SIZE, OUTB_PTR,
OUTB_PTR_WITH_CONTEXT, P_PEB, RUNNING_MODE,
__security_cookie, HEAP_ALLOCATOR, MIN_STACK_ADDRESS, OUTB_PTR, OUTB_PTR_WITH_CONTEXT, P_PEB,
RUNNING_MODE,
};

#[inline(never)]
Expand Down Expand Up @@ -77,7 +77,7 @@ static INIT: Once = Once::new();
// Note: entrypoint cannot currently have a stackframe >4KB, as that will invoke __chkstk on msvc
// target without first having setup global `RUNNING_MODE` variable, which __chkstk relies on.
#[no_mangle]
pub extern "win64" fn entrypoint(peb_address: u64, seed: u64, ops: u64, max_log_level: u64) {
pub extern "win64" fn entrypoint(peb_address: u64, seed: u64, max_log_level: u64) {
if peb_address == 0 {
panic!("PEB address is null");
}
Expand Down Expand Up @@ -142,8 +142,6 @@ pub extern "win64" fn entrypoint(peb_address: u64, seed: u64, ops: u64, max_log_
.expect("Failed to access HEAP_ALLOCATOR")
.init(heap_start, heap_size);

OS_PAGE_SIZE = ops as u32;

(*peb_ptr).guest_function_dispatch_ptr = dispatch_function as usize as u64;

reset_error();
Expand Down
1 change: 0 additions & 1 deletion src/hyperlight_guest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ pub(crate) static mut __security_cookie: u64 = 0;
pub(crate) static mut P_PEB: Option<*mut HyperlightPEB> = None;
pub static mut MIN_STACK_ADDRESS: u64 = 0;

pub static mut OS_PAGE_SIZE: u32 = 0;
pub(crate) static mut OUTB_PTR: Option<extern "win64" fn(u16, u8)> = None;
pub(crate) static mut OUTB_PTR_WITH_CONTEXT: Option<
extern "win64" fn(*mut core::ffi::c_void, u16, u8),
Expand Down
1 change: 0 additions & 1 deletion src/hyperlight_host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ cfg-if = { version = "1.0.0" }
libc = { version = "0.2.170" }
paste = "1.0"
flatbuffers = "25.2.10"
page_size = "0.6.0"
termcolor = "1.2.0"
bitflags = "2.9.0"
lazy_static = "1.4.0"
Expand Down
4 changes: 1 addition & 3 deletions src/hyperlight_host/src/hypervisor/hyperv_linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ impl Hypervisor for HypervLinuxDriver {
&mut self,
peb_addr: RawPtr,
seed: u64,
page_size: u32,
outb_hdl: OutBHandlerWrapper,
mem_access_hdl: MemAccessHandlerWrapper,
hv_handler: Option<HypervisorHandler>,
Expand All @@ -215,8 +214,7 @@ impl Hypervisor for HypervLinuxDriver {
// function args
rcx: peb_addr.into(),
rdx: seed,
r8: page_size.into(),
r9: self.get_max_log_level().into(),
r8: self.get_max_log_level().into(),

..Default::default()
};
Expand Down
4 changes: 1 addition & 3 deletions src/hyperlight_host/src/hypervisor/hyperv_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ impl Hypervisor for HypervWindowsDriver {
&mut self,
peb_address: RawPtr,
seed: u64,
page_size: u32,
outb_hdl: OutBHandlerWrapper,
mem_access_hdl: MemAccessHandlerWrapper,
hv_handler: Option<HypervisorHandler>,
Expand All @@ -316,8 +315,7 @@ impl Hypervisor for HypervWindowsDriver {
// function args
rcx: peb_address.into(),
rdx: seed,
r8: page_size.into(),
r9: self.get_max_log_level().into(),
r8: self.get_max_log_level().into(),
rflags: 1 << 1, // eflags bit index 1 is reserved and always needs to be 1

..Default::default()
Expand Down
2 changes: 0 additions & 2 deletions src/hyperlight_host/src/hypervisor/hypervisor_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ struct HvHandlerCommChannels {
pub(crate) struct HvHandlerConfig {
pub(crate) peb_addr: RawPtr,
pub(crate) seed: u64,
pub(crate) page_size: u32,
pub(crate) dispatch_function_addr: Arc<Mutex<Option<RawPtr>>>,
pub(crate) max_init_time: Duration,
pub(crate) max_exec_time: Duration,
Expand Down Expand Up @@ -353,7 +352,6 @@ impl HypervisorHandler {
let res = hv.initialise(
configuration.peb_addr.clone(),
configuration.seed,
configuration.page_size,
configuration.outb_handler.clone(),
configuration.mem_access_handler.clone(),
Some(hv_handler_clone.clone()),
Expand Down
10 changes: 2 additions & 8 deletions src/hyperlight_host/src/hypervisor/inprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,15 @@ impl<'a> Hypervisor for InprocessDriver<'a> {
&mut self,
_peb_addr: crate::mem::ptr::RawPtr,
seed: u64,
page_size: u32,
_outb_handle_fn: super::handlers::OutBHandlerWrapper,
_mem_access_fn: super::handlers::MemAccessHandlerWrapper,
_hv_handler: Option<super::hypervisor_handler::HypervisorHandler>,
#[cfg(gdb)] _dbg_mem_access_fn: DbgMemAccessHandlerWrapper,
) -> crate::Result<()> {
let entrypoint_fn: extern "win64" fn(u64, u64, u64, u64) =
let entrypoint_fn: extern "win64" fn(u64, u64, u64) =
unsafe { std::mem::transmute(self.args.entrypoint_raw as *const c_void) };

entrypoint_fn(
self.args.peb_ptr_raw,
seed,
page_size as u64,
log::max_level() as u64,
);
entrypoint_fn(self.args.peb_ptr_raw, seed, log::max_level() as u64);

Ok(())
}
Expand Down
4 changes: 1 addition & 3 deletions src/hyperlight_host/src/hypervisor/kvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,6 @@ impl Hypervisor for KVMDriver {
&mut self,
peb_addr: RawPtr,
seed: u64,
page_size: u32,
outb_hdl: OutBHandlerWrapper,
mem_access_hdl: MemAccessHandlerWrapper,
hv_handler: Option<HypervisorHandler>,
Expand All @@ -713,8 +712,7 @@ impl Hypervisor for KVMDriver {
// function args
rcx: peb_addr.into(),
rdx: seed,
r8: page_size.into(),
r9: self.get_max_log_level().into(),
r8: self.get_max_log_level().into(),

..Default::default()
};
Expand Down
2 changes: 0 additions & 2 deletions src/hyperlight_host/src/hypervisor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ pub(crate) trait Hypervisor: Debug + Sync + Send {
&mut self,
peb_addr: RawPtr,
seed: u64,
page_size: u32,
outb_handle_fn: OutBHandlerWrapper,
mem_access_fn: MemAccessHandlerWrapper,
hv_handler: Option<HypervisorHandler>,
Expand Down Expand Up @@ -344,7 +343,6 @@ pub(crate) mod tests {
#[cfg(gdb)]
dbg_mem_access_handler: dbg_mem_access_fn,
seed: 1234567890,
page_size: 4096,
peb_addr: RawPtr::from(0x230000),
dispatch_function_addr: Arc::new(Mutex::new(None)),
max_init_time: Duration::from_millis(
Expand Down
2 changes: 0 additions & 2 deletions src/hyperlight_host/src/sandbox/uninitialized_evolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,12 @@ fn hv_init(
let peb_u64 = u64::try_from(gshm.layout.peb_address)?;
RawPtr::from(peb_u64)
};
let page_size = u32::try_from(page_size::get())?;
let hv_handler_config = HvHandlerConfig {
outb_handler: outb_hdl,
mem_access_handler: mem_access_hdl,
#[cfg(gdb)]
dbg_mem_access_handler: dbg_mem_access_hdl,
seed,
page_size,
peb_addr,
dispatch_function_addr: Arc::new(Mutex::new(None)),
max_init_time,
Expand Down
4 changes: 2 additions & 2 deletions src/tests/rust_guests/callbackguest/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/tests/rust_guests/dummyguest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ fn mmio_read() {

#[allow(non_snake_case)]
#[no_mangle]
pub extern "win64" fn entrypoint(a: i64, b: i64, c: i32) -> i32 {
if a != 0x230000 || b != 1234567890 || c != 4096 {
pub extern "win64" fn entrypoint(a: u64, b: u64) -> i32 {
if a != 0x230000 || b != 1234567890 {
mmio_read();
}
halt();
Expand Down
4 changes: 2 additions & 2 deletions src/tests/rust_guests/simpleguest/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading