Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

igvmbuilder: enable long mode paging in the initial VSM context #586

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

msft-jlange
Copy link
Collaborator

The VSM environment requires CR0.PG to be set when entering VTL 2 for the first time. In this environment, the IGVM file must be built with initial page tables that map the low 4 GB, which permits stage 2 to start with paging enabled. This also requires that stage 2 must start in long mode, because the paging mode cannot be changed once the VM starts executing (if CR0.PG must always be set, then it is not possible to change from 3-level PAE tables to 4-level tables). Stage 2 will still start executing in 32-bit mode as usual, and will rebuild the page tables in its own memory area, as it always has, but that code can now execute with paging enabled as required by VSM.

The VSM environment requires CR0.PG to be set when entering VTL 2 for
the first time.  In this environment, the IGVM file must be built with
initial page tables that map the low 4 GB, which permits stage 2 to
start with paging enabled.  This also requires that stage 2 must start
in long mode, because the paging mode cannot be changed once the VM
starts executing (if CR0.PG must always be set, then it is not possible
to change from 3-level PAE tables to 4-level tables).  Stage 2 will
still start executing in 32-bit mode as usual, and will rebuild the page
tables in its own memory area, as it always has, but that code can now
execute with paging enabled as required by VSM.

Signed-off-by: Jon Lange <[email protected]>
Copy link
Member

@joergroedel joergroedel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@joergroedel joergroedel merged commit be350e6 into coconut-svsm:main Jan 7, 2025
4 checks passed
@msft-jlange msft-jlange deleted the paged_stage2 branch January 7, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants