Allow the guest to manage its own stack#1205
Conversation
simongdavies
left a comment
There was a problem hiding this comment.
This is great! A few minor comments and nits but otherwise LGTM.
a4a7901
6879809 to
a4a7901
Compare
|
Rebased and added fixups addressing the review comments (thanks!) |
@syntactically any opinions on this? |
@ludfjig Sorry, I missed this the first time around. I think I just added ef752ce addressing this? |
dblnz
left a comment
There was a problem hiding this comment.
Great work! I've left a couple of comments and questions.
This commit changes the code that sets up all these processor control structures to allocate pages from the scratch region, map them to an arbitrary VA, and then point the processor at that VA (in order to ensure that they survive snapshotting at the same VA). It also refactors the architecture-specific initialisation code somewhat, in order to make it a bit easier to have one memory allocation shared by all the relevant tables & in preparation for future multi-architecture support. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
A separate exception stack is needed in preparation for moving management of the main guest stack into the guest. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
They may not be terribly useful as we move towards a stack that the guest is allowed to grow on its own. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Previously, this code path was not tested, and would fail because `UninitializedSandbox::evolve()` unconditionally tried to run the guest initialisation function, which has already been run in this case. This simply ignores the initialisation stage if the snapshot has no `preinitialise` entrypoint. All that `UninitializedSandbox` is really good for at this point is registering host functions, so it might make sense to further revisit the API. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
This moves management of the guest stack into the guest, allowing the guest to flexibly allocate pages from the scratch region to the stack. This also makes the stack dynamically growable and essentially unbounded, as is common on other architectures. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
d79ffe2 to
78b07d7
Compare
This is a combination of several commits related to refactoring the guest stack from the original PR. It also addresses the longstanding issue #665.