Skip to content

Commit c685371

Browse files
committed
[guest/entrypoint,host/drivers] change the ABI of entrypoint from win64
Originally, because we only supported PE, our entrypoint used the win64 ABI. Now, with PE file support being removed, we can use an ABI that wouldn't be restrictive in compiling the guest library to targets that don't support the win64 ABI. Signed-off-by: danbugs <[email protected]>
1 parent 6f4c705 commit c685371

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/hyperlight_guest/src/entrypoint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static INIT: Once = Once::new();
7676
// Note: entrypoint cannot currently have a stackframe >4KB, as that will invoke __chkstk on msvc
7777
// target without first having setup global `RUNNING_MODE` variable, which __chkstk relies on.
7878
#[no_mangle]
79-
pub extern "win64" fn entrypoint(peb_address: u64, seed: u64, ops: u64, max_log_level: u64) {
79+
pub extern "C" fn entrypoint(peb_address: u64, seed: u64, ops: u64, max_log_level: u64) {
8080
if peb_address == 0 {
8181
panic!("PEB address is null");
8282
}

src/hyperlight_host/src/hypervisor/hyperv_linux.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,10 @@ impl Hypervisor for HypervLinuxDriver {
476476
rflags: 2, //bit 1 of rlags is required to be set
477477

478478
// function args
479-
rcx: peb_addr.into(),
480-
rdx: seed,
481-
r8: page_size.into(),
482-
r9: max_guest_log_level,
479+
rdi: peb_addr.into(),
480+
rsi: seed,
481+
rdx: page_size.into(),
482+
rcx: max_guest_log_level,
483483

484484
..Default::default()
485485
};

src/hyperlight_host/src/hypervisor/hyperv_windows.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,10 @@ impl Hypervisor for HypervWindowsDriver {
321321
rsp: self.orig_rsp.absolute()?,
322322

323323
// function args
324-
rcx: peb_address.into(),
325-
rdx: seed,
326-
r8: page_size.into(),
327-
r9: max_guest_log_level,
324+
rdi: peb_address.into(),
325+
rsi: seed,
326+
rdx: page_size.into(),
327+
rcx: max_guest_log_level,
328328
rflags: 1 << 1, // eflags bit index 1 is reserved and always needs to be 1
329329

330330
..Default::default()

src/hyperlight_host/src/hypervisor/kvm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,10 @@ impl Hypervisor for KVMDriver {
420420
rsp: self.orig_rsp.absolute()?,
421421

422422
// function args
423-
rcx: peb_addr.into(),
424-
rdx: seed,
425-
r8: page_size.into(),
426-
r9: max_guest_log_level,
423+
rdi: peb_addr.into(),
424+
rsi: seed,
425+
rdx: page_size.into(),
426+
rcx: max_guest_log_level,
427427

428428
..Default::default()
429429
};

0 commit comments

Comments
 (0)