mirror of
https://github.com/tailix/libkernaux.git
synced 2025-04-07 17:32:45 -04:00
Portable packing and test struct sizes (#95)
This commit is contained in:
parent
db226e3387
commit
73a17df3dc
12 changed files with 262 additions and 116 deletions
|
@ -6,6 +6,8 @@ nobase_include_HEADERS = \
|
|||
kernaux.h \
|
||||
kernaux/assert.h \
|
||||
kernaux/macro.h \
|
||||
kernaux/macro/packing_start.run \
|
||||
kernaux/macro/packing_end.run \
|
||||
kernaux/version.h \
|
||||
kernaux/generic/malloc.h \
|
||||
kernaux/generic/mutex.h
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <kernaux/macro.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define KERNAUX_ARCH_I386_PAGE_SIZE (1024 * 4) // 4 KiB
|
||||
|
@ -49,6 +51,8 @@ extern "C" {
|
|||
#define KERNAUX_ARCH_I386_CR4_PGE ((uint32_t)0x00000080) // 7: Page Global Enabled
|
||||
// TODO: bits 8-31
|
||||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
// Global or local descriptor table entry
|
||||
// TODO: validate this according to spec
|
||||
struct KernAux_Arch_I386_DTE {
|
||||
|
@ -68,7 +72,9 @@ struct KernAux_Arch_I386_DTE {
|
|||
unsigned gran : 1;
|
||||
unsigned base_high : 8;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_DTE, 8);
|
||||
|
||||
/**
|
||||
* @brief Task state segment
|
||||
|
@ -119,7 +125,9 @@ struct KernAux_Arch_I386_TSS {
|
|||
unsigned _zero11 : 16;
|
||||
unsigned io_map_base : 16;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_TSS, 104);
|
||||
|
||||
// Page directory entry
|
||||
// TODO: validate this according to spec
|
||||
|
@ -135,7 +143,9 @@ struct KernAux_Arch_I386_PDE {
|
|||
unsigned available1 : 4;
|
||||
unsigned addr : 20;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PDE, 4);
|
||||
|
||||
// Page table entry
|
||||
// TODO: validate this according to spec
|
||||
|
@ -152,19 +162,27 @@ struct KernAux_Arch_I386_PTE {
|
|||
unsigned available : 3;
|
||||
unsigned addr : 20;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PDE, 4);
|
||||
|
||||
// Page directory
|
||||
struct KernAux_Arch_I386_PageDir {
|
||||
struct KernAux_Arch_I386_PDE pdes[KERNAUX_ARCH_I386_PAGE_DIR_ENTRIES_COUNT];
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PageDir, KERNAUX_ARCH_I386_PAGE_SIZE);
|
||||
|
||||
// Page table
|
||||
struct KernAux_Arch_I386_PageTable {
|
||||
struct KernAux_Arch_I386_PTE ptes[KERNAUX_ARCH_I386_PAGE_TABLE_ENTRIES_COUNT];
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PageTable, KERNAUX_ARCH_I386_PAGE_SIZE);
|
||||
|
||||
#include <kernaux/macro/packing_end.run>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -5,8 +5,12 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <kernaux/macro.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
struct KernAux_ELF_Header {
|
||||
unsigned magic_0x7f : 8;
|
||||
unsigned magic_E : 8;
|
||||
|
@ -32,7 +36,9 @@ struct KernAux_ELF_Header {
|
|||
unsigned sect_entr_num : 16;
|
||||
unsigned sect_names_idx : 16;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_ELF_Header, 52);
|
||||
|
||||
struct KernAux_ELF_ProgramEntry {
|
||||
unsigned type : 32;
|
||||
|
@ -44,7 +50,9 @@ struct KernAux_ELF_ProgramEntry {
|
|||
unsigned flags : 32;
|
||||
unsigned align : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_ELF_ProgramEntry, 32);
|
||||
|
||||
struct KernAux_ELF_SectionEntry {
|
||||
unsigned name : 32;
|
||||
|
@ -58,13 +66,19 @@ struct KernAux_ELF_SectionEntry {
|
|||
unsigned alignment : 32;
|
||||
unsigned ent_size : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_ELF_SectionEntry, 40);
|
||||
|
||||
struct KernAux_ELF_RelocationEntry {
|
||||
unsigned virt_addr : 32;
|
||||
unsigned info : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_ELF_RelocationEntry, 8);
|
||||
|
||||
#include <kernaux/macro/packing_end.run>
|
||||
|
||||
typedef struct KernAux_ELF_ProgramEntry KernAux_ELF_ProgramTable[];
|
||||
|
||||
|
|
|
@ -18,6 +18,19 @@ extern "C" {
|
|||
# endif
|
||||
#endif // KERNAUX_ACCESS_PRIVATE
|
||||
|
||||
#ifdef __TINYC__
|
||||
# define KERNAUX_PACKING_ATTR
|
||||
#else
|
||||
# define KERNAUX_PACKING_ATTR __attribute__((packed))
|
||||
#endif
|
||||
|
||||
#define KERNAUX_STATIC_TEST_STRUCT_SIZE(name, size) \
|
||||
__attribute__((unused)) \
|
||||
static const int \
|
||||
_kernaux_static_test_struct_size_##name[ \
|
||||
sizeof(struct name) == (size) ? 1 : -1 \
|
||||
]
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
3
include/kernaux/macro/packing_end.run
Normal file
3
include/kernaux/macro/packing_end.run
Normal file
|
@ -0,0 +1,3 @@
|
|||
#ifdef __TINYC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
3
include/kernaux/macro/packing_start.run
Normal file
3
include/kernaux/macro/packing_start.run
Normal file
|
@ -0,0 +1,3 @@
|
|||
#ifdef __TINYC__
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
|
@ -5,6 +5,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <kernaux/macro.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -15,6 +17,8 @@ extern "C" {
|
|||
#define KERNAUX_MBR_BOOTSTRAP_SIZE \
|
||||
(KERNAUX_MBR_SIZE - sizeof(struct KernAux_Mbr_Info))
|
||||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
struct KernAux_Mbr_Entry {
|
||||
uint8_t drive_attributes;
|
||||
unsigned first_sector_chs_addr : 24;
|
||||
|
@ -23,7 +27,9 @@ struct KernAux_Mbr_Entry {
|
|||
uint32_t first_sector_lba_addr;
|
||||
uint32_t sectors_count;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Mbr_Entry, 16);
|
||||
|
||||
struct KernAux_Mbr_Info {
|
||||
uint32_t disk_id;
|
||||
|
@ -31,13 +37,25 @@ struct KernAux_Mbr_Info {
|
|||
struct KernAux_Mbr_Entry entries[KERNAUX_MBR_ENTRIES];
|
||||
uint16_t magic;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(
|
||||
KernAux_Mbr_Info,
|
||||
8 + KERNAUX_MBR_ENTRIES * sizeof(struct KernAux_Mbr_Entry)
|
||||
);
|
||||
|
||||
struct KernAux_Mbr {
|
||||
uint8_t bootstrap[KERNAUX_MBR_BOOTSTRAP_SIZE];
|
||||
struct KernAux_Mbr_Info info;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(
|
||||
KernAux_Mbr,
|
||||
KERNAUX_MBR_BOOTSTRAP_SIZE + sizeof(struct KernAux_Mbr_Info)
|
||||
);
|
||||
|
||||
#include <kernaux/macro/packing_end.run>
|
||||
|
||||
bool KernAux_Mbr_is_valid(const struct KernAux_Mbr *mbr);
|
||||
bool KernAux_Mbr_Info_is_valid(const struct KernAux_Mbr_Info *mbr_info);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <kernaux/macro.h>
|
||||
@comment_line_memmap@#include <kernaux/memmap.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
@ -40,9 +41,7 @@ extern "C" {
|
|||
#define KERNAUX_MULTIBOOT2_HTAG_FLAGS_REQUIRE_CONSOLE (1 << 0)
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_FLAGS_EGA_SUPPORT (1 << 1)
|
||||
|
||||
#ifdef __TINYC__
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
/***********************
|
||||
* Header common types *
|
||||
|
@ -59,7 +58,9 @@ struct KernAux_Multiboot2_Header {
|
|||
unsigned total_size : 32;
|
||||
unsigned checksum : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_Header, 16);
|
||||
|
||||
enum KernAux_Multiboot2_HTag {
|
||||
KERNAUX_MULTIBOOT2_HTAG_NONE = 0,
|
||||
|
@ -80,7 +81,9 @@ struct KernAux_Multiboot2_HTagBase {
|
|||
unsigned flags : 16;
|
||||
unsigned size : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTagBase, 8);
|
||||
|
||||
/****************************
|
||||
* Information common types *
|
||||
|
@ -90,7 +93,9 @@ struct KernAux_Multiboot2_Info {
|
|||
unsigned total_size : 32;
|
||||
unsigned reserved1 : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_Info, 8);
|
||||
|
||||
enum KernAux_Multiboot2_ITag {
|
||||
KERNAUX_MULTIBOOT2_ITAG_NONE = 0,
|
||||
|
@ -121,7 +126,9 @@ struct KernAux_Multiboot2_ITagBase {
|
|||
enum KernAux_Multiboot2_ITag type : 32;
|
||||
unsigned size : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITagBase, 8);
|
||||
|
||||
/***************************
|
||||
* Header additional types *
|
||||
|
@ -143,7 +150,9 @@ struct KernAux_Multiboot2_ITag_MemoryMap_EntryBase {
|
|||
unsigned type : 32;
|
||||
unsigned reserved1 : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_MemoryMap_EntryBase, 24);
|
||||
|
||||
/*************************
|
||||
* Header tag structures *
|
||||
|
@ -154,14 +163,18 @@ struct KernAux_Multiboot2_HTag_None {
|
|||
// size = 8
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_None, 8);
|
||||
|
||||
struct KernAux_Multiboot2_HTag_InfoReq {
|
||||
// type = 1
|
||||
// size > 8
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_InfoReq, 8);
|
||||
|
||||
struct KernAux_Multiboot2_HTag_Addr {
|
||||
// type = 2
|
||||
|
@ -173,7 +186,9 @@ struct KernAux_Multiboot2_HTag_Addr {
|
|||
unsigned load_end_addr : 32;
|
||||
unsigned bss_end_addr : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_Addr, 24);
|
||||
|
||||
struct KernAux_Multiboot2_HTag_EntryAddr {
|
||||
// type = 3
|
||||
|
@ -182,7 +197,9 @@ struct KernAux_Multiboot2_HTag_EntryAddr {
|
|||
|
||||
unsigned entry_addr : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_EntryAddr, 12);
|
||||
|
||||
struct KernAux_Multiboot2_HTag_Flags {
|
||||
// type = 4
|
||||
|
@ -191,7 +208,9 @@ struct KernAux_Multiboot2_HTag_Flags {
|
|||
|
||||
unsigned console_flags : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_Flags, 12);
|
||||
|
||||
struct KernAux_Multiboot2_HTag_Framebuffer {
|
||||
// type = 5
|
||||
|
@ -202,21 +221,27 @@ struct KernAux_Multiboot2_HTag_Framebuffer {
|
|||
unsigned height : 32;
|
||||
unsigned depth : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_Framebuffer, 20);
|
||||
|
||||
struct KernAux_Multiboot2_HTag_ModuleAlign {
|
||||
// type = 6
|
||||
// size = 8
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_ModuleAlign, 8);
|
||||
|
||||
struct KernAux_Multiboot2_HTag_EFIBootServices {
|
||||
// type = 7
|
||||
// size = 8
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_EFIBootServices, 8);
|
||||
|
||||
struct KernAux_Multiboot2_HTag_EFII386EntryAddr {
|
||||
// type = 8
|
||||
|
@ -225,7 +250,9 @@ struct KernAux_Multiboot2_HTag_EFII386EntryAddr {
|
|||
|
||||
unsigned entry_addr : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_EFII386EntryAddr, 12);
|
||||
|
||||
struct KernAux_Multiboot2_HTag_EFIAmd64EntryAddr {
|
||||
// type = 9
|
||||
|
@ -234,7 +261,9 @@ struct KernAux_Multiboot2_HTag_EFIAmd64EntryAddr {
|
|||
|
||||
unsigned entry_addr : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_EFIAmd64EntryAddr, 12);
|
||||
|
||||
struct KernAux_Multiboot2_HTag_RelocatableHeader {
|
||||
// type = 10
|
||||
|
@ -246,7 +275,9 @@ struct KernAux_Multiboot2_HTag_RelocatableHeader {
|
|||
unsigned align : 32;
|
||||
enum KernAux_Multiboot2_HTag_RelocatableHeader_Preference preferences : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_RelocatableHeader, 24);
|
||||
|
||||
/******************************
|
||||
* Information tag structures *
|
||||
|
@ -257,21 +288,27 @@ struct KernAux_Multiboot2_ITag_None {
|
|||
// size = 8
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_None, 8);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_BootCmdLine {
|
||||
// type = 1
|
||||
// size > 8
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_BootCmdLine, 8);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_BootLoaderName {
|
||||
// type = 2
|
||||
// size > 8
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_BootLoaderName, 8);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_Module {
|
||||
// type = 3
|
||||
|
@ -281,7 +318,9 @@ struct KernAux_Multiboot2_ITag_Module {
|
|||
unsigned mod_start : 32;
|
||||
unsigned mod_end : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_Module, 16);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_BasicMemoryInfo {
|
||||
// type = 4
|
||||
|
@ -291,7 +330,9 @@ struct KernAux_Multiboot2_ITag_BasicMemoryInfo {
|
|||
unsigned mem_lower : 32;
|
||||
unsigned mem_upper : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_BasicMemoryInfo, 16);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_BIOSBootDevice {
|
||||
// type = 5
|
||||
|
@ -302,7 +343,9 @@ struct KernAux_Multiboot2_ITag_BIOSBootDevice {
|
|||
unsigned partition : 32;
|
||||
unsigned sub_partition : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_BIOSBootDevice, 20);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_MemoryMap {
|
||||
// type = 6
|
||||
|
@ -312,7 +355,9 @@ struct KernAux_Multiboot2_ITag_MemoryMap {
|
|||
unsigned entry_size : 32;
|
||||
unsigned entry_version : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_MemoryMap, 16);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_VBEInfo {
|
||||
// type = 7
|
||||
|
@ -326,7 +371,9 @@ struct KernAux_Multiboot2_ITag_VBEInfo {
|
|||
unsigned char vbe_control_info[512];
|
||||
unsigned char vbe_mode_info[256];
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_VBEInfo, 784);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_FramebufferInfo {
|
||||
// type = 8
|
||||
|
@ -341,7 +388,9 @@ struct KernAux_Multiboot2_ITag_FramebufferInfo {
|
|||
unsigned framebuffer_type : 8;
|
||||
unsigned reserved1 : 8;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_FramebufferInfo, 31);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_ELFSymbols {
|
||||
// type = 9
|
||||
|
@ -353,7 +402,9 @@ struct KernAux_Multiboot2_ITag_ELFSymbols {
|
|||
unsigned shndx : 16;
|
||||
unsigned reserved1 : 16;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_ELFSymbols, 16);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_APMTable {
|
||||
// type = 10
|
||||
|
@ -370,7 +421,9 @@ struct KernAux_Multiboot2_ITag_APMTable {
|
|||
unsigned cseg_16_len : 16;
|
||||
unsigned dseg_len : 16;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_APMTable, 28);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_EFI32bitSystemTablePtr {
|
||||
// type = 11
|
||||
|
@ -379,7 +432,9 @@ struct KernAux_Multiboot2_ITag_EFI32bitSystemTablePtr {
|
|||
|
||||
unsigned pointer : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_EFI32bitSystemTablePtr, 12);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_EFI64bitSystemTablePtr {
|
||||
// type = 12
|
||||
|
@ -388,7 +443,9 @@ struct KernAux_Multiboot2_ITag_EFI64bitSystemTablePtr {
|
|||
|
||||
unsigned long long pointer : 64;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_EFI64bitSystemTablePtr, 16);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_SMBIOSTables {
|
||||
// type = 13
|
||||
|
@ -399,28 +456,36 @@ struct KernAux_Multiboot2_ITag_SMBIOSTables {
|
|||
unsigned minor : 8;
|
||||
unsigned char reserved1[6];
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_SMBIOSTables, 16);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_ACPIOldRSDP {
|
||||
// type = 14
|
||||
// size > 8
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_ACPIOldRSDP, 8);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_ACPINewRSDP {
|
||||
// type = 15
|
||||
// size > 8
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_ACPINewRSDP, 8);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_NetworkingInfo {
|
||||
// type = 16
|
||||
// size > 8
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_NetworkingInfo, 8);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_EFIMemoryMap {
|
||||
// type = 17
|
||||
|
@ -430,14 +495,21 @@ struct KernAux_Multiboot2_ITag_EFIMemoryMap {
|
|||
unsigned descriptor_size : 32;
|
||||
unsigned descriptor_version : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_EFIMemoryMap, 16);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_EFIBootServicesNotTerminated {
|
||||
// type = 18
|
||||
// size = 8
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(
|
||||
KernAux_Multiboot2_ITag_EFIBootServicesNotTerminated,
|
||||
8
|
||||
);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_EFI32bitImageHandlePtr {
|
||||
// type = 19
|
||||
|
@ -446,7 +518,12 @@ struct KernAux_Multiboot2_ITag_EFI32bitImageHandlePtr {
|
|||
|
||||
unsigned pointer : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(
|
||||
KernAux_Multiboot2_ITag_EFI32bitImageHandlePtr,
|
||||
12
|
||||
);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_EFI64bitImageHandlePtr {
|
||||
// type = 20
|
||||
|
@ -455,7 +532,12 @@ struct KernAux_Multiboot2_ITag_EFI64bitImageHandlePtr {
|
|||
|
||||
unsigned long long pointer : 64;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(
|
||||
KernAux_Multiboot2_ITag_EFI64bitImageHandlePtr,
|
||||
16
|
||||
);
|
||||
|
||||
struct KernAux_Multiboot2_ITag_ImageLoadBasePhysAddr {
|
||||
// type = 21
|
||||
|
@ -464,11 +546,14 @@ struct KernAux_Multiboot2_ITag_ImageLoadBasePhysAddr {
|
|||
|
||||
unsigned load_base_addr : 32;
|
||||
}
|
||||
__attribute__((packed));
|
||||
KERNAUX_PACKING_ATTR;
|
||||
|
||||
#ifdef __TINYC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(
|
||||
KernAux_Multiboot2_ITag_ImageLoadBasePhysAddr,
|
||||
12
|
||||
);
|
||||
|
||||
#include <kernaux/macro/packing_end.run>
|
||||
|
||||
/********************
|
||||
* String functions *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef __TINYC__
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
#include <kernaux/macro.h>
|
||||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
static const struct {
|
||||
struct KernAux_Multiboot2_Header multiboot2_header;
|
||||
|
@ -34,7 +34,7 @@ static const struct {
|
|||
struct KernAux_Multiboot2_HTag_RelocatableHeader tag_relocatable_header;
|
||||
|
||||
struct KernAux_Multiboot2_HTag_None tag_none;
|
||||
} multiboot2_header_example2 = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_header_example2 = {
|
||||
.multiboot2_header = {
|
||||
.magic = KERNAUX_MULTIBOOT2_HEADER_MAGIC,
|
||||
.arch = KERNAUX_MULTIBOOT2_HEADER_ARCH_I386,
|
||||
|
@ -168,6 +168,4 @@ static const struct {
|
|||
},
|
||||
};
|
||||
|
||||
#ifdef __TINYC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#include <kernaux/macro/packing_end.run>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef __TINYC__
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
#include <kernaux/macro.h>
|
||||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
static const struct {
|
||||
struct KernAux_Multiboot2_Info multiboot2_info;
|
||||
|
@ -105,7 +105,7 @@ static const struct {
|
|||
uint8_t _align11[4];
|
||||
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} multiboot2_info_example2 = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_info_example2 = {
|
||||
.multiboot2_info = {
|
||||
.total_size = sizeof(multiboot2_info_example2),
|
||||
.reserved1 = 0,
|
||||
|
@ -370,6 +370,4 @@ static const struct {
|
|||
},
|
||||
};
|
||||
|
||||
#ifdef __TINYC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#include <kernaux/macro/packing_end.run>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <kernaux/macro.h>
|
||||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -9,14 +10,12 @@
|
|||
#include "multiboot2_info_example1.h"
|
||||
#include "multiboot2_info_example2.h"
|
||||
|
||||
#ifdef __TINYC__
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
static const struct {
|
||||
struct KernAux_Multiboot2_Info multiboot2_info;
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} multiboot2_without_boot_cmd_line = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_without_boot_cmd_line = {
|
||||
.multiboot2_info = {
|
||||
.total_size = sizeof(multiboot2_without_boot_cmd_line),
|
||||
.reserved1 = 0,
|
||||
|
@ -40,7 +39,7 @@ static const struct {
|
|||
unsigned char _align1[2];
|
||||
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} multiboot2_with_some_boot_cmd_line = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_with_some_boot_cmd_line = {
|
||||
.multiboot2_info = {
|
||||
.total_size = sizeof(multiboot2_with_some_boot_cmd_line),
|
||||
.reserved1 = 0,
|
||||
|
@ -82,7 +81,7 @@ static const struct {
|
|||
unsigned char _align2[3];
|
||||
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} multiboot2_with_two_boot_cmd_lines = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_with_two_boot_cmd_lines = {
|
||||
.multiboot2_info = {
|
||||
.total_size = sizeof(multiboot2_with_two_boot_cmd_lines),
|
||||
.reserved1 = 0,
|
||||
|
@ -117,9 +116,7 @@ static const struct {
|
|||
},
|
||||
};
|
||||
|
||||
#ifdef __TINYC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#include <kernaux/macro/packing_end.run>
|
||||
|
||||
void test_main()
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <kernaux/macro.h>
|
||||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -9,9 +10,7 @@
|
|||
#include "multiboot2_info_example1.h"
|
||||
#include "multiboot2_info_example2.h"
|
||||
|
||||
#ifdef __TINYC__
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
/************
|
||||
* Tag_None *
|
||||
|
@ -45,7 +44,7 @@ static const struct KernAux_Multiboot2_ITag_None tag_none_invalid_size = {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_BootCmdLine tag;
|
||||
char cmdline[1];
|
||||
} tag_boot_cmd_line_with_empty_cmdline_valid = {
|
||||
} KERNAUX_PACKING_ATTR tag_boot_cmd_line_with_empty_cmdline_valid = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE,
|
||||
|
@ -58,7 +57,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_BootCmdLine tag;
|
||||
char cmdline[14];
|
||||
} tag_boot_cmd_line_with_some_cmdline_valid = {
|
||||
} KERNAUX_PACKING_ATTR tag_boot_cmd_line_with_some_cmdline_valid = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE,
|
||||
|
@ -71,7 +70,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_BootCmdLine tag;
|
||||
char cmdline[1];
|
||||
} tag_boot_cmd_line_invalid_type = {
|
||||
} KERNAUX_PACKING_ATTR tag_boot_cmd_line_invalid_type = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_NONE,
|
||||
|
@ -84,7 +83,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_BootCmdLine tag;
|
||||
char cmdline[1];
|
||||
} tag_boot_cmd_line_with_empty_cmdline_invalid_size = {
|
||||
} KERNAUX_PACKING_ATTR tag_boot_cmd_line_with_empty_cmdline_invalid_size = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE,
|
||||
|
@ -97,7 +96,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_BootCmdLine tag;
|
||||
char cmdline[14];
|
||||
} tag_boot_cmd_line_with_some_cmdline_invalid_size = {
|
||||
} KERNAUX_PACKING_ATTR tag_boot_cmd_line_with_some_cmdline_invalid_size = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE,
|
||||
|
@ -114,7 +113,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_BootLoaderName tag;
|
||||
char name[1];
|
||||
} tag_boot_loader_name_with_empty_name_valid = {
|
||||
} KERNAUX_PACKING_ATTR tag_boot_loader_name_with_empty_name_valid = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME,
|
||||
|
@ -127,7 +126,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_BootLoaderName tag;
|
||||
char name[14];
|
||||
} tag_boot_loader_name_with_some_name_valid = {
|
||||
} KERNAUX_PACKING_ATTR tag_boot_loader_name_with_some_name_valid = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME,
|
||||
|
@ -140,7 +139,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_BootLoaderName tag;
|
||||
char name[1];
|
||||
} tag_boot_loader_name_invalid_type = {
|
||||
} KERNAUX_PACKING_ATTR tag_boot_loader_name_invalid_type = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_NONE,
|
||||
|
@ -153,7 +152,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_BootLoaderName tag;
|
||||
char name[1];
|
||||
} tag_boot_loader_name_with_empty_name_invalid_size = {
|
||||
} KERNAUX_PACKING_ATTR tag_boot_loader_name_with_empty_name_invalid_size = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME,
|
||||
|
@ -166,7 +165,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_BootLoaderName tag;
|
||||
char name[14];
|
||||
} tag_boot_loader_name_with_some_name_invalid_size = {
|
||||
} KERNAUX_PACKING_ATTR tag_boot_loader_name_with_some_name_invalid_size = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME,
|
||||
|
@ -183,7 +182,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_Module tag;
|
||||
char cmdline[1];
|
||||
} tag_module_with_empty_name_valid = {
|
||||
} KERNAUX_PACKING_ATTR tag_module_with_empty_name_valid = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
|
||||
|
@ -198,7 +197,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_Module tag;
|
||||
char cmdline[14];
|
||||
} tag_module_with_some_name_valid = {
|
||||
} KERNAUX_PACKING_ATTR tag_module_with_some_name_valid = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
|
||||
|
@ -213,7 +212,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_Module tag;
|
||||
char cmdline[1];
|
||||
} tag_module_invalid_type = {
|
||||
} KERNAUX_PACKING_ATTR tag_module_invalid_type = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_NONE,
|
||||
|
@ -228,7 +227,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_Module tag;
|
||||
char cmdline[1];
|
||||
} tag_module_with_empty_name_invalid_size = {
|
||||
} KERNAUX_PACKING_ATTR tag_module_with_empty_name_invalid_size = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
|
||||
|
@ -243,7 +242,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_Module tag;
|
||||
char cmdline[14];
|
||||
} tag_module_with_some_name_invalid_size = {
|
||||
} KERNAUX_PACKING_ATTR tag_module_with_some_name_invalid_size = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
|
||||
|
@ -258,7 +257,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_Module tag;
|
||||
char cmdline[14];
|
||||
} tag_module_with_equal_start_end_invalid = {
|
||||
} KERNAUX_PACKING_ATTR tag_module_with_equal_start_end_invalid = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
|
||||
|
@ -273,7 +272,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_Module tag;
|
||||
char cmdline[14];
|
||||
} tag_module_with_reversed_start_end_invalid = {
|
||||
} KERNAUX_PACKING_ATTR tag_module_with_reversed_start_end_invalid = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
|
||||
|
@ -373,7 +372,7 @@ tag_memory_map_with_empty_data_valid = {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_MemoryMap tag;
|
||||
unsigned char data[8 * 2];
|
||||
} tag_memory_map_with_some_small_data_items_valid = {
|
||||
} KERNAUX_PACKING_ATTR tag_memory_map_with_some_small_data_items_valid = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP,
|
||||
|
@ -387,7 +386,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_MemoryMap tag;
|
||||
unsigned char data[64 * 2];
|
||||
} tag_memory_map_with_some_large_data_items_valid = {
|
||||
} KERNAUX_PACKING_ATTR tag_memory_map_with_some_large_data_items_valid = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP,
|
||||
|
@ -421,7 +420,7 @@ tag_memory_map_with_empty_data_invalid_size = {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_MemoryMap tag;
|
||||
unsigned char data[64 * 2 + 1];
|
||||
} tag_memory_map_with_some_large_data_items_invalid_size = {
|
||||
} KERNAUX_PACKING_ATTR tag_memory_map_with_some_large_data_items_invalid_size = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP,
|
||||
|
@ -455,7 +454,7 @@ tag_memory_map_with_empty_data_invalid_entry_size_not_mul8 = {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_MemoryMap tag;
|
||||
unsigned char data[9 * 2];
|
||||
} tag_memory_map_with_some_small_data_items_invalid_entry_size_not_mul8 = {
|
||||
} KERNAUX_PACKING_ATTR tag_memory_map_with_some_small_data_items_invalid_entry_size_not_mul8 = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP,
|
||||
|
@ -469,7 +468,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_ITag_MemoryMap tag;
|
||||
unsigned char data[63 * 2];
|
||||
} tag_memory_map_with_some_large_data_items_invalid_entry_size_not_mul8 = {
|
||||
} KERNAUX_PACKING_ATTR tag_memory_map_with_some_large_data_items_invalid_entry_size_not_mul8 = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP,
|
||||
|
@ -549,7 +548,7 @@ tag_elf_symbols_with_zero_ent_size_valid = {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_Info multiboot2_info;
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} multiboot2_empty_valid = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_empty_valid = {
|
||||
.multiboot2_info = {
|
||||
.total_size = 8 + 8,
|
||||
.reserved1 = 0,
|
||||
|
@ -566,7 +565,7 @@ static const struct {
|
|||
struct KernAux_Multiboot2_Info multiboot2_info;
|
||||
struct KernAux_Multiboot2_ITag_BasicMemoryInfo tag_basic_memory_info;
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} multiboot2_with_some_additional_tag_valid = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_with_some_additional_tag_valid = {
|
||||
.multiboot2_info = {
|
||||
.total_size = 8 + 16 + 8,
|
||||
.reserved1 = 0,
|
||||
|
@ -593,7 +592,7 @@ static const struct {
|
|||
struct KernAux_Multiboot2_ITag_BIOSBootDevice tag_bios_boot_device;
|
||||
unsigned char _align1[4];
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} multiboot2_with_more_additional_tags_valid = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_with_more_additional_tags_valid = {
|
||||
.multiboot2_info = {
|
||||
.total_size = 8 + 16 + (20 + 4) + 8,
|
||||
.reserved1 = 0,
|
||||
|
@ -626,7 +625,7 @@ static const struct {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_Info multiboot2_info;
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} multiboot2_empty_invalid_size = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_empty_invalid_size = {
|
||||
.multiboot2_info = {
|
||||
.total_size = 8,
|
||||
.reserved1 = 0,
|
||||
|
@ -648,7 +647,7 @@ multiboot2_without_none_tag_invalid = {
|
|||
static const struct {
|
||||
struct KernAux_Multiboot2_Info multiboot2_info;
|
||||
struct KernAux_Multiboot2_ITag_BasicMemoryInfo tag_basic_memory_info;
|
||||
} multiboot2_with_invalid_last_tag_invalid = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_with_invalid_last_tag_invalid = {
|
||||
.multiboot2_info = {
|
||||
.total_size = 8 + 16,
|
||||
.reserved1 = 0,
|
||||
|
@ -670,7 +669,7 @@ static const struct {
|
|||
struct KernAux_Multiboot2_ITag_BIOSBootDevice tag_bios_boot_device;
|
||||
unsigned char _align1[4];
|
||||
struct KernAux_Multiboot2_ITag_None tag_none2;
|
||||
} multiboot2_with_early_none_tag_invalid = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_with_early_none_tag_invalid = {
|
||||
.multiboot2_info = {
|
||||
.total_size = 8 + 16 + 8 + (20 + 4) + 8,
|
||||
.reserved1 = 0,
|
||||
|
@ -712,7 +711,7 @@ static const struct {
|
|||
struct KernAux_Multiboot2_ITag_BIOSBootDevice tag_bios_boot_device;
|
||||
unsigned char _align1[4];
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} multiboot2_with_more_additional_tags_invalid_size_too_big = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_with_more_additional_tags_invalid_size_too_big = {
|
||||
.multiboot2_info = {
|
||||
.total_size = 8 + 16 + (20 + 4) + 8 + 1,
|
||||
.reserved1 = 0,
|
||||
|
@ -748,7 +747,7 @@ static const struct {
|
|||
struct KernAux_Multiboot2_ITag_BIOSBootDevice tag_bios_boot_device;
|
||||
unsigned char _align1[4];
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} multiboot2_with_more_additional_tags_invalid_size_too_small = {
|
||||
} KERNAUX_PACKING_ATTR multiboot2_with_more_additional_tags_invalid_size_too_small = {
|
||||
.multiboot2_info = {
|
||||
.total_size = 8 + 16 + (20 + 4) + 8 - 1,
|
||||
.reserved1 = 0,
|
||||
|
@ -778,9 +777,7 @@ static const struct {
|
|||
},
|
||||
};
|
||||
|
||||
#ifdef __TINYC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#include <kernaux/macro/packing_end.run>
|
||||
|
||||
/********
|
||||
* main *
|
||||
|
|
Loading…
Add table
Reference in a new issue