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

How to know in which mode the kernel is booted? #203

Open
Narasimha1997 opened this issue Nov 12, 2021 · 0 comments
Open

How to know in which mode the kernel is booted? #203

Narasimha1997 opened this issue Nov 12, 2021 · 0 comments

Comments

@Narasimha1997
Copy link

As I've seen, the bootloader can boot in legacy BIOS ams UEFI modes. However, there is no way for the kernel to directly know in which mode it has been booted. This can be useful in different parts of the kernel (For example, during the initialisation of 8259 PIC as trying to enable PIC in UEFI mode double faults immediately).

One way I've seen is to iterate over the memory map and check if the regions are of type UnknownBios or UnknownUefi and take decisions. But this isn't an idiomatic way.

The best way would be to pass a flag in BootInfo struct called is_uefi which is true or false based on the mode the kernel is booted.

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

No branches or pull requests

1 participant