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

Implement page table reader for aarch64 #121

Merged
merged 7 commits into from
May 8, 2023
Merged

Conversation

PandaZ3D
Copy link
Contributor

This PR implements part of the paging system which deals with reading the memory mappings created by the bootloader. It assumes, for now, that the hardware supports a 4 KiB translation table granule and that the bootloader uses this granule size to set up our initial page tables.

The biggest change is a slight modification of the APIs between the aarch specific code and the generic code for memory management. Specifically to determine certain properties (i.e., physical address) in a PTE for aarch64, we need to know what level we are at. For x86_64 this is a different story, and the bits in the PTE corresponding to the physical address are more/less in the same.

Summary

  • code required to read the page table entries
  • define the page table structure for 4 KiB pages
  • cleanup code (comments, organize address, etc.)

@PandaZ3D PandaZ3D self-assigned this Apr 29, 2023
@PandaZ3D PandaZ3D added enhancement New feature or request kernel Internal kernel issues labels Apr 29, 2023
@PandaZ3D PandaZ3D mentioned this pull request Apr 29, 2023
Copy link
Contributor

@gvnn3 gvnn3 left a comment

Choose a reason for hiding this comment

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

A strange calculation, can you give the numbers names or put in a comment?


/// Get the level of the last page table.
pub fn last_level() -> usize {
0
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need a const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can be

@PandaZ3D PandaZ3D requested a review from gvnn3 May 4, 2023 03:39
Copy link
Contributor

@gvnn3 gvnn3 left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes.

@PandaZ3D PandaZ3D merged commit f806c93 into main May 8, 2023
1 check passed
@PandaZ3D PandaZ3D deleted the aaboytes/aarch64-read-pt branch June 21, 2023 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request kernel Internal kernel issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants