Creates hyperlight-guest-bin crate#545
Merged
danbugs merged 9 commits intohyperlight-dev:mainfrom Jun 2, 2025
Merged
Conversation
Contributor
Author
|
@jprendes ~ for this PR, we'll have to reserve |
8e14ab3 to
2a75b5e
Compare
Closed
2a75b5e to
9e6739f
Compare
simongdavies
previously approved these changes
Jun 2, 2025
Contributor
simongdavies
left a comment
There was a problem hiding this comment.
Just minor comments LGTM , lets get one other person to look at it before we merge it?
a47e6a7 to
adaa29f
Compare
ludfjig
approved these changes
Jun 2, 2025
simongdavies
approved these changes
Jun 2, 2025
It's currently hard to use the guest library. For instance, it defines a panic handler, which will cause compilation errors if a user of the library already has one defined. This commit creates a new crate to house the opinionated bits of the guest library to make its base functionality (i.e., causing VM exits, calling host functions) easier to consume without sacrificing functionality that currently exists in guest lib that makes writing guest apps easier. Aside from creating the crate, this commit also fixes up some doc references that referenced the guest lib alone. Signed-off-by: danbugs <[email protected]>
Signed-off-by: danbugs <[email protected]>
…gger + exceptions + guest function logic + guest_err - moved entrypoint to guest_bin library. W/ this, I also moved a lot of things that were only used via the entrypoint: -- IDT/GDT setup for exceptions. -- guest_logger. - w/ the entrypoint fxn from the guest lib having moved, I re-named that module to 'exit' as it still contains stuff for aborting guest execution. I also moved OUT functions there like 'outb' and 'out32'. - a lot of our public functions in the guest lib, like, for example, push_shared_output_data relied on a pub(crate) global (i.e., P_PEB) being set. W/ that only ever being set in the entrypoint and w/ it not being appropriate as pub, I created a GuestHandle struct. This struct houses a *mut HyperlightPEB that operations like push_shared_output_data can leverage. bin-like crates can then create their own GuestHandle globals and use its functionality like self.push_shared_output_data(...). - moved all out guest function defintion, registration and so on to the guest_bin crate. Signed-off-by: danbugs <[email protected]>
This module defines C-wrappers for our global allocator, specific to the needs of our C-API and custom guests, so it makes sense to move it. Signed-off-by: danbugs <[email protected]>
guest lib should only contain basic functions to interact with the host. Whatever we decide to bring in as third_party deps belong in the guest_bin crate. Signed-off-by: danbugs <[email protected]>
Signed-off-by: danbugs <[email protected]>
Signed-off-by: danbugs <[email protected]>
…ning function Signed-off-by: danbugs <[email protected]>
Signed-off-by: danbugs <[email protected]>
adaa29f to
a68ff5e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR splits the
hyperlight_guestcrate into two:(1) The core
hyperlight_guestcrate: It provides only the essential building blocks for interacting with the host environment, including the VM exit mechanism (outb), abstractions for calling host functions and receiving return values, and the input/output stacks used for guest-host communication. This is the kind of crate that custom guests (e.g., Nanvix) can use to avoid duplicating code.(2) NEW The
hyperlight_guest_bincrate: This crate contains the opinionated bits of the guest library, such as the panic handler, the entry point, the guest logger, the exception handling logic, and third_party code used by our C-API.Below is a diagram to help illustrate how guests can rely on functionalities of each crate.

It might help to review this PR commit-by-commit.