1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-11-13 11:04:27 -05:00

Add enum KernAux_Multiboot2_HTag_RelocatableHeader_Preference

This commit is contained in:
Alex Kotov 2022-01-14 09:43:59 +05:00
parent df4f518f77
commit 5a7a745c22
2 changed files with 24 additions and 6 deletions

View file

@ -35,6 +35,12 @@ extern "C" {
#define KERNAUX_MULTIBOOT2_HTAG_FLAGS_REQUIRE_CONSOLE (1 << 0)
#define KERNAUX_MULTIBOOT2_HTAG_FLAGS_EGA_SUPPORT (1 << 1)
enum KernAux_Multiboot2_HTag_RelocatableHeader_Preference {
KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_NONE = 0,
KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_LOWEST = 1,
KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_HIGHEST = 2,
};
/****************
* Common types *
****************/
@ -214,10 +220,10 @@ struct KernAux_Multiboot2_HTag_RelocatableHeader {
// size = 24
struct KernAux_Multiboot2_HTagBase base;
unsigned min_addr : 32;
unsigned max_addr : 32;
unsigned align : 32;
unsigned preferences : 32;
unsigned min_addr : 32;
unsigned max_addr : 32;
unsigned align : 32;
enum KernAux_Multiboot2_HTag_RelocatableHeader_Preference preferences : 32;
}
__attribute__((packed));

View file

@ -238,10 +238,22 @@ bool KernAux_Multiboot2_HTag_EFIAmd64EntryAddr_is_valid(
bool KernAux_Multiboot2_HTag_RelocatableHeader_is_valid(
const struct KernAux_Multiboot2_HTag_RelocatableHeader *tag
) {
return (
if (!(
tag->base.type == KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER &&
tag->base.size == 24 &&
// TODO: write this
true
);
)) {
return false;
}
switch (tag->preferences) {
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_NONE: break;
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_LOWEST: break;
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_HIGHEST: break;
default:
return false;
}
return true;
}