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

For SMP Boot Code: allocate physical memory instead #992

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sarahspberrypi
Copy link
Contributor

@sarahspberrypi sarahspberrypi commented Dec 1, 2023

Instead of forcefully writing the SMP boot code to physical address 0x8000, free physical memory is allocated.

This is fine because the application processor will install the boot processor's page table:

// Pass the PML4 page table address to the boot code.
*((SMP_BOOT_CODE_ADDRESS + SMP_BOOT_CODE_OFFSET_PML4).as_mut_ptr::<u32>()) =
cr3().try_into().unwrap();

@mkroening mkroening self-requested a review December 1, 2023 13:05
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Looks good to me. 👍

Thanks! :)

Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

As initially feared, this requires some modification of boot.s, which assumes to be loaded at 0x8000.

boot.s starts in 16-bit mode, which does not have paging yet.

Alternatively, we could allocate physical memory at exactly 0x8000 and deallocate it afterwards, if that helps.

@mkroening mkroening mentioned this pull request Apr 16, 2024
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.

None yet

2 participants