Skip to content

Relocate x86 GDT before kernel handoff - #14

Closed
wangrunji0408 wants to merge 1 commit into
mainfrom
codex/relocate-x86-gdt
Closed

wangrunji0408 wants to merge 1 commit into
mainfrom
codex/relocate-x86-gdt

Conversation

@wangrunji0408

Copy link
Copy Markdown
Member

Summary

  • copy the firmware GDT into loader-owned memory
  • reload GDTR with the high-half physical-memory alias after exiting boot services
  • extend the x86_64 example kernel test to reject a low GDTR base

Root cause

rboot has inherited the firmware GDT since the initial implementation (f4c027e). The GDTR base therefore remains in the low identity-mapped address range when control is handed to the kernel. Once the kernel replaces the firmware page tables, later descriptor-table access can fault. The recent zCore rboot update exposed this pre-existing handoff bug; it did not introduce the missing relocation.

Verification

  • cargo fmt --check
  • cargo clippy --target x86_64-unknown-uefi -- -D warnings
  • cargo check --target aarch64-unknown-uefi
  • ./example-kernel/test.sh
  • confirmed the new GDTR assertion fails on current main and passes with this change

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.

1 participant