mirror of https://github.com/tailix/libkernaux.git
Compare commits
2 Commits
c1bf030159
...
22ec69dfca
Author | SHA1 | Date |
---|---|---|
Alex Kotov | 22ec69dfca | |
Alex Kotov | 383fcb4133 |
|
@ -1,3 +1,7 @@
|
|||
2022-12-17 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* src/multiboot2/*_print.c: Print some values in hex
|
||||
|
||||
2022-12-16 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* configure.ac: Feature "--with[out]-multiboot2" has been added
|
||||
|
|
|
@ -89,10 +89,11 @@ libkernaux_la_SOURCES += src/memmap.c
|
|||
endif
|
||||
if WITH_MULTIBOOT2
|
||||
libkernaux_la_SOURCES += \
|
||||
src/multiboot2/enums_to_str.c \
|
||||
src/multiboot2/header_enums.c \
|
||||
src/multiboot2/header_helpers.c \
|
||||
src/multiboot2/header_is_valid.c \
|
||||
src/multiboot2/header_print.c \
|
||||
src/multiboot2/info_enums.c \
|
||||
src/multiboot2/info_helpers.c \
|
||||
src/multiboot2/info_is_valid.c \
|
||||
src/multiboot2/info_print.c
|
||||
|
|
|
@ -22,10 +22,12 @@ nobase_include_HEADERS = \
|
|||
kernaux/mbr.h \
|
||||
kernaux/memmap.h \
|
||||
kernaux/multiboot2.h \
|
||||
kernaux/multiboot2/header_enums.h \
|
||||
kernaux/multiboot2/header_helpers.h \
|
||||
kernaux/multiboot2/header_is_valid.h \
|
||||
kernaux/multiboot2/header_macro.h \
|
||||
kernaux/multiboot2/header_print.h \
|
||||
kernaux/multiboot2/info_enums.h \
|
||||
kernaux/multiboot2/info_helpers.h \
|
||||
kernaux/multiboot2/info_is_valid.h \
|
||||
kernaux/multiboot2/info_print.h \
|
||||
|
|
|
@ -41,18 +41,13 @@ extern "C" {
|
|||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
/***********************
|
||||
* Header common types *
|
||||
***********************/
|
||||
|
||||
enum KernAux_Multiboot2_Header_Arch {
|
||||
KERNAUX_MULTIBOOT2_HEADER_ARCH_I386 = 0,
|
||||
KERNAUX_MULTIBOOT2_HEADER_ARCH_MIPS32 = 4,
|
||||
};
|
||||
/**********************
|
||||
* Header basic types *
|
||||
**********************/
|
||||
|
||||
struct KernAux_Multiboot2_Header {
|
||||
uint32_t magic;
|
||||
enum KernAux_Multiboot2_Header_Arch arch : 32;
|
||||
uint32_t arch;
|
||||
uint32_t total_size;
|
||||
uint32_t checksum;
|
||||
}
|
||||
|
@ -60,22 +55,8 @@ KERNAUX_PACKED;
|
|||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_Header, 16);
|
||||
|
||||
enum KernAux_Multiboot2_HTag {
|
||||
KERNAUX_MULTIBOOT2_HTAG_NONE = 0,
|
||||
KERNAUX_MULTIBOOT2_HTAG_INFO_REQ = 1,
|
||||
KERNAUX_MULTIBOOT2_HTAG_ADDR = 2,
|
||||
KERNAUX_MULTIBOOT2_HTAG_ENTRY_ADDR = 3,
|
||||
KERNAUX_MULTIBOOT2_HTAG_FLAGS = 4,
|
||||
KERNAUX_MULTIBOOT2_HTAG_FRAMEBUFFER = 5,
|
||||
KERNAUX_MULTIBOOT2_HTAG_MODULE_ALIGN = 6,
|
||||
KERNAUX_MULTIBOOT2_HTAG_EFI_BOOT_SERVICES = 7,
|
||||
KERNAUX_MULTIBOOT2_HTAG_EFI_I386_ENTRY_ADDR = 8,
|
||||
KERNAUX_MULTIBOOT2_HTAG_EFI_AMD64_ENTRY_ADDR = 9,
|
||||
KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER = 10,
|
||||
};
|
||||
|
||||
struct KernAux_Multiboot2_HTagBase {
|
||||
enum KernAux_Multiboot2_HTag type : 16;
|
||||
uint16_t type;
|
||||
uint16_t flags;
|
||||
uint32_t size;
|
||||
}
|
||||
|
@ -83,9 +64,9 @@ KERNAUX_PACKED;
|
|||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTagBase, 8);
|
||||
|
||||
/****************************
|
||||
* Information common types *
|
||||
****************************/
|
||||
/***************************
|
||||
* Information basic types *
|
||||
***************************/
|
||||
|
||||
struct KernAux_Multiboot2_Info {
|
||||
uint32_t total_size;
|
||||
|
@ -95,49 +76,14 @@ KERNAUX_PACKED;
|
|||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_Info, 8);
|
||||
|
||||
enum KernAux_Multiboot2_ITag {
|
||||
KERNAUX_MULTIBOOT2_ITAG_NONE = 0,
|
||||
KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE = 1,
|
||||
KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME = 2,
|
||||
KERNAUX_MULTIBOOT2_ITAG_MODULE = 3,
|
||||
KERNAUX_MULTIBOOT2_ITAG_BASIC_MEMORY_INFO = 4,
|
||||
KERNAUX_MULTIBOOT2_ITAG_BIOS_BOOT_DEVICE = 5,
|
||||
KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP = 6,
|
||||
KERNAUX_MULTIBOOT2_ITAG_VBE_INFO = 7,
|
||||
KERNAUX_MULTIBOOT2_ITAG_FRAMEBUFFER_INFO = 8,
|
||||
KERNAUX_MULTIBOOT2_ITAG_ELF_SYMBOLS = 9,
|
||||
KERNAUX_MULTIBOOT2_ITAG_APM_TABLE = 10,
|
||||
KERNAUX_MULTIBOOT2_ITAG_EFI_32BIT_SYSTEM_TABLE_PTR = 11,
|
||||
KERNAUX_MULTIBOOT2_ITAG_EFI_64BIT_SYSTEM_TABLE_PTR = 12,
|
||||
KERNAUX_MULTIBOOT2_ITAG_SMBIOS_TABLES = 13,
|
||||
KERNAUX_MULTIBOOT2_ITAG_ACPI_OLD_RSDP = 14,
|
||||
KERNAUX_MULTIBOOT2_ITAG_ACPI_NEW_RSDP = 15,
|
||||
KERNAUX_MULTIBOOT2_ITAG_NETWORKING_INFO = 16,
|
||||
KERNAUX_MULTIBOOT2_ITAG_EFI_MEMORY_MAP = 17,
|
||||
KERNAUX_MULTIBOOT2_ITAG_EFI_BOOT_SERVICES_NOT_TERMINATED = 18,
|
||||
KERNAUX_MULTIBOOT2_ITAG_EFI_32BIT_IMAGE_HANDLE_PTR = 19,
|
||||
KERNAUX_MULTIBOOT2_ITAG_EFI_64BIT_IMAGE_HANDLE_PTR = 20,
|
||||
KERNAUX_MULTIBOOT2_ITAG_IMAGE_LOAD_BASE_PHYS_ADDR = 21,
|
||||
};
|
||||
|
||||
struct KernAux_Multiboot2_ITagBase {
|
||||
enum KernAux_Multiboot2_ITag type : 32;
|
||||
uint32_t type;
|
||||
uint32_t size;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITagBase, 8);
|
||||
|
||||
/***************************
|
||||
* Header additional types *
|
||||
***************************/
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
/********************************
|
||||
* Information additional types *
|
||||
********************************/
|
||||
|
@ -273,7 +219,7 @@ struct KernAux_Multiboot2_HTag_RelocatableHeader {
|
|||
uint32_t min_addr;
|
||||
uint32_t max_addr;
|
||||
uint32_t align;
|
||||
enum KernAux_Multiboot2_HTag_RelocatableHeader_Preference preferences : 32;
|
||||
uint32_t preference;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -585,25 +531,12 @@ KERNAUX_STATIC_TEST_STRUCT_SIZE(
|
|||
|
||||
#include <kernaux/macro/packing_end.run>
|
||||
|
||||
/********************
|
||||
* String functions *
|
||||
********************/
|
||||
/*********
|
||||
* Enums *
|
||||
*********/
|
||||
|
||||
const char *KernAux_Multiboot2_Header_Arch_to_str(
|
||||
enum KernAux_Multiboot2_Header_Arch arch
|
||||
);
|
||||
|
||||
const char *KernAux_Multiboot2_HTag_to_str(
|
||||
enum KernAux_Multiboot2_HTag tag_type
|
||||
);
|
||||
|
||||
const char *KernAux_Multiboot2_ITag_to_str(
|
||||
enum KernAux_Multiboot2_ITag tag_type
|
||||
);
|
||||
|
||||
const char *KernAux_Multiboot2_HTag_RelocatableHeader_Preference_to_str(
|
||||
enum KernAux_Multiboot2_HTag_RelocatableHeader_Preference pref
|
||||
);
|
||||
#include <kernaux/multiboot2/header_enums.h>
|
||||
#include <kernaux/multiboot2/info_enums.h>
|
||||
|
||||
/********************
|
||||
* Helper functions *
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
#ifndef KERNAUX_INCLUDED_MULTIBOOT2_HEADER_ENUMS
|
||||
#define KERNAUX_INCLUDED_MULTIBOOT2_HEADER_ENUMS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define KERNAUX_MULTIBOOT2_HEADER_ARCH_I386 0
|
||||
#define KERNAUX_MULTIBOOT2_HEADER_ARCH_MIPS32 4
|
||||
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_NONE 0
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_INFO_REQ 1
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_ADDR 2
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_ENTRY_ADDR 3
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_FLAGS 4
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_FRAMEBUFFER 5
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_MODULE_ALIGN 6
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_EFI_BOOT_SERVICES 7
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_EFI_I386_ENTRY_ADDR 8
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_EFI_AMD64_ENTRY_ADDR 9
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER 10
|
||||
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_NONE 0
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_LOWEST 1
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_HIGHEST 2
|
||||
|
||||
const char *KernAux_Multiboot2_Header_Arch_to_str(uint32_t arch);
|
||||
const char *KernAux_Multiboot2_HTag_to_str(uint16_t tag_type);
|
||||
const char*
|
||||
KernAux_Multiboot2_HTag_RelocatableHeader_Preference_to_str(uint32_t pref);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -10,13 +10,13 @@ extern "C" {
|
|||
const struct KernAux_Multiboot2_HTagBase
|
||||
*KernAux_Multiboot2_Header_first_tag_with_type(
|
||||
const struct KernAux_Multiboot2_Header *multiboot2_header,
|
||||
enum KernAux_Multiboot2_HTag tag_type
|
||||
uint16_t tag_type
|
||||
);
|
||||
|
||||
const struct KernAux_Multiboot2_HTagBase
|
||||
*KernAux_Multiboot2_Header_tag_with_type_after(
|
||||
const struct KernAux_Multiboot2_Header *multiboot2_header,
|
||||
enum KernAux_Multiboot2_HTag tag_type,
|
||||
uint16_t tag_type,
|
||||
const struct KernAux_Multiboot2_HTagBase *after_tag
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef KERNAUX_INCLUDED_MULTIBOOT2_INFO_ENUMS
|
||||
#define KERNAUX_INCLUDED_MULTIBOOT2_INFO_ENUMS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_NONE 0
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE 1
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME 2
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_MODULE 3
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_BASIC_MEMORY_INFO 4
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_BIOS_BOOT_DEVICE 5
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP 6
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_VBE_INFO 7
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_FRAMEBUFFER_INFO 8
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_ELF_SYMBOLS 9
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_APM_TABLE 10
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_EFI_32BIT_SYSTEM_TABLE_PTR 11
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_EFI_64BIT_SYSTEM_TABLE_PTR 12
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_SMBIOS_TABLES 13
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_ACPI_OLD_RSDP 14
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_ACPI_NEW_RSDP 15
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_NETWORKING_INFO 16
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_EFI_MEMORY_MAP 17
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_EFI_BOOT_SERVICES_NOT_TERMINATED 18
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_EFI_32BIT_IMAGE_HANDLE_PTR 19
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_EFI_64BIT_IMAGE_HANDLE_PTR 20
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_IMAGE_LOAD_BASE_PHYS_ADDR 21
|
||||
|
||||
const char *KernAux_Multiboot2_ITag_to_str(uint32_t tag_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -10,13 +10,13 @@ extern "C" {
|
|||
const struct KernAux_Multiboot2_ITagBase
|
||||
*KernAux_Multiboot2_Info_first_tag_with_type(
|
||||
const struct KernAux_Multiboot2_Info *multiboot2_info,
|
||||
enum KernAux_Multiboot2_ITag tag_type
|
||||
uint32_t tag_type
|
||||
);
|
||||
|
||||
const struct KernAux_Multiboot2_ITagBase
|
||||
*KernAux_Multiboot2_Info_tag_with_type_after(
|
||||
const struct KernAux_Multiboot2_Info *multiboot2_info,
|
||||
enum KernAux_Multiboot2_ITag tag_type,
|
||||
uint32_t tag_type,
|
||||
const struct KernAux_Multiboot2_ITagBase *after_tag
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
const char *KernAux_Multiboot2_Header_Arch_to_str(const uint32_t arch)
|
||||
{
|
||||
switch (arch) {
|
||||
case KERNAUX_MULTIBOOT2_HEADER_ARCH_I386:
|
||||
return "i386";
|
||||
case KERNAUX_MULTIBOOT2_HEADER_ARCH_MIPS32:
|
||||
return "MIPS32";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const char *KernAux_Multiboot2_HTag_to_str(const uint16_t tag_type)
|
||||
{
|
||||
switch (tag_type) {
|
||||
case KERNAUX_MULTIBOOT2_HTAG_NONE:
|
||||
return "none";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_INFO_REQ:
|
||||
return "information request";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_ADDR:
|
||||
return "address";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_ENTRY_ADDR:
|
||||
return "entry address";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_FLAGS:
|
||||
return "flags";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_FRAMEBUFFER:
|
||||
return "framebuffer";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_MODULE_ALIGN:
|
||||
return "module alignment";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_EFI_BOOT_SERVICES:
|
||||
return "EFI boot services";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_EFI_I386_ENTRY_ADDR:
|
||||
return "EFI i386 entry address";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_EFI_AMD64_ENTRY_ADDR:
|
||||
return "EFI amd64 entry address";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER:
|
||||
return "relocatable header";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const char*
|
||||
KernAux_Multiboot2_HTag_RelocatableHeader_Preference_to_str(uint32_t pref)
|
||||
{
|
||||
switch (pref) {
|
||||
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_NONE:
|
||||
return "none";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_LOWEST:
|
||||
return "lowest";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_HIGHEST:
|
||||
return "highest";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
const struct KernAux_Multiboot2_HTagBase
|
||||
*KernAux_Multiboot2_Header_first_tag_with_type(
|
||||
const struct KernAux_Multiboot2_Header *const multiboot2_header,
|
||||
const enum KernAux_Multiboot2_HTag tag_type
|
||||
const uint16_t tag_type
|
||||
) {
|
||||
KERNAUX_ASSERT(multiboot2_header);
|
||||
|
||||
|
@ -35,7 +35,7 @@ const struct KernAux_Multiboot2_HTagBase
|
|||
const struct KernAux_Multiboot2_HTagBase
|
||||
*KernAux_Multiboot2_Header_tag_with_type_after(
|
||||
const struct KernAux_Multiboot2_Header *const multiboot2_header,
|
||||
const enum KernAux_Multiboot2_HTag tag_type,
|
||||
const uint16_t tag_type,
|
||||
const struct KernAux_Multiboot2_HTagBase *const after_tag
|
||||
) {
|
||||
KERNAUX_ASSERT(multiboot2_header);
|
||||
|
|
|
@ -252,7 +252,7 @@ bool KernAux_Multiboot2_HTag_RelocatableHeader_is_valid(
|
|||
return false;
|
||||
}
|
||||
|
||||
switch (tag->preferences) {
|
||||
switch (tag->preference) {
|
||||
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;
|
||||
|
|
|
@ -7,13 +7,15 @@
|
|||
#include <kernaux/macro.h>
|
||||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define PRINT(s) do { KernAux_Display_print (display, s); } while (0)
|
||||
#define PRINTLN(s) do { KernAux_Display_println(display, s); } while (0)
|
||||
|
||||
#define PRINTF(format, ...) \
|
||||
do { KernAux_Display_printf(display, format, __VA_ARGS__); } while (0)
|
||||
do { KernAux_Display_printf (display, format, __VA_ARGS__); } while (0)
|
||||
#define PRINTLNF(format, ...) \
|
||||
do { KernAux_Display_printlnf(display, format, __VA_ARGS__); } while (0)
|
||||
|
||||
|
@ -25,20 +27,75 @@
|
|||
PRINTLN("Multiboot 2 header tag // invalid!"); \
|
||||
} \
|
||||
\
|
||||
KERNAUX_CAST_CONST(unsigned long, flags, tag->base.flags); \
|
||||
KERNAUX_CAST_CONST(unsigned long, size, tag->base.size); \
|
||||
KERNAUX_CAST_CONST(unsigned long, type, tag->base.type); \
|
||||
KERNAUX_CAST_CONST(unsigned long, size, tag->base.size); \
|
||||
\
|
||||
PRINTLN("Multiboot 2 header tag {"); \
|
||||
PRINTLNF(" u16 type: %u (%s)", \
|
||||
tag->base.type, \
|
||||
PRINTLN ("Multiboot 2 header tag {"); \
|
||||
PRINTLNF(" u16 type: %lu (%s)", \
|
||||
type, \
|
||||
KernAux_Multiboot2_HTag_to_str(tag->base.type) \
|
||||
); \
|
||||
PRINTLNF(" u16 flags: %lu", flags); \
|
||||
PRINT (" u16 flags: "); \
|
||||
KernAux_Multiboot2_HTagBase_Flags_print( \
|
||||
tag->base.flags, \
|
||||
display, \
|
||||
2, \
|
||||
2, \
|
||||
false \
|
||||
); \
|
||||
PRINTLNF(" u32 size: %lu", size); \
|
||||
} while (0)
|
||||
|
||||
#define FOOTER do { PRINTLN("}"); } while (0)
|
||||
|
||||
#define INDENT do { \
|
||||
for (unsigned index = 0; index < basic_indentation; ++index) PRINT(" "); \
|
||||
} while (0)
|
||||
|
||||
#define INDENT_MORE do { \
|
||||
for (unsigned index = 0; index < indentation_delta; ++index) PRINT(" "); \
|
||||
} while (0)
|
||||
|
||||
static const struct {
|
||||
uint32_t number;
|
||||
const char *name;
|
||||
} base_flag_names[] = {
|
||||
{
|
||||
.number = KERNAUX_MULTIBOOT2_HTAG_BASE_FLAG_OPTIONAL,
|
||||
.name = "OPTIONAL",
|
||||
},
|
||||
};
|
||||
|
||||
static const struct {
|
||||
uint32_t number;
|
||||
const char *name;
|
||||
} console_flag_names[] = {
|
||||
{
|
||||
.number = KERNAUX_MULTIBOOT2_HTAG_FLAGS_REQUIRE_CONSOLE,
|
||||
.name = "REQUIRE_CONSOLE",
|
||||
},
|
||||
{
|
||||
.number = KERNAUX_MULTIBOOT2_HTAG_FLAGS_EGA_SUPPORT,
|
||||
.name = "EGA_SUPPORT",
|
||||
}
|
||||
};
|
||||
|
||||
static void KernAux_Multiboot2_HTagBase_Flags_print(
|
||||
uint16_t flags,
|
||||
KernAux_Display display,
|
||||
unsigned basic_indentation,
|
||||
unsigned indentation_delta,
|
||||
bool indent_first
|
||||
);
|
||||
|
||||
static void KernAux_Multiboot2_HTag_Flags_ConsoleFlags_print(
|
||||
uint32_t console_flags,
|
||||
KernAux_Display display,
|
||||
unsigned basic_indentation,
|
||||
unsigned indentation_delta,
|
||||
bool indent_first
|
||||
);
|
||||
|
||||
void KernAux_Multiboot2_Header_print(
|
||||
const struct KernAux_Multiboot2_Header *const multiboot2_header,
|
||||
const KernAux_Display display
|
||||
|
@ -47,17 +104,18 @@ void KernAux_Multiboot2_Header_print(
|
|||
KERNAUX_ASSERT(display);
|
||||
|
||||
KERNAUX_CAST_CONST(unsigned long, magic, multiboot2_header->magic);
|
||||
KERNAUX_CAST_CONST(unsigned long, arch, multiboot2_header->arch);
|
||||
KERNAUX_CAST_CONST(unsigned long, total_size, multiboot2_header->total_size);
|
||||
KERNAUX_CAST_CONST(unsigned long, checksum, multiboot2_header->checksum);
|
||||
|
||||
PRINTLN("Multiboot 2 header {");
|
||||
PRINTLNF(" u32 magic: %lu", magic);
|
||||
PRINTLNF(" u32 arch: %u (%s)",
|
||||
multiboot2_header->arch,
|
||||
PRINTLNF(" u32 magic: 0x%lx", magic);
|
||||
PRINTLNF(" u32 arch: %lu (%s)",
|
||||
arch,
|
||||
KernAux_Multiboot2_Header_Arch_to_str(multiboot2_header->arch)
|
||||
);
|
||||
PRINTLNF(" u32 size: %lu", total_size);
|
||||
PRINTLNF(" u32 checksum: %lu", checksum);
|
||||
PRINTLNF(" u32 checksum: 0x%lx", checksum);
|
||||
PRINTLN("}");
|
||||
|
||||
const struct KernAux_Multiboot2_HTagBase *tag_base =
|
||||
|
@ -201,10 +259,10 @@ void KernAux_Multiboot2_HTag_Addr_print(
|
|||
KERNAUX_CAST_CONST(unsigned long, load_end_addr, tag->load_end_addr);
|
||||
KERNAUX_CAST_CONST(unsigned long, bss_end_addr, tag->bss_end_addr);
|
||||
|
||||
PRINTLNF(" u32 header_addr: %lu", header_addr);
|
||||
PRINTLNF(" u32 load_addr: %lu", load_addr);
|
||||
PRINTLNF(" u32 load_end_addr: %lu", load_end_addr);
|
||||
PRINTLNF(" u32 bss_end_addr: %lu", bss_end_addr);
|
||||
PRINTLNF(" u32 header_addr: 0x%lx", header_addr);
|
||||
PRINTLNF(" u32 load_addr: 0x%lx", load_addr);
|
||||
PRINTLNF(" u32 load_end_addr: 0x%lx", load_end_addr);
|
||||
PRINTLNF(" u32 bss_end_addr: 0x%lx", bss_end_addr);
|
||||
|
||||
FOOTER;
|
||||
}
|
||||
|
@ -217,7 +275,7 @@ void KernAux_Multiboot2_HTag_EntryAddr_print(
|
|||
|
||||
KERNAUX_CAST_CONST(unsigned long, entry_addr, tag->entry_addr);
|
||||
|
||||
PRINTLNF(" u32 entry_addr: %lu", entry_addr);
|
||||
PRINTLNF(" u32 entry_addr: 0x%lx", entry_addr);
|
||||
|
||||
FOOTER;
|
||||
}
|
||||
|
@ -228,42 +286,14 @@ void KernAux_Multiboot2_HTag_Flags_print(
|
|||
) {
|
||||
HEADER(Flags);
|
||||
|
||||
KERNAUX_CAST_CONST(unsigned long, console_flags, tag->console_flags);
|
||||
|
||||
PRINTF(" u32 console_flags: %lu (", console_flags);
|
||||
|
||||
static const struct {
|
||||
uint32_t number;
|
||||
const char *name;
|
||||
} flags[] = {
|
||||
{
|
||||
.number = KERNAUX_MULTIBOOT2_HTAG_FLAGS_REQUIRE_CONSOLE,
|
||||
.name = "REQUIRE_CONSOLE",
|
||||
},
|
||||
{
|
||||
.number = KERNAUX_MULTIBOOT2_HTAG_FLAGS_EGA_SUPPORT,
|
||||
.name = "EGA_SUPPORT",
|
||||
}
|
||||
};
|
||||
|
||||
bool is_first = true;
|
||||
for (size_t index = 0; index < sizeof(flags) / sizeof(flags[0]); ++index) {
|
||||
if (tag->console_flags & flags[index].number) {
|
||||
if (is_first) {
|
||||
PRINTLN("");
|
||||
} else {
|
||||
PRINTLN(" |");
|
||||
}
|
||||
PRINTF(" %s", flags[index].name);
|
||||
is_first = false;
|
||||
}
|
||||
}
|
||||
if (is_first) {
|
||||
PRINTLN(")");
|
||||
} else {
|
||||
PRINTLN("");
|
||||
PRINTLN(" )");
|
||||
}
|
||||
PRINT(" u32 console_flags: ");
|
||||
KernAux_Multiboot2_HTag_Flags_ConsoleFlags_print(
|
||||
tag->console_flags,
|
||||
display,
|
||||
2,
|
||||
2,
|
||||
false
|
||||
);
|
||||
|
||||
FOOTER;
|
||||
}
|
||||
|
@ -311,7 +341,7 @@ void KernAux_Multiboot2_HTag_EFII386EntryAddr_print(
|
|||
|
||||
KERNAUX_CAST_CONST(unsigned long, entry_addr, tag->entry_addr);
|
||||
|
||||
PRINTLNF(" u32 entry_addr: %lu", entry_addr);
|
||||
PRINTLNF(" u32 entry_addr: 0x%lx", entry_addr);
|
||||
|
||||
FOOTER;
|
||||
}
|
||||
|
@ -324,7 +354,7 @@ void KernAux_Multiboot2_HTag_EFIAmd64EntryAddr_print(
|
|||
|
||||
KERNAUX_CAST_CONST(unsigned long, entry_addr, tag->entry_addr);
|
||||
|
||||
PRINTLNF(" u32 entry_addr: %lu", entry_addr);
|
||||
PRINTLNF(" u32 entry_addr: 0x%lx", entry_addr);
|
||||
|
||||
FOOTER;
|
||||
}
|
||||
|
@ -335,13 +365,104 @@ void KernAux_Multiboot2_HTag_RelocatableHeader_print(
|
|||
) {
|
||||
HEADER(RelocatableHeader);
|
||||
|
||||
KERNAUX_CAST_CONST(unsigned long, min_addr, tag->min_addr);
|
||||
KERNAUX_CAST_CONST(unsigned long, max_addr, tag->max_addr);
|
||||
KERNAUX_CAST_CONST(unsigned long, align, tag->align);
|
||||
KERNAUX_CAST_CONST(unsigned long, min_addr, tag->min_addr);
|
||||
KERNAUX_CAST_CONST(unsigned long, max_addr, tag->max_addr);
|
||||
KERNAUX_CAST_CONST(unsigned long, align, tag->align);
|
||||
KERNAUX_CAST_CONST(unsigned long, preference, tag->preference);
|
||||
|
||||
PRINTLNF(" u32 min_addr: %lu", min_addr);
|
||||
PRINTLNF(" u32 max_addr: %lu", max_addr);
|
||||
PRINTLNF(" u32 align: %lu", align);
|
||||
PRINTLNF(" u32 min_addr: 0x%lx", min_addr);
|
||||
PRINTLNF(" u32 max_addr: 0x%lx", max_addr);
|
||||
PRINTLNF(" u32 align: %lu", align);
|
||||
PRINTLNF(" u32 preference: %lu (%s)",
|
||||
preference,
|
||||
KernAux_Multiboot2_HTag_RelocatableHeader_Preference_to_str(
|
||||
tag->preference
|
||||
)
|
||||
);
|
||||
|
||||
FOOTER;
|
||||
}
|
||||
|
||||
void KernAux_Multiboot2_HTagBase_Flags_print(
|
||||
const uint16_t flags,
|
||||
const KernAux_Display display,
|
||||
const unsigned basic_indentation,
|
||||
const unsigned indentation_delta,
|
||||
const bool indent_first
|
||||
) {
|
||||
KERNAUX_CAST_CONST(unsigned long, flags_ul, flags);
|
||||
|
||||
if (indent_first) INDENT;
|
||||
PRINTF("0x%lx (", flags_ul);
|
||||
|
||||
bool is_first = true;
|
||||
|
||||
for (
|
||||
size_t index = 0;
|
||||
index < sizeof(base_flag_names) / sizeof(base_flag_names[0]);
|
||||
++index
|
||||
) {
|
||||
if (flags & base_flag_names[index].number) {
|
||||
if (is_first) {
|
||||
PRINTLN("");
|
||||
} else {
|
||||
PRINTLN(" |");
|
||||
}
|
||||
|
||||
INDENT;
|
||||
INDENT_MORE;
|
||||
PRINTF("%s", base_flag_names[index].name);
|
||||
is_first = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_first) {
|
||||
PRINTLN(")");
|
||||
} else {
|
||||
PRINTLN("");
|
||||
INDENT;
|
||||
PRINTLN(")");
|
||||
}
|
||||
}
|
||||
|
||||
void KernAux_Multiboot2_HTag_Flags_ConsoleFlags_print(
|
||||
const uint32_t console_flags,
|
||||
const KernAux_Display display,
|
||||
const unsigned basic_indentation,
|
||||
const unsigned indentation_delta,
|
||||
const bool indent_first
|
||||
) {
|
||||
KERNAUX_CAST_CONST(unsigned long, console_flags_ul, console_flags);
|
||||
|
||||
if (indent_first) INDENT;
|
||||
PRINTF("0x%lx (", console_flags_ul);
|
||||
|
||||
bool is_first = true;
|
||||
|
||||
for (
|
||||
size_t index = 0;
|
||||
index < sizeof(console_flag_names) / sizeof(console_flag_names[0]);
|
||||
++index
|
||||
) {
|
||||
if (console_flags & console_flag_names[index].number) {
|
||||
if (is_first) {
|
||||
PRINTLN("");
|
||||
} else {
|
||||
PRINTLN(" |");
|
||||
}
|
||||
|
||||
INDENT;
|
||||
INDENT_MORE;
|
||||
PRINTF("%s", console_flag_names[index].name);
|
||||
is_first = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_first) {
|
||||
PRINTLN(")");
|
||||
} else {
|
||||
PRINTLN("");
|
||||
INDENT;
|
||||
PRINTLN(")");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,54 +5,10 @@
|
|||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
const char *KernAux_Multiboot2_Header_Arch_to_str(
|
||||
const enum KernAux_Multiboot2_Header_Arch arch
|
||||
) {
|
||||
switch (arch) {
|
||||
case KERNAUX_MULTIBOOT2_HEADER_ARCH_I386:
|
||||
return "i386";
|
||||
case KERNAUX_MULTIBOOT2_HEADER_ARCH_MIPS32:
|
||||
return "MIPS32";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const char *KernAux_Multiboot2_HTag_to_str(
|
||||
const enum KernAux_Multiboot2_HTag tag_type
|
||||
) {
|
||||
switch (tag_type) {
|
||||
case KERNAUX_MULTIBOOT2_HTAG_NONE:
|
||||
return "none";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_INFO_REQ:
|
||||
return "information request";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_ADDR:
|
||||
return "address";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_ENTRY_ADDR:
|
||||
return "entry address";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_FLAGS:
|
||||
return "flags";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_FRAMEBUFFER:
|
||||
return "framebuffer";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_MODULE_ALIGN:
|
||||
return "module alignment";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_EFI_BOOT_SERVICES:
|
||||
return "EFI boot services";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_EFI_I386_ENTRY_ADDR:
|
||||
return "EFI i386 entry address";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_EFI_AMD64_ENTRY_ADDR:
|
||||
return "EFI amd64 entry address";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER:
|
||||
return "relocatable header";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const char *KernAux_Multiboot2_ITag_to_str(
|
||||
const enum KernAux_Multiboot2_ITag tag_type
|
||||
) {
|
||||
const char *KernAux_Multiboot2_ITag_to_str(const uint32_t tag_type)
|
||||
{
|
||||
switch (tag_type) {
|
||||
case KERNAUX_MULTIBOOT2_ITAG_NONE:
|
||||
return "none";
|
||||
|
@ -102,18 +58,3 @@ const char *KernAux_Multiboot2_ITag_to_str(
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const char *KernAux_Multiboot2_HTag_RelocatableHeader_Preference_to_str(
|
||||
const enum KernAux_Multiboot2_HTag_RelocatableHeader_Preference pref
|
||||
) {
|
||||
switch (pref) {
|
||||
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_NONE:
|
||||
return "none";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_LOWEST:
|
||||
return "lowest";
|
||||
case KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_HIGHEST:
|
||||
return "highest";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
const struct KernAux_Multiboot2_ITagBase
|
||||
*KernAux_Multiboot2_Info_first_tag_with_type(
|
||||
const struct KernAux_Multiboot2_Info *const multiboot2_info,
|
||||
const enum KernAux_Multiboot2_ITag tag_type
|
||||
const uint32_t tag_type
|
||||
) {
|
||||
KERNAUX_ASSERT(multiboot2_info);
|
||||
|
||||
|
@ -35,7 +35,7 @@ const struct KernAux_Multiboot2_ITagBase
|
|||
const struct KernAux_Multiboot2_ITagBase
|
||||
*KernAux_Multiboot2_Info_tag_with_type_after(
|
||||
const struct KernAux_Multiboot2_Info *const multiboot2_info,
|
||||
const enum KernAux_Multiboot2_ITag tag_type,
|
||||
const uint32_t tag_type,
|
||||
const struct KernAux_Multiboot2_ITagBase *const after_tag
|
||||
) {
|
||||
KERNAUX_ASSERT(multiboot2_info);
|
||||
|
|
|
@ -26,11 +26,12 @@
|
|||
PRINTLN("Multiboot 2 info tag // invalid!"); \
|
||||
} \
|
||||
\
|
||||
KERNAUX_CAST_CONST(unsigned long, type, tag->base.type); \
|
||||
KERNAUX_CAST_CONST(unsigned long, size, tag->base.size); \
|
||||
\
|
||||
PRINTLN("Multiboot 2 info tag {"); \
|
||||
PRINTLNF(" u32 type: %u (%s)", \
|
||||
tag->base.type, \
|
||||
PRINTLNF(" u32 type: %lu (%s)", \
|
||||
type, \
|
||||
KernAux_Multiboot2_ITag_to_str(tag->base.type) \
|
||||
); \
|
||||
PRINTLNF(" u32 size: %lu", size); \
|
||||
|
@ -49,8 +50,8 @@ void KernAux_Multiboot2_Info_print(
|
|||
KERNAUX_CAST_CONST(unsigned long, reserved, multiboot2_info->reserved);
|
||||
|
||||
PRINTLN("Multiboot 2 info {");
|
||||
PRINTLNF(" u32 size: %lu", total_size);
|
||||
PRINTLNF(" u32 reserved: %lu", reserved);
|
||||
PRINTLNF(" u32 size: %lu", total_size);
|
||||
PRINTLNF(" u32 reserved: 0x%lx", reserved);
|
||||
PRINTLN("}");
|
||||
|
||||
const struct KernAux_Multiboot2_ITagBase *tag_base =
|
||||
|
@ -252,8 +253,8 @@ void KernAux_Multiboot2_ITag_Module_print(
|
|||
KERNAUX_CAST_CONST(unsigned long, mod_start, tag->mod_start);
|
||||
KERNAUX_CAST_CONST(unsigned long, mod_end, tag->mod_end);
|
||||
|
||||
PRINTLNF(" u32 mod_start: %lu", mod_start);
|
||||
PRINTLNF(" u32 mod_end: %lu", mod_end);
|
||||
PRINTLNF(" u32 mod_start: 0x%lx", mod_start);
|
||||
PRINTLNF(" u32 mod_end: 0x%lx", mod_end);
|
||||
|
||||
// Print data:
|
||||
PRINTLNF(" char cmdline[]: \"%s\"", KERNAUX_MULTIBOOT2_DATA(tag));
|
||||
|
@ -324,10 +325,10 @@ void KernAux_Multiboot2_ITag_MemoryMap_print(
|
|||
KERNAUX_CAST_CONST(unsigned long, reserved, entries[index].reserved);
|
||||
|
||||
PRINTLNF(" [%zu] entry: {", index);
|
||||
PRINTLNF(" u64 base_addr: %llu", base_addr);
|
||||
PRINTLNF(" u64 length: %llu", length);
|
||||
PRINTLNF(" u32 type: %lu", type);
|
||||
PRINTLNF(" u32 reserved: %lu", reserved);
|
||||
PRINTLNF(" u64 base_addr: 0x%llx", base_addr);
|
||||
PRINTLNF(" u64 length: %llu", length);
|
||||
PRINTLNF(" u32 type: %lu", type);
|
||||
PRINTLNF(" u32 reserved: 0x%lx", reserved);
|
||||
PRINTLN (" }");
|
||||
}
|
||||
|
||||
|
@ -398,13 +399,13 @@ void KernAux_Multiboot2_ITag_FramebufferInfo_print(
|
|||
KERNAUX_CAST_CONST(unsigned long, type, tag->framebuffer_type);
|
||||
KERNAUX_CAST_CONST(unsigned long, reserved, tag->reserved);
|
||||
|
||||
PRINTLNF(" u64 framebuffer_addr: %llu", addr);
|
||||
PRINTLNF(" u32 framebuffer_pitch: %lu", pitch);
|
||||
PRINTLNF(" u32 framebuffer_width: %lu", width);
|
||||
PRINTLNF(" u32 framebuffer_height: %lu", height);
|
||||
PRINTLNF(" u8 framebuffer_bpp: %lu", bpp);
|
||||
PRINTLNF(" u8 framebuffer_type: %lu", type);
|
||||
PRINTLNF(" u16 reserved: %lu", reserved);
|
||||
PRINTLNF(" u64 framebuffer_addr: 0x%llx", addr);
|
||||
PRINTLNF(" u32 framebuffer_pitch: %lu", pitch);
|
||||
PRINTLNF(" u32 framebuffer_width: %lu", width);
|
||||
PRINTLNF(" u32 framebuffer_height: %lu", height);
|
||||
PRINTLNF(" u8 framebuffer_bpp: %lu", bpp);
|
||||
PRINTLNF(" u8 framebuffer_type: %lu", type);
|
||||
PRINTLNF(" u16 reserved: 0x%lx", reserved);
|
||||
|
||||
// TODO: Print data?
|
||||
|
||||
|
@ -502,7 +503,7 @@ void KernAux_Multiboot2_ITag_SMBIOSTables_print(
|
|||
|
||||
PRINTLNF(" u8 major: %lu", major);
|
||||
PRINTLNF(" u8 minor: %lu", minor);
|
||||
PRINTLNF(" u8 reserved[6]: [%lu, %lu, %lu, %lu, %lu, %lu]",
|
||||
PRINTLNF(" u8 reserved[6]: [0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx]",
|
||||
reserved0, reserved1, reserved2,
|
||||
reserved3, reserved4, reserved5
|
||||
);
|
||||
|
@ -605,7 +606,7 @@ void KernAux_Multiboot2_ITag_ImageLoadBasePhysAddr_print(
|
|||
|
||||
KERNAUX_CAST_CONST(unsigned long, load_base_addr, tag->load_base_addr);
|
||||
|
||||
PRINTLNF(" u32 load_base_addr: %lu", load_base_addr);
|
||||
PRINTLNF(" u32 load_base_addr: 0x%lx", load_base_addr);
|
||||
|
||||
FOOTER;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ multiboot2_header_example1 = {
|
|||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_HTAG_INFO_REQ,
|
||||
.flags = 0,
|
||||
.flags = KERNAUX_MULTIBOOT2_HTAG_BASE_FLAG_OPTIONAL,
|
||||
.size = sizeof(multiboot2_header_example1.tag_info_req),
|
||||
},
|
||||
},
|
||||
|
|
|
@ -157,7 +157,7 @@ multiboot2_header_example2 = {
|
|||
.min_addr = 0xcafebabe,
|
||||
.max_addr = 0xdeadbeaf,
|
||||
.align = 8,
|
||||
.preferences =
|
||||
.preference =
|
||||
KERNAUX_MULTIBOOT2_HTAG_RELOCATABLE_HEADER_PREFERENCE_LOWEST,
|
||||
},
|
||||
.tag_none = {
|
||||
|
|
|
@ -11,58 +11,60 @@
|
|||
|
||||
static const char output0[] =
|
||||
"Multiboot 2 header {\n"
|
||||
" u32 magic: 3897708758\n"
|
||||
" u32 magic: 0xe85250d6\n"
|
||||
" u32 arch: 0 (i386)\n"
|
||||
" u32 size: 24\n"
|
||||
" u32 checksum: 397258514\n"
|
||||
" u32 checksum: 0x17adaf12\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 0 (none)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 8\n"
|
||||
"}\n";
|
||||
|
||||
static const char output1[] =
|
||||
"Multiboot 2 header {\n"
|
||||
" u32 magic: 3897708758\n"
|
||||
" u32 magic: 0xe85250d6\n"
|
||||
" u32 arch: 4 (MIPS32)\n"
|
||||
" u32 size: 104\n"
|
||||
" u32 checksum: 397258430\n"
|
||||
" u32 checksum: 0x17adaebe\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 4 (flags)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 console_flags: 0 ()\n"
|
||||
" u32 console_flags: 0x0 ()\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 4 (flags)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 console_flags: 1 (\n"
|
||||
" u32 console_flags: 0x1 (\n"
|
||||
" REQUIRE_CONSOLE\n"
|
||||
" )\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 4 (flags)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 console_flags: 2 (\n"
|
||||
" u32 console_flags: 0x2 (\n"
|
||||
" EGA_SUPPORT\n"
|
||||
" )\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 4 (flags)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 console_flags: 3 (\n"
|
||||
" u32 console_flags: 0x3 (\n"
|
||||
" REQUIRE_CONSOLE |\n"
|
||||
" EGA_SUPPORT\n"
|
||||
" )\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 1 (information request)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x1 (\n"
|
||||
" OPTIONAL\n"
|
||||
" )\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 mbi_tag_types[]: [\n"
|
||||
" 0 (none)\n"
|
||||
|
@ -70,20 +72,20 @@ static const char output1[] =
|
|||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 0 (none)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 8\n"
|
||||
"}\n";
|
||||
|
||||
static const char output2[] =
|
||||
"Multiboot 2 header {\n"
|
||||
" u32 magic: 3897708758\n"
|
||||
" u32 magic: 0xe85250d6\n"
|
||||
" u32 arch: 0 (i386)\n"
|
||||
" u32 size: 272\n"
|
||||
" u32 checksum: 397258266\n"
|
||||
" u32 checksum: 0x17adae1a\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 1 (information request)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 96\n"
|
||||
" u32 mbi_tag_types[]: [\n"
|
||||
" 0 (none)\n"
|
||||
|
@ -112,28 +114,28 @@ static const char output2[] =
|
|||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 2 (address)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 24\n"
|
||||
" u32 header_addr: 3405691582\n"
|
||||
" u32 load_addr: 3735928495\n"
|
||||
" u32 load_end_addr: 3735927486\n"
|
||||
" u32 bss_end_addr: 3405692591\n"
|
||||
" u32 header_addr: 0xcafebabe\n"
|
||||
" u32 load_addr: 0xdeadbeaf\n"
|
||||
" u32 load_end_addr: 0xdeadbabe\n"
|
||||
" u32 bss_end_addr: 0xcafebeaf\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 3 (entry address)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 entry_addr: 3405691582\n"
|
||||
" u32 entry_addr: 0xcafebabe\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 4 (flags)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 console_flags: 0 ()\n"
|
||||
" u32 console_flags: 0x0 ()\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 5 (framebuffer)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 20\n"
|
||||
" u32 width: 80\n"
|
||||
" u32 height: 25\n"
|
||||
|
@ -141,37 +143,38 @@ static const char output2[] =
|
|||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 6 (module alignment)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 8\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 7 (EFI boot services)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 8\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 8 (EFI i386 entry address)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 entry_addr: 3405691582\n"
|
||||
" u32 entry_addr: 0xcafebabe\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 9 (EFI amd64 entry address)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 entry_addr: 3735928495\n"
|
||||
" u32 entry_addr: 0xdeadbeaf\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 10 (relocatable header)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 24\n"
|
||||
" u32 min_addr: 3405691582\n"
|
||||
" u32 max_addr: 3735928495\n"
|
||||
" u32 min_addr: 0xcafebabe\n"
|
||||
" u32 max_addr: 0xdeadbeaf\n"
|
||||
" u32 align: 8\n"
|
||||
" u32 preference: 1 (lowest)\n"
|
||||
"}\n"
|
||||
"Multiboot 2 header tag {\n"
|
||||
" u16 type: 0 (none)\n"
|
||||
" u16 flags: 0\n"
|
||||
" u16 flags: 0x0 ()\n"
|
||||
" u32 size: 8\n"
|
||||
"}\n";
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
static const char output0[] =
|
||||
"Multiboot 2 info {\n"
|
||||
" u32 size: 16\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 0 (none)\n"
|
||||
|
@ -24,12 +24,12 @@ static const char output0[] =
|
|||
static const char output1[] =
|
||||
"Multiboot 2 info {\n"
|
||||
" u32 size: 864\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 21 (image load base phys addr)\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 load_base_addr: 4194304\n"
|
||||
" u32 load_base_addr: 0x400000\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 1 (boot cmd line)\n"
|
||||
|
@ -57,15 +57,15 @@ static const char output1[] =
|
|||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 3 (module)\n"
|
||||
" u32 size: 29\n"
|
||||
" u32 mod_start: 1056768\n"
|
||||
" u32 mod_end: 1061532\n"
|
||||
" u32 mod_start: 0x102000\n"
|
||||
" u32 mod_end: 0x10329c\n"
|
||||
" char cmdline[]: \"hello module\"\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 3 (module)\n"
|
||||
" u32 size: 17\n"
|
||||
" u32 mod_start: 1064960\n"
|
||||
" u32 mod_end: 1069652\n"
|
||||
" u32 mod_start: 0x104000\n"
|
||||
" u32 mod_end: 0x105254\n"
|
||||
" char cmdline[]: \"\"\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
|
@ -75,40 +75,40 @@ static const char output1[] =
|
|||
" u32 entry_version: 0\n"
|
||||
" varies(entry_size) entries[]: [\n"
|
||||
" [0] entry: {\n"
|
||||
" u64 base_addr: 0\n"
|
||||
" u64 base_addr: 0x0\n"
|
||||
" u64 length: 654336\n"
|
||||
" u32 type: 1\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" [1] entry: {\n"
|
||||
" u64 base_addr: 654336\n"
|
||||
" u64 base_addr: 0x9fc00\n"
|
||||
" u64 length: 1024\n"
|
||||
" u32 type: 2\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" [2] entry: {\n"
|
||||
" u64 base_addr: 983040\n"
|
||||
" u64 base_addr: 0xf0000\n"
|
||||
" u64 length: 65536\n"
|
||||
" u32 type: 2\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" [3] entry: {\n"
|
||||
" u64 base_addr: 1048576\n"
|
||||
" u64 base_addr: 0x100000\n"
|
||||
" u64 length: 133038080\n"
|
||||
" u32 type: 1\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" [4] entry: {\n"
|
||||
" u64 base_addr: 134086656\n"
|
||||
" u64 base_addr: 0x7fe0000\n"
|
||||
" u64 length: 131072\n"
|
||||
" u32 type: 2\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" [5] entry: {\n"
|
||||
" u64 base_addr: 4294705152\n"
|
||||
" u64 base_addr: 0xfffc0000\n"
|
||||
" u64 length: 262144\n"
|
||||
" u32 type: 2\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" ]\n"
|
||||
"}\n"
|
||||
|
@ -135,13 +135,13 @@ static const char output1[] =
|
|||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 8 (framebuffer info)\n"
|
||||
" u32 size: 32\n"
|
||||
" u64 framebuffer_addr: 753664\n"
|
||||
" u64 framebuffer_addr: 0xb8000\n"
|
||||
" u32 framebuffer_pitch: 160\n"
|
||||
" u32 framebuffer_width: 80\n"
|
||||
" u32 framebuffer_height: 25\n"
|
||||
" u8 framebuffer_bpp: 16\n"
|
||||
" u8 framebuffer_type: 2\n"
|
||||
" u16 reserved: 0\n"
|
||||
" u16 reserved: 0x0\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 14 (ACPI old RSDP)\n"
|
||||
|
@ -155,7 +155,7 @@ static const char output1[] =
|
|||
static const char output2_part1[] =
|
||||
"Multiboot 2 info {\n"
|
||||
" u32 size: 1816\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 1 (boot cmd line)\n"
|
||||
|
@ -170,15 +170,15 @@ static const char output2_part1[] =
|
|||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 3 (module)\n"
|
||||
" u32 size: 33\n"
|
||||
" u32 mod_start: 123\n"
|
||||
" u32 mod_end: 456\n"
|
||||
" u32 mod_start: 0x7b\n"
|
||||
" u32 mod_end: 0x1c8\n"
|
||||
" char cmdline[]: \"Hello, Module 1!\"\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 3 (module)\n"
|
||||
" u32 size: 33\n"
|
||||
" u32 mod_start: 123\n"
|
||||
" u32 mod_end: 456\n"
|
||||
" u32 mod_start: 0x7b\n"
|
||||
" u32 mod_end: 0x1c8\n"
|
||||
" char cmdline[]: \"Hello, Module 2!\"\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
|
@ -201,40 +201,40 @@ static const char output2_part1[] =
|
|||
" u32 entry_version: 0\n"
|
||||
" varies(entry_size) entries[]: [\n"
|
||||
" [0] entry: {\n"
|
||||
" u64 base_addr: 0\n"
|
||||
" u64 base_addr: 0x0\n"
|
||||
" u64 length: 654336\n"
|
||||
" u32 type: 1\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" [1] entry: {\n"
|
||||
" u64 base_addr: 654336\n"
|
||||
" u64 base_addr: 0x9fc00\n"
|
||||
" u64 length: 1024\n"
|
||||
" u32 type: 2\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" [2] entry: {\n"
|
||||
" u64 base_addr: 983040\n"
|
||||
" u64 base_addr: 0xf0000\n"
|
||||
" u64 length: 65536\n"
|
||||
" u32 type: 2\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" [3] entry: {\n"
|
||||
" u64 base_addr: 1048576\n"
|
||||
" u64 base_addr: 0x100000\n"
|
||||
" u64 length: 133038080\n"
|
||||
" u32 type: 1\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" [4] entry: {\n"
|
||||
" u64 base_addr: 134086656\n"
|
||||
" u64 base_addr: 0x7fe0000\n"
|
||||
" u64 length: 131072\n"
|
||||
" u32 type: 2\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" [5] entry: {\n"
|
||||
" u64 base_addr: 4294705152\n"
|
||||
" u64 base_addr: 0xfffc0000\n"
|
||||
" u64 length: 262144\n"
|
||||
" u32 type: 2\n"
|
||||
" u32 reserved: 0\n"
|
||||
" u32 reserved: 0x0\n"
|
||||
" }\n"
|
||||
" ]\n"
|
||||
"}\n";
|
||||
|
@ -305,13 +305,13 @@ static const char output2_part3[] =
|
|||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 8 (framebuffer info)\n"
|
||||
" u32 size: 40\n"
|
||||
" u64 framebuffer_addr: 123\n"
|
||||
" u64 framebuffer_addr: 0x7b\n"
|
||||
" u32 framebuffer_pitch: 456\n"
|
||||
" u32 framebuffer_width: 123\n"
|
||||
" u32 framebuffer_height: 456\n"
|
||||
" u8 framebuffer_bpp: 8\n"
|
||||
" u8 framebuffer_type: 1\n"
|
||||
" u16 reserved: 0\n"
|
||||
" u16 reserved: 0x0\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 9 (ELF symbols)\n"
|
||||
|
@ -348,7 +348,7 @@ static const char output2_part3[] =
|
|||
" u32 size: 24\n"
|
||||
" u8 major: 1\n"
|
||||
" u8 minor: 2\n"
|
||||
" u8 reserved[6]: [0, 0, 0, 0, 0, 0]\n"
|
||||
" u8 reserved[6]: [0x0, 0x0, 0x0, 0x0, 0x0, 0x0]\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 14 (ACPI old RSDP)\n"
|
||||
|
@ -385,7 +385,7 @@ static const char output2_part3[] =
|
|||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 21 (image load base phys addr)\n"
|
||||
" u32 size: 12\n"
|
||||
" u32 load_base_addr: 123\n"
|
||||
" u32 load_base_addr: 0x7b\n"
|
||||
"}\n"
|
||||
"Multiboot 2 info tag {\n"
|
||||
" u32 type: 0 (none)\n"
|
||||
|
|
Loading…
Reference in New Issue