Skip to content

Remove dependency on the paste crate #467

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

Merged
merged 1 commit into from
May 7, 2025
Merged
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
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion src/hyperlight_host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ goblin = { version = "0.9" }
rand = { version = "0.9" }
cfg-if = { version = "1.0.0" }
libc = { version = "0.2.172" }
paste = "1.0"
flatbuffers = "25.2.10"
page_size = "0.6.0"
termcolor = "1.2.0"
Expand Down
23 changes: 10 additions & 13 deletions src/hyperlight_host/src/mem/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use std::fmt::Debug;
use std::mem::{offset_of, size_of};

use hyperlight_common::mem::{GuestStackData, HyperlightPEB, RunMode, PAGE_SIZE_USIZE};
use paste::paste;
use rand::{rng, RngCore};
use tracing::{instrument, Span};

Expand Down Expand Up @@ -737,14 +736,12 @@ impl SandboxMemoryLayout {
) -> Result<()> {
macro_rules! get_address {
($something:ident) => {
paste! {
if run_inprocess {
let offset = self.[<$something _offset>];
let calculated_addr = shared_mem.calculate_address(offset)?;
u64::try_from(calculated_addr)?
} else {
u64::try_from(guest_offset + self.[<$something _offset>])?
}
if run_inprocess {
let offset = self.$something;
let calculated_addr = shared_mem.calculate_address(offset)?;
u64::try_from(calculated_addr)?
} else {
u64::try_from(guest_offset + self.$something)?
}
};
}
Expand Down Expand Up @@ -789,7 +786,7 @@ impl SandboxMemoryLayout {
.get_input_data_size()
.try_into()?,
)?;
let addr = get_address!(input_data_buffer);
let addr = get_address!(input_data_buffer_offset);
shared_mem.write_u64(self.get_input_data_pointer_offset(), addr)?;

// Set up output buffer pointer
Expand All @@ -799,11 +796,11 @@ impl SandboxMemoryLayout {
.get_output_data_size()
.try_into()?,
)?;
let addr = get_address!(output_data_buffer);
let addr = get_address!(output_data_buffer_offset);
shared_mem.write_u64(self.get_output_data_pointer_offset(), addr)?;

// Set up the guest panic context buffer
let addr = get_address!(guest_panic_context_buffer);
let addr = get_address!(guest_panic_context_buffer_offset);
shared_mem.write_u64(
self.get_guest_panic_context_size_offset(),
self.sandbox_memory_config
Expand All @@ -813,7 +810,7 @@ impl SandboxMemoryLayout {
shared_mem.write_u64(self.get_guest_panic_context_buffer_pointer_offset(), addr)?;

// Set up heap buffer pointer
let addr = get_address!(guest_heap_buffer);
let addr = get_address!(guest_heap_buffer_offset);
shared_mem.write_u64(self.get_heap_size_offset(), self.heap_size.try_into()?)?;
shared_mem.write_u64(self.get_heap_pointer_offset(), addr)?;

Expand Down