Skip to content

Commit cd065b1

Browse files
committed
fix: replace all the remaining nanvix-unstable with i686-guest
Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
1 parent 16a47ac commit cd065b1

File tree

9 files changed

+35
-32
lines changed

9 files changed

+35
-32
lines changed

src/hyperlight_common/src/mem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ pub struct HyperlightPEB {
7777
/// [`FileMappingInfo`] entries), NOT a byte size. `ptr` holds the
7878
/// guest address of the preallocated array (immediately after the
7979
/// PEB struct).
80-
#[cfg(feature = "nanvix-unstable")]
80+
#[cfg(feature = "i686-guest")]
8181
pub file_mappings: GuestMemoryRegion,
8282
}

src/hyperlight_host/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ fn main() -> Result<()> {
105105
crashdump: { all(feature = "crashdump", target_arch = "x86_64") },
106106
// print_debug feature is aliased with debug_assertions to make it only available in debug-builds.
107107
print_debug: { all(feature = "print_debug", debug_assertions) },
108-
// gdb needs writable snapshot memory for debug access.
109-
unshared_snapshot_mem: { feature = "gdb" },
108+
// gdb and i686-guest need writable snapshot memory.
109+
unshared_snapshot_mem: { any(feature = "gdb", feature = "i686-guest") },
110110
}
111111

112112
#[cfg(feature = "build-metadata")]

src/hyperlight_host/src/mem/elf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ use goblin::elf::reloc::{R_AARCH64_NONE, R_AARCH64_RELATIVE};
2222
#[cfg(target_arch = "x86_64")]
2323
use goblin::elf::reloc::{R_X86_64_NONE, R_X86_64_RELATIVE};
2424
use goblin::elf::{Elf, ProgramHeaders, Reloc};
25-
#[cfg(feature = "nanvix-unstable")]
25+
#[cfg(feature = "i686-guest")]
2626
use goblin::elf32::program_header::PT_LOAD;
27-
#[cfg(not(feature = "nanvix-unstable"))]
27+
#[cfg(not(feature = "i686-guest"))]
2828
use goblin::elf64::program_header::PT_LOAD;
2929

3030
use super::exe::LoadInfo;

