-
Notifications
You must be signed in to change notification settings - Fork 41
WIP: refactor hal #647
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
base: master
Are you sure you want to change the base?
WIP: refactor hal #647
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @xvuko, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request is a work in progress (WIP) focused on refactoring the HAL (Hardware Abstraction Layer). The primary change involves moving common page-related definitions and the page_t
structure into a new hal/page.h
file. This change aims to consolidate page management and improve code organization across different architectures. The hal/page.h
header is then included in the architecture-specific pmap.h
files. Additionally, the architecture-specific pmap.h
files have had the page_t
struct and page flags removed, as these are now defined in the common hal/page.h
header.
Highlights
- Code Reorganization: Common page-related definitions and the
page_t
structure are moved to a newhal/page.h
file. - Header Inclusion: The
hal/page.h
header is included in architecture-specificpmap.h
files to provide access to the shared page definitions. - Duplication Removal: The
page_t
struct and page flags are removed from architecture-specificpmap.h
files, as they are now defined inhal/page.h
.
Changelog
Click here to see the changelog
- hal/aarch64/arch/pmap.h
- Added include for
hal/page.h
at line 20. - Removed page flags definitions from lines 40-52.
- Removed
page_t
struct definition from lines 57-63.
- Added include for
- hal/armv7a/arch/pmap.h
- Added include for
hal/page.h
at line 20. - Removed page flags definitions from lines 42-54.
- Removed
page_t
struct definition from lines 59-65.
- Added include for
- hal/armv7m/arch/pmap.h
- Added include for
hal/page.h
at line 20. - Removed page flags definitions from lines 30-42.
- Removed
page_t
struct definition from lines 47-52.
- Added include for
- hal/armv7r/arch/pmap.h
- Added include for
hal/page.h
at line 20. - Removed page flags definitions from lines 29-41.
- Removed
page_t
struct definition from lines 46-51.
- Added include for
- hal/armv8m/arch/pmap.h
- Added include for
hal/page.h
at line 20. - Removed page flags definitions from lines 29-41.
- Removed
page_t
struct definition from lines 46-51. - Removed
u32 mpr
member frompmap_t
struct definition from line 55.
- Added include for
- hal/armv8r/arch/pmap.h
- Added include for
hal/page.h
at line 20. - Removed page flags definitions from lines 29-41.
- Removed
page_t
struct definition from lines 46-51. - Removed
u32 mpr
member frompmap_t
struct definition from line 55.
- Added include for
- hal/ia32/arch/pmap.h
- Added include for
hal/page.h
at line 20. - Removed page flags definitions from lines 53-65.
- Removed
page_t
struct definition from lines 77-83.
- Added include for
- hal/page.h
- Created new file
hal/page.h
containing common page definitions and thepage_t
structure.
- Created new file
- hal/pmap.h
- No significant changes.
- hal/riscv64/arch/pmap.h
- Added include for
hal/page.h
at line 19. - Removed page flags definitions from lines 36-48.
- Removed
PAGE_ALIGN
andPAGE_OFFS
macros from lines 61-62. - Removed
page_t
struct definition from lines 66-72.
- Added include for
- hal/sparcv8leon/arch/pmap.h
- Added include for
hal/types.h
at line 19. - Added include for
hal/page.h
at line 20. - Removed page flags definitions from lines 46-58.
- Removed
PAGE_ALIGN
andPAGE_OFFS
macros from lines 79-80. - Removed
page_t
struct definition from lines 83-89. - Removed
u32 mpr
member frompmap_t
struct definition from line 110.
- Added include for
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
A page, a frame,
Memory's neat domain grows,
HAL's order takes hold.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request refactors the HAL (Hardware Abstraction Layer) related to memory management, specifically the pmap (physical map) component. The changes involve moving common page definitions into a shared hal/page.h
file and removing redundant definitions from architecture-specific pmap headers. The goal appears to be to reduce code duplication and improve maintainability. The changes look good overall, but there are a few things that can be improved.
Summary of Findings
- Inclusion of
hal/page.h
: The addition ofhal/page.h
in multiple architecture-specificpmap.h
files introduces a dependency that might not be necessary for all architectures. It's important to ensure that each architecture truly requires the definitions inhal/page.h
to avoid unnecessary coupling. - Removal of page flags and
page_t
struct: The removal of page flags and thepage_t
struct from architecture-specificpmap.h
files centralizes these definitions inhal/page.h
. This is generally good for maintainability, but it's crucial to verify that all architectures still function correctly with this change and that no architecture-specific customizations are lost. - Copyright year: The copyright year in
hal/page.h
is 2025, which is in the future. This should be corrected to the current year or a range that includes the current year.
Merge Readiness
The pull request is not quite ready for merging. While the refactoring aims to improve code maintainability and reduce duplication, the potential impact on individual architectures needs careful verification. The copyright year in hal/page.h
should also be corrected. I am unable to approve this pull request, and recommend that these issues be addressed before merging, and that others review and approve this code before merging.
Description
Motivation and Context
Types of changes
How Has This Been Tested?
Checklist:
Special treatment