Conversation
| resolver = "2" | ||
| members = [ | ||
| "litebox", | ||
| "litebox-platform-linux-kernel", |
There was a problem hiding this comment.
Shall we keep the names consistent with "_"?
There was a problem hiding this comment.
Sorry, I am to blame for this; I used to use - before deciding to make everything consistent in 1e6568d by switching to underscores (which turns out to be handled better by tooling and also make more sense in use ... declarations when specifying crates). Going forward, just using _ for all crate names should keep things nice, but yeah I believe @CvvT used - because I was using - at the point where he originally started working on this PR.
There was a problem hiding this comment.
I remember we have a similar error file for the posix shim. Can we use a single error file?
There was a problem hiding this comment.
I think this should be done in a separate PR to merge things into a shared crate litebox_linux_common or similar. I agree that currently this is essentially being duplicated.
There was a problem hiding this comment.
(Fwiw, my suggestion for litebox_linux_common is a crate that also defines syscall punchthrough layer too, can explain more IRL if needed)
| @@ -0,0 +1,3 @@ | |||
| [submodule "litebox-platform-linux-kernel/sandbox_driver"] | |||
| path = litebox-platform-linux-kernel/sandbox_driver | |||
There was a problem hiding this comment.
Indexing by 4 spaces or 8 spaces?
There was a problem hiding this comment.
Is the hypercall interface the same for SNP and VBS?
There was a problem hiding this comment.
It's not clear to me why we need a host subfolder here.
| } | ||
| } | ||
|
|
||
| const NR_SYSCALL_KILL: u64 = 62; |
There was a problem hiding this comment.
Why do we define these two syscalls here? Do we need to define other syscall numbers as well?
| punchthrough: SnpPunchthrough<'a>, | ||
| } | ||
|
|
||
| impl SnpPunchthroughToken<'_> { |
There was a problem hiding this comment.
Why do we define both HostPunchThrough and SnpPunchthrough?
| RecvPacket(&'a mut [u8]), | ||
| SendPacket(&'a [u8]), |
There was a problem hiding this comment.
As I understand it, these are intended for the IP interface stuff, yes? In that case, it should not be part of punchthrough since we already have the IPInterfaceProvider trait.
| OtherPunchthrough::Syscall0(ref v) => v.into(), | ||
| OtherPunchthrough::Syscall1(ref v) => v.into(), | ||
| OtherPunchthrough::Syscall2(ref v) => v.into(), | ||
| OtherPunchthrough::Syscall3(ref v) => v.into(), | ||
| OtherPunchthrough::Syscall4(ref v) => v.into(), | ||
| OtherPunchthrough::Syscall5(ref v) => v.into(), | ||
| OtherPunchthrough::Syscall6(ref v) => v.into(), |
There was a problem hiding this comment.
Instead of match *req, if you use match req then I think you don't need these refs (modern-ish Rust tends to use refs very rarely).
|
Quick question regarding the git-submodule for |
Thanks for the suggestion! Less complexity is better. |
|
|
||
| /// Interface for punchthrough requests | ||
| pub trait HostPunchthroughProvider<'a, InOut, Other> { | ||
| type Token: HostPunchthroughToken<'a, InOut>; |
There was a problem hiding this comment.
@jaybosamiya-ms I was trying to use PunchthroughProvider but found that the associated PunchthroughToken does not have lifetime. The token may have shorter lifetime than the provider's.
There was a problem hiding this comment.
Discussed this IRL, we need to de-restrict the situations that are allowed here. Fixed by #9 which also demonstrates how a (borrowing) punchthrough and/or punchthroughtoken can be implemented.
|
Move to a new one: #10 |
macOS ARM64 does not restore x18 (platform-reserved register) from ucontext on sigreturn. This caused a crash at far=0x8 when exception_callback tried to load host_sp from [x18, #8] with x18=0. Switch to x9 (caller-saved temp register) for passing host_tls through sigreturn: set_signal_return writes to sigctx.__ss.__x[9], and both exception_callback and interrupt_callback read host_tls from x9. For the direct-branch path (switch_to_guest interrupt trampoline), add 'mov x9, x18' before branching to interrupt_callback so both paths are consistent.
Initial draft of platform for vsbox.
Run
cargo doc --features platform_snp --openand navigate to thehostmodule to see the interface design.HostPunchthroughProvider: Interface for punchthrough requestsHostPunchthroughToken: A wrapper for PunchthroughToken that has lifetimeHyperCallInterface: Interface for hypercalls (See hypercall::HyperVInterface for example)