src/hyperlight_host/src/mem/layout.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ pub(crate) struct SandboxMemoryLayout {
227227
peb_output_data_offset: usize,
228228
peb_init_data_offset: usize,
229229
peb_heap_data_offset: usize,
230-
#[cfg(feature = "nanvix-unstable")]
230+
#[cfg(feature = "i686-guest")]
231231
peb_file_mappings_offset: usize,
232232

233233
guest_heap_buffer_offset: usize,
@@ -281,7 +281,7 @@ impl Debug for SandboxMemoryLayout {
281281
"Guest Heap Offset",
282282
&format_args!("{:#x}", self.peb_heap_data_offset),
283283
);
284-
#[cfg(feature = "nanvix-unstable")]
284+
#[cfg(feature = "i686-guest")]
285285
ff.field(
286286
"File Mappings Offset",
287287
&format_args!("{:#x}", self.peb_file_mappings_offset),
@@ -350,7 +350,7 @@ impl SandboxMemoryLayout {
350350
let peb_output_data_offset = peb_offset + offset_of!(HyperlightPEB, output_stack);
351351
let peb_init_data_offset = peb_offset + offset_of!(HyperlightPEB, init_data);
352352
let peb_heap_data_offset = peb_offset + offset_of!(HyperlightPEB, guest_heap);
353-
#[cfg(feature = "nanvix-unstable")]
353+
#[cfg(feature = "i686-guest")]
354354
let peb_file_mappings_offset = peb_offset + offset_of!(HyperlightPEB, file_mappings);
355355

356356
// The following offsets are the actual values that relate to memory layout,
@@ -365,14 +365,14 @@ impl SandboxMemoryLayout {
365365
// many file mappings the host will register, so we reserve space for
366366
// the maximum number.
367367
// The heap starts at the next page boundary after this reserved area.
368-
#[cfg(feature = "nanvix-unstable")]
368+
#[cfg(feature = "i686-guest")]
369369
let file_mappings_array_end = peb_offset
370370
+ size_of::<HyperlightPEB>()
371371
+ hyperlight_common::mem::MAX_FILE_MAPPINGS
372372
* size_of::<hyperlight_common::mem::FileMappingInfo>();
373-
#[cfg(feature = "nanvix-unstable")]
373+
#[cfg(feature = "i686-guest")]
374374
let guest_heap_buffer_offset = file_mappings_array_end.next_multiple_of(PAGE_SIZE_USIZE);
375-
#[cfg(not(feature = "nanvix-unstable"))]
375+
#[cfg(not(feature = "i686-guest"))]
376376
let guest_heap_buffer_offset =
377377
(peb_offset + size_of::<HyperlightPEB>()).next_multiple_of(PAGE_SIZE_USIZE);
378378

@@ -386,7 +386,7 @@ impl SandboxMemoryLayout {
386386
peb_output_data_offset,
387387
peb_init_data_offset,
388388
peb_heap_data_offset,
389-
#[cfg(feature = "nanvix-unstable")]
389+
#[cfg(feature = "i686-guest")]
390390
peb_file_mappings_offset,
391391
sandbox_memory_config: cfg,
392392
code_size,
@@ -513,26 +513,26 @@ impl SandboxMemoryLayout {
513513

514514
/// Get the offset in guest memory to the file_mappings count field
515515
/// (the `size` field of the `GuestMemoryRegion` in the PEB).
516-
#[cfg(feature = "nanvix-unstable")]
516+
#[cfg(feature = "i686-guest")]
517517
pub(crate) fn get_file_mappings_size_offset(&self) -> usize {
518518
self.peb_file_mappings_offset
519519
}
520520

521521
/// Get the offset in guest memory to the file_mappings pointer field.
522-
#[cfg(feature = "nanvix-unstable")]
522+
#[cfg(feature = "i686-guest")]
523523
fn get_file_mappings_pointer_offset(&self) -> usize {
524524
self.get_file_mappings_size_offset() + size_of::<u64>()
525525
}
526526

527527
/// Get the offset in snapshot memory where the FileMappingInfo array starts
528528
/// (immediately after the PEB struct, within the same page).
529-
#[cfg(feature = "nanvix-unstable")]
529+
#[cfg(feature = "i686-guest")]
530530
pub(crate) fn get_file_mappings_array_offset(&self) -> usize {
531531
self.peb_offset + size_of::<HyperlightPEB>()
532532
}
533533

534534
/// Get the guest address of the FileMappingInfo array.
535-
#[cfg(feature = "nanvix-unstable")]
535+
#[cfg(feature = "i686-guest")]
536536
fn get_file_mappings_array_gva(&self) -> u64 {
537537
(Self::BASE_ADDRESS + self.get_file_mappings_array_offset()) as u64
538538
}
@@ -641,7 +641,7 @@ impl SandboxMemoryLayout {
641641
}
642642

643643
// PEB + preallocated FileMappingInfo array
644-
#[cfg(feature = "nanvix-unstable")]
644+
#[cfg(feature = "i686-guest")]
645645
let heap_offset = {
646646
let peb_and_array_size = size_of::<HyperlightPEB>()
647647
+ hyperlight_common::mem::MAX_FILE_MAPPINGS
@@ -652,7 +652,7 @@ impl SandboxMemoryLayout {
652652
Peb,
653653
)
654654
};
655-
#[cfg(not(feature = "nanvix-unstable"))]
655+
#[cfg(not(feature = "i686-guest"))]
656656
let heap_offset =
657657
builder.push_page_aligned(size_of::<HyperlightPEB>(), MemoryRegionFlags::READ, Peb);
658658

@@ -799,9 +799,9 @@ impl SandboxMemoryLayout {
799799
// later by map_file_cow / evolve).
800800
// - The `ptr` field holds the guest address of the preallocated
801801
// FileMappingInfo array
802-
#[cfg(feature = "nanvix-unstable")]
802+
#[cfg(feature = "i686-guest")]
803803
write_u64(mem, self.get_file_mappings_size_offset(), 0)?;
804-
#[cfg(feature = "nanvix-unstable")]
804+
#[cfg(feature = "i686-guest")]
805805
write_u64(
806806
mem,
807807
self.get_file_mappings_pointer_offset(),
@@ -863,11 +863,11 @@ mod tests {
863863
expected_size += layout.code_size;
864864

865865
// PEB + preallocated FileMappingInfo array
866-
#[cfg(feature = "nanvix-unstable")]
866+
#[cfg(feature = "i686-guest")]
867867
let peb_and_array = size_of::<HyperlightPEB>()
868868
+ hyperlight_common::mem::MAX_FILE_MAPPINGS
869869
* size_of::<hyperlight_common::mem::FileMappingInfo>();
870-
#[cfg(not(feature = "nanvix-unstable"))]
870+
#[cfg(not(feature = "i686-guest"))]
871871
let peb_and_array = size_of::<HyperlightPEB>();
872872
expected_size += peb_and_array.next_multiple_of(PAGE_SIZE_USIZE);
873873

src/hyperlight_host/src/mem/mgr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
#[cfg(feature = "nanvix-unstable")]
16+
#[cfg(feature = "i686-guest")]
1717
use std::mem::offset_of;
1818

1919
use flatbuffers::FlatBufferBuilder;
@@ -361,7 +361,7 @@ impl SandboxMemoryManager<HostSharedMemory> {
361361
///
362362
/// [`FileMappingInfo`]: hyperlight_common::mem::FileMappingInfo
363363
/// [`MAX_FILE_MAPPINGS`]: hyperlight_common::mem::MAX_FILE_MAPPINGS
364-
#[cfg(feature = "nanvix-unstable")]
364+
#[cfg(feature = "i686-guest")]
365365
pub(crate) fn write_file_mapping_entry(
366366
&mut self,
367367
guest_addr: u64,

src/hyperlight_host/src/sandbox/file_mapping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub(crate) struct PreparedFileMapping {
5858
/// The page-aligned size of the mapping in bytes.
5959
pub(crate) size: usize,
6060
/// Null-terminated C-style label for this mapping (max 63 chars + null).
61-
#[cfg_attr(not(feature = "nanvix-unstable"), allow(unused))]
61+
#[cfg_attr(not(feature = "i686-guest"), allow(unused))]
6262
pub(crate) label: [u8; hyperlight_common::mem::FILE_MAPPING_LABEL_MAX_LEN + 1],
6363
/// Host-side OS resources. `None` after successful consumption
6464
/// by the apply step (ownership transferred to the VM layer).

src/hyperlight_host/src/sandbox/initialized_multi_use.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -616,13 +616,13 @@ impl MultiUseSandbox {
616616

617617
// Pre-check the file mapping limit before doing any expensive
618618
// OS or VM work. The PEB count is the source of truth.
619-
#[cfg(feature = "nanvix-unstable")]
619+
#[cfg(feature = "i686-guest")]
620620
let current_count = self
621621
.mem_mgr
622622
.shared_mem
623623
.read::<u64>(self.mem_mgr.layout.get_file_mappings_size_offset())?
624624
as usize;
625-
#[cfg(feature = "nanvix-unstable")]
625+
#[cfg(feature = "i686-guest")]
626626
if current_count >= hyperlight_common::mem::MAX_FILE_MAPPINGS {
627627
return Err(crate::HyperlightError::Error(format!(
628628
"map_file_cow: file mapping limit reached ({} of {})",
@@ -694,7 +694,7 @@ impl MultiUseSandbox {
694694
// still holds a valid mapping but the PEB won't list it — the
695695
// limit was already pre-checked above so this should not fail
696696
// in practice.
697-
#[cfg(feature = "nanvix-unstable")]
697+
#[cfg(feature = "i686-guest")]
698698
self.mem_mgr
699699
.write_file_mapping_entry(prepared.guest_base, size, &prepared.label)?;
700700

@@ -2192,7 +2192,7 @@ mod tests {
21922192
/// the FileMappingInfo entry (count, guest_addr, size, label) into
21932193
/// the PEB.
21942194
#[test]
2195-
#[cfg(feature = "nanvix-unstable")]
2195+
#[cfg(feature = "i686-guest")]
21962196
fn test_map_file_cow_peb_entry_multiuse() {
21972197
use std::mem::offset_of;
21982198

@@ -2268,7 +2268,7 @@ mod tests {
22682268
/// Tests that deferred `map_file_cow` (before evolve) correctly
22692269
/// writes FileMappingInfo entries into the PEB during evolve.
22702270
#[test]
2271-
#[cfg(feature = "nanvix-unstable")]
2271+
#[cfg(feature = "i686-guest")]
22722272
fn test_map_file_cow_peb_entry_deferred() {
22732273
use std::mem::offset_of;
22742274

@@ -2342,7 +2342,7 @@ mod tests {
23422342
/// populates all PEB FileMappingInfo slots with the right guest_addr,
23432343
/// size, and label for each entry.
23442344
#[test]
2345-
#[cfg(feature = "nanvix-unstable")]
2345+
#[cfg(feature = "i686-guest")]
23462346
fn test_map_file_cow_peb_multiple_entries() {
23472347
use std::mem::{offset_of, size_of};
23482348

src/hyperlight_host/src/sandbox/snapshot.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,10 @@ impl Snapshot {
997997
Ok::<(Vec<u8>, Vec<u8>), crate::HyperlightError>((snapshot_memory, pt_bytes))
998998
})
999999
})???;
1000+
#[cfg(feature = "i686-guest")]
10001001
let (memory, separate_pt_bytes) = memory;
1002+
#[cfg(not(feature = "i686-guest"))]
1003+
let (memory, _) = memory;
10011004
layout.set_snapshot_size(memory.len());
10021005

10031006
// For i686, keep the regions so the RAMFS and other map_file_cow

src/hyperlight_host/src/sandbox/uninitialized_evolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub(super) fn evolve_impl_multi_use(u_sbox: UninitializedSandbox) -> Result<Mult
114114
// it — acceptable since we're about to return Err and the
115115
// VM will be dropped. The limit was already validated in
116116
// UninitializedSandbox::map_file_cow.
117-
#[cfg(feature = "nanvix-unstable")]
117+
#[cfg(feature = "i686-guest")]
118118
hshm.write_file_mapping_entry(prepared.guest_base, prepared.size as u64, &prepared.label)?;
119119
hshm.mapped_rgns += 1;
120120
}

0 commit comments

Comments
 (0)