2020-12-06 23:46:37 -05:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2020-12-06 23:42:52 -05:00
|
|
|
#include "config.h"
|
2020-12-06 23:46:37 -05:00
|
|
|
#endif
|
2020-11-30 06:40:33 -05:00
|
|
|
|
2020-11-27 16:24:12 -05:00
|
|
|
#include <kernaux/multiboot2.h>
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
bool KernAux_Multiboot2_is_valid(
|
2020-11-27 19:02:44 -05:00
|
|
|
const struct KernAux_Multiboot2 *const multiboot2
|
|
|
|
) {
|
2021-12-14 14:19:29 -05:00
|
|
|
if (multiboot2->total_size <= 8) return false;
|
2020-11-27 19:02:44 -05:00
|
|
|
|
|
|
|
const struct KernAux_Multiboot2_TagBase *tag_base =
|
2022-01-11 04:29:56 -05:00
|
|
|
(struct KernAux_Multiboot2_TagBase*)KERNAUX_MULTIBOOT2_DATA(multiboot2);
|
2020-11-27 19:02:44 -05:00
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
const struct KernAux_Multiboot2_TagBase *none_tag_base = NULL;
|
2020-11-27 19:02:44 -05:00
|
|
|
|
2021-12-14 14:13:18 -05:00
|
|
|
while (tag_base <
|
|
|
|
(struct KernAux_Multiboot2_TagBase*)
|
|
|
|
((unsigned char*)multiboot2 + multiboot2->total_size))
|
|
|
|
{
|
2021-12-14 14:19:29 -05:00
|
|
|
if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) return false;
|
2020-11-27 19:02:44 -05:00
|
|
|
|
2022-01-12 21:49:25 -05:00
|
|
|
if (tag_base->type == KERNAUX_MULTIBOOT2_ITAG_NONE &&
|
2020-12-06 05:16:15 -05:00
|
|
|
none_tag_base == NULL
|
2020-11-27 19:02:44 -05:00
|
|
|
) {
|
|
|
|
none_tag_base = tag_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
tag_base = (struct KernAux_Multiboot2_TagBase*)(
|
2021-12-14 14:13:18 -05:00
|
|
|
(unsigned char*)tag_base + ((tag_base->size + 7) & ~7)
|
2020-11-27 19:02:44 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-12-14 14:13:18 -05:00
|
|
|
if (tag_base !=
|
|
|
|
(struct KernAux_Multiboot2_TagBase*)
|
|
|
|
((unsigned char*)multiboot2 + multiboot2->total_size))
|
|
|
|
{
|
2020-12-06 05:16:15 -05:00
|
|
|
return false;
|
2020-11-27 19:02:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (none_tag_base !=
|
2021-12-14 14:13:18 -05:00
|
|
|
(struct KernAux_Multiboot2_TagBase*)
|
|
|
|
((unsigned char*)tag_base - sizeof(struct KernAux_Multiboot2_Tag_None)))
|
|
|
|
{
|
2020-12-06 05:16:15 -05:00
|
|
|
return false;
|
2020-11-27 19:02:44 -05:00
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
return true;
|
2020-11-27 19:02:44 -05:00
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_TagBase_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_TagBase *const tag_base
|
|
|
|
) {
|
|
|
|
switch (tag_base->type) {
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_NONE:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_None_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_None*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_BootCmdLine_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_BootCmdLine*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_BootLoaderName_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_BootLoaderName*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_MODULE:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_Module_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_Module*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_BASIC_MEMORY_INFO:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_BasicMemoryInfo_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_BasicMemoryInfo*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_BIOS_BOOT_DEVICE:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_BIOSBootDevice_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_BIOSBootDevice*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_MemoryMap_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_MemoryMap*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_VBE_INFO:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_VBEInfo_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_VBEInfo*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_FRAMEBUFFER_INFO:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_FramebufferInfo_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_FramebufferInfo*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_ELF_SYMBOLS:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_ELFSymbols_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_ELFSymbols*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_APM_TABLE:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_APMTable_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_APMTable*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_EFI_32BIT_SYSTEM_TABLE_PTR:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_EFI32bitSystemTablePtr_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_EFI32bitSystemTablePtr*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_EFI_64BIT_SYSTEM_TABLE_PTR:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_EFI64bitSystemTablePtr_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_EFI64bitSystemTablePtr*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_SMBIOS_TABLES:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_SMBIOSTables_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_SMBIOSTables*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_ACPI_OLD_RSDP:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_ACPIOldRSDP_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_ACPIOldRSDP*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_ACPI_NEW_RSDP:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_ACPINewRSDP_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_ACPINewRSDP*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_NETWORKING_INFO:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_NetworkingInfo_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_NetworkingInfo*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_EFI_MEMORY_MAP:
|
2020-11-27 17:39:21 -05:00
|
|
|
return KernAux_Multiboot2_Tag_EFIMemoryMap_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_EFIMemoryMap*)tag_base
|
2020-11-27 16:24:12 -05:00
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_EFI_BOOT_SERVICES_NOT_TERMINATED:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_EFIBootServicesNotTerminated_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_EFIBootServicesNotTerminated*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_EFI_32BIT_IMAGE_HANDLE_PTR:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_EFI32bitImageHandlePtr_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_EFI32bitImageHandlePtr*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_EFI_64BIT_IMAGE_HANDLE_PTR:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_EFI64bitImageHandlePtr_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_EFI64bitImageHandlePtr*)tag_base
|
|
|
|
);
|
2022-01-12 21:49:25 -05:00
|
|
|
case KERNAUX_MULTIBOOT2_ITAG_IMAGE_LOAD_BASE_PHYS_ADDR:
|
2020-11-27 16:24:12 -05:00
|
|
|
return KernAux_Multiboot2_Tag_ImageLoadBasePhysAddr_is_valid(
|
|
|
|
(struct KernAux_Multiboot2_Tag_ImageLoadBasePhysAddr*)tag_base
|
|
|
|
);
|
|
|
|
default:
|
2020-12-06 05:16:15 -05:00
|
|
|
return false;
|
2020-11-27 16:24:12 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_None_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_None *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_NONE &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 8
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_BootCmdLine_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_BootCmdLine *const tag
|
|
|
|
) {
|
2021-12-16 10:26:16 -05:00
|
|
|
size_t index = 1;
|
2020-11-27 16:24:12 -05:00
|
|
|
|
|
|
|
for (
|
2022-01-11 04:29:56 -05:00
|
|
|
const char *ptr = (char*)KERNAUX_MULTIBOOT2_DATA(tag);
|
2020-11-27 16:24:12 -05:00
|
|
|
*ptr && index < tag->base.size;
|
|
|
|
++ptr
|
|
|
|
) {
|
|
|
|
++index;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 8 + index
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_BootLoaderName_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_BootLoaderName *const tag
|
|
|
|
) {
|
2021-12-16 10:26:16 -05:00
|
|
|
size_t index = 1;
|
2020-11-27 16:24:12 -05:00
|
|
|
|
|
|
|
for (
|
2022-01-11 04:29:56 -05:00
|
|
|
const char *ptr = (char*)KERNAUX_MULTIBOOT2_DATA(tag);
|
2020-11-27 16:24:12 -05:00
|
|
|
*ptr && index < tag->base.size;
|
|
|
|
++ptr
|
|
|
|
) {
|
|
|
|
++index;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 8 + index
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_Module_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_Module *const tag
|
|
|
|
) {
|
2021-12-16 10:26:16 -05:00
|
|
|
size_t index = 1;
|
2020-11-27 16:24:12 -05:00
|
|
|
|
|
|
|
for (
|
2022-01-11 04:29:56 -05:00
|
|
|
const char *ptr = (char*)KERNAUX_MULTIBOOT2_DATA(tag);
|
2020-11-27 16:24:12 -05:00
|
|
|
*ptr && index < tag->base.size;
|
|
|
|
++ptr
|
|
|
|
) {
|
|
|
|
++index;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_MODULE &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 16 + index &&
|
|
|
|
tag->mod_start < tag->mod_end
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_BasicMemoryInfo_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_BasicMemoryInfo *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_BASIC_MEMORY_INFO &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 16
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_BIOSBootDevice_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_BIOSBootDevice *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_BIOS_BOOT_DEVICE &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 20
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_MemoryMap_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_MemoryMap *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size >= 16 &&
|
2020-11-28 17:56:20 -05:00
|
|
|
tag->entry_size > 0 &&
|
2020-11-28 17:51:27 -05:00
|
|
|
tag->entry_size % 8 == 0 &&
|
2020-11-27 16:24:12 -05:00
|
|
|
(tag->base.size - 16) % tag->entry_size == 0
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_VBEInfo_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_VBEInfo *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_VBE_INFO &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 784
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_FramebufferInfo_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_FramebufferInfo *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_FRAMEBUFFER_INFO &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size >= 31
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_ELFSymbols_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_ELFSymbols *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_ELF_SYMBOLS &&
|
2020-11-27 22:17:13 -05:00
|
|
|
tag->base.size >= 16 // &&
|
|
|
|
// FIXME: division by zero in real-world data?
|
|
|
|
// (tag->base.size - 16) % tag->ent_size == 0
|
2020-11-27 16:24:12 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_APMTable_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_APMTable *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_APM_TABLE &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 28
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_EFI32bitSystemTablePtr_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_EFI32bitSystemTablePtr *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_EFI_32BIT_SYSTEM_TABLE_PTR &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 12
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_EFI64bitSystemTablePtr_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_EFI64bitSystemTablePtr *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_EFI_64BIT_SYSTEM_TABLE_PTR &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 16
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_SMBIOSTables_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_SMBIOSTables *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_SMBIOS_TABLES &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size >= 16
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_ACPIOldRSDP_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_ACPIOldRSDP *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_ACPI_OLD_RSDP &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size >= 8
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_ACPINewRSDP_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_ACPINewRSDP *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_ACPI_NEW_RSDP &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size >= 8
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_NetworkingInfo_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_NetworkingInfo *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_NETWORKING_INFO &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size >= 8
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_EFIMemoryMap_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_EFIMemoryMap *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_EFI_MEMORY_MAP &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size >= 16
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_EFIBootServicesNotTerminated_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_EFIBootServicesNotTerminated *const tag
|
|
|
|
) {
|
|
|
|
return (
|
|
|
|
tag->base.type ==
|
2022-01-12 21:49:25 -05:00
|
|
|
KERNAUX_MULTIBOOT2_ITAG_EFI_BOOT_SERVICES_NOT_TERMINATED &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 8
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_EFI32bitImageHandlePtr_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_EFI32bitImageHandlePtr *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_EFI_32BIT_IMAGE_HANDLE_PTR &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 12
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_EFI64bitImageHandlePtr_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_EFI64bitImageHandlePtr *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_EFI_64BIT_IMAGE_HANDLE_PTR &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 16
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
bool KernAux_Multiboot2_Tag_ImageLoadBasePhysAddr_is_valid(
|
2020-11-27 16:24:12 -05:00
|
|
|
const struct KernAux_Multiboot2_Tag_ImageLoadBasePhysAddr *const tag
|
|
|
|
) {
|
|
|
|
return (
|
2022-01-12 21:49:25 -05:00
|
|
|
tag->base.type == KERNAUX_MULTIBOOT2_ITAG_IMAGE_LOAD_BASE_PHYS_ADDR &&
|
2020-11-27 16:24:12 -05:00
|
|
|
tag->base.size == 12
|
|
|
|
);
|
|
|
|
}
|