Skip to content

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