Skip to content

Commit 1b294f6

Browse files
committed
Make map_region public
Hyperlight-wasm requires this for memory mapping in the modules. This was removed during an early iteration where this did not work but now that CoW has been released this can be exposed again for use in HL-wasm Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent 4e0ea22 commit 1b294f6

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/hyperlight_host/src/mem/memory_region.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub enum MemoryRegionType {
133133
/// A trait that distinguishes between different kinds of memory region representations.
134134
///
135135
/// This trait is used to parameterize [`MemoryRegion_`]
136-
pub(crate) trait MemoryRegionKind {
136+
pub trait MemoryRegionKind {
137137
/// The type used to represent host memory addresses.
138138
type HostBaseType: Copy;
139139

@@ -152,7 +152,7 @@ pub(crate) trait MemoryRegionKind {
152152
/// Type for memory regions that track both host and guest addresses.
153153
///
154154
#[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)]
155-
pub(crate) struct HostGuestMemoryRegion {}
155+
pub struct HostGuestMemoryRegion {}
156156

157157
#[cfg(not(target_os = "windows"))]
158158
impl MemoryRegionKind for HostGuestMemoryRegion {
@@ -233,7 +233,7 @@ impl MemoryRegionKind for GuestMemoryRegion {
233233
/// represents a single memory region inside the guest. All memory within a region has
234234
/// the same memory permissions
235235
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
236-
pub(crate) struct MemoryRegion_<K: MemoryRegionKind> {
236+
pub struct MemoryRegion_<K: MemoryRegionKind> {
237237
/// the range of guest memory addresses
238238
pub guest_region: Range<usize>,
239239
/// the range of host memory addresses
@@ -246,7 +246,7 @@ pub(crate) struct MemoryRegion_<K: MemoryRegionKind> {
246246
pub region_type: MemoryRegionType,
247247
}
248248

249-
pub(crate) type MemoryRegion = MemoryRegion_<HostGuestMemoryRegion>;
249+
pub type MemoryRegion = MemoryRegion_<HostGuestMemoryRegion>;
250250

251251
#[cfg_attr(not(feature = "init-paging"), allow(unused))]
252252
pub(crate) struct MemoryRegionVecBuilder<K: MemoryRegionKind> {

src/hyperlight_host/src/sandbox/initialized_multi_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ impl MultiUseSandbox {
527527
/// for the lifetime of `self`.
528528
#[instrument(err(Debug), skip(self, rgn), parent = Span::current())]
529529
#[cfg(target_os = "linux")]
530-
unsafe fn map_region(&mut self, rgn: &MemoryRegion) -> Result<()> {
530+
pub unsafe fn map_region(&mut self, rgn: &MemoryRegion) -> Result<()> {
531531
if self.poisoned {
532532
return Err(crate::HyperlightError::PoisonedSandbox);
533533
}

0 commit comments

Comments
 (0)