mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-13 11:04:27 -05:00
Write code
This commit is contained in:
parent
e3e42582b8
commit
a6f8cbf6e7
1 changed files with 17 additions and 0 deletions
|
@ -11,6 +11,14 @@
|
||||||
bool KernAux_Multiboot2_Header_is_valid(
|
bool KernAux_Multiboot2_Header_is_valid(
|
||||||
const struct KernAux_Multiboot2_Header *const multiboot2_header
|
const struct KernAux_Multiboot2_Header *const multiboot2_header
|
||||||
) {
|
) {
|
||||||
|
if (multiboot2_header->magic != KERNAUX_MULTIBOOT2_MAGIC) return false;
|
||||||
|
|
||||||
|
if (multiboot2_header->arch != KERNAUX_MULTIBOOT2_ARCH_I386 &&
|
||||||
|
multiboot2_header->arch != KERNAUX_MULTIBOOT2_ARCH_MIPS32)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (multiboot2_header->total_size <
|
if (multiboot2_header->total_size <
|
||||||
sizeof(struct KernAux_Multiboot2_Header) +
|
sizeof(struct KernAux_Multiboot2_Header) +
|
||||||
sizeof(struct KernAux_Multiboot2_HTag_None))
|
sizeof(struct KernAux_Multiboot2_HTag_None))
|
||||||
|
@ -18,6 +26,15 @@ bool KernAux_Multiboot2_Header_is_valid(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (multiboot2_header->checksum !=
|
||||||
|
KERNAUX_MULTIBOOT2_CHECKSUM(
|
||||||
|
multiboot2_header->arch,
|
||||||
|
multiboot2_header->total_size
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const struct KernAux_Multiboot2_HTagBase *tag_base =
|
const struct KernAux_Multiboot2_HTagBase *tag_base =
|
||||||
(struct KernAux_Multiboot2_HTagBase*)
|
(struct KernAux_Multiboot2_HTagBase*)
|
||||||
KERNAUX_MULTIBOOT2_DATA(multiboot2_header);
|
KERNAUX_MULTIBOOT2_DATA(multiboot2_header);
|
||||||
|
|
Loading…
Reference in a new issue