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

Cleanups #221

Merged
merged 2 commits into from
Oct 15, 2021
Merged

Cleanups #221

merged 2 commits into from
Oct 15, 2021

Conversation

minipli-oss
Copy link
Contributor

Some minor cleanups I ran into while working on the extables fixes.

Boilerplate disclamer follows:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

According to [1] the __naked attribute is only meant for functions with
basic asm bodies. But neither kernel_main() nor ap_startup() is, so drop
the bogus attribute. It's, at best, a micro optimization not worth the
trouble.

However, make kernel_main() a __noreturn function as that's what it is.

[1] https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html#index-naked-function-attribute_002c-x86

Signed-off-by: Mathias Krause <[email protected]>
Various minor cleanups:
- use 16bit source registers when assigning segment registers to have
  matching register sizes
- don't obfuscate CR0 initialization, make it plain obvious we're
  enabling protected mode
- do the same for CR4 initalization, make it obvious we're setting it
  to PSE|PAE
- drop the unneded CLD, as we've fully assigned RFLAGS already with the
  POPF

Signed-off-by: Mathias Krause <[email protected]>
@minipli-oss
Copy link
Contributor Author

Had a braino in the top commit, so dropped it.

@wipawel
Copy link
Contributor

wipawel commented Oct 15, 2021

LGTM. Thanks!

@82marbag 82marbag merged commit 2b9f827 into KernelTestFramework:mainline Oct 15, 2021
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.

3 participants