mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-20 11:06:41 -05:00
Conditional bitfields (#134)
This commit is contained in:
parent
bf8eaaa575
commit
b7f8a70d46
8 changed files with 285 additions and 126 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -114,6 +114,8 @@ jobs:
|
|||
debug: ['--disable-debug', '--enable-debug']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: apt update
|
||||
run: sudo apt-get --yes update
|
||||
- name: dependencies
|
||||
run: sudo apt-get --yes install crossbuild-essential-i386
|
||||
- name: autogen
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2022-12-08 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* include/kernaux/*.h: Definition "KERNAUX_BITFIELDS" has been added
|
||||
|
||||
2022-12-05 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
libkernaux 0.6.1 released
|
||||
|
|
|
@ -100,6 +100,8 @@ zero). Work-in-progress APIs can change at any time.
|
|||
* `KERNAUX_ACCESS_PRIVATE` - disable access modifier "private". Don't do this!
|
||||
* `KERNAUX_ACCESS_PROTECTED` - disable access modifier "protected". Only do this
|
||||
in a file where you implement an inherited type.
|
||||
* `KERNAUX_BITFIELDS` - enable bitfields in packed structs. It doesn't follow
|
||||
the C standard and may be incompatible with some compilers.
|
||||
|
||||
### Global variables
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ extern "C" {
|
|||
#include <kernaux/arch/x86.h>
|
||||
#include <kernaux/macro.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define KERNAUX_ARCH_I386_PAGE_SIZE (1024 * 4) // 4 KiB
|
||||
|
@ -28,32 +29,35 @@ extern "C" {
|
|||
#define KERNAUX_ARCH_I386_ADDR_TO_PTE_ADDR(addr) \
|
||||
KERNAUX_ARCH_I386_ADDR_TO_PDE_ADDR(addr)
|
||||
|
||||
// CR0 bits
|
||||
#define KERNAUX_ARCH_I386_CR0_PE KERNAUX_BITS32(0) // 0: Protected Mode Enable
|
||||
#define KERNAUX_ARCH_I386_CR0_MP KERNAUX_BITS32(1) // 1: Monitor co-processor
|
||||
#define KERNAUX_ARCH_I386_CR0_EM KERNAUX_BITS32(2) // 2: x87 FPU Emulation
|
||||
#define KERNAUX_ARCH_I386_CR0_TS KERNAUX_BITS32(3) // 3: Task switched
|
||||
#define KERNAUX_ARCH_I386_CR0_ET KERNAUX_BITS32(4) // 4: Extension type
|
||||
#define KERNAUX_ARCH_I386_CR0_NE KERNAUX_BITS32(5) // 5: Numeric error
|
||||
#define KERNAUX_ARCH_I386_CR0_WP KERNAUX_BITS32(16) // 16: Write protect
|
||||
#define KERNAUX_ARCH_I386_CR0_AM KERNAUX_BITS32(18) // 18: Alignment mask
|
||||
#define KERNAUX_ARCH_I386_CR0_NW KERNAUX_BITS32(29) // 29: Not-write trough
|
||||
#define KERNAUX_ARCH_I386_CR0_CD KERNAUX_BITS32(30) // 30: Cache disable
|
||||
#define KERNAUX_ARCH_I386_CR0_PG KERNAUX_BITS32(31) // 31: Paging
|
||||
|
||||
// Some CR4 bits
|
||||
#define KERNAUX_ARCH_I386_CR4_VME KERNAUX_BITS32(0) // 0: Virtual 8086 Mode Extensions
|
||||
#define KERNAUX_ARCH_I386_CR4_PVI KERNAUX_BITS32(1) // 1: Protected-mode Virtual Interrupts
|
||||
#define KERNAUX_ARCH_I386_CR4_TSD KERNAUX_BITS32(2) // 2: Time Stamp Disable
|
||||
#define KERNAUX_ARCH_I386_CR4_DE KERNAUX_BITS32(3) // 3: Debugging Extensions
|
||||
#define KERNAUX_ARCH_I386_CR4_PSE KERNAUX_BITS32(4) // 4: Page Size Extension
|
||||
#define KERNAUX_ARCH_I386_CR4_PAE KERNAUX_BITS32(5) // 5: Physical Address Extension
|
||||
#define KERNAUX_ARCH_I386_CR4_MCE KERNAUX_BITS32(6) // 6: Machine Check Exception
|
||||
#define KERNAUX_ARCH_I386_CR4_PGE KERNAUX_BITS32(7) // 7: Page Global Enabled
|
||||
// TODO: bits 8-31
|
||||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
/**
|
||||
* @brief CR0 bits
|
||||
*
|
||||
* @details
|
||||
* Contains system control flags that control
|
||||
* operating mode and states of the processor.
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/Control_register#CR0
|
||||
* @see https://wiki.osdev.org/CPU_Registers_x86#CR0
|
||||
*/
|
||||
KERNAUX_ARCH_X86_DEFINE_CR0(I386, uint32_t);
|
||||
KERNAUX_STATIC_TEST_UNION_SIZE(KernAux_Arch_I386_CR0, 4);
|
||||
|
||||
/**
|
||||
* @brief CR4 bits
|
||||
*
|
||||
* @details
|
||||
* Contains a group of flags that enable several architectural extensions,
|
||||
* and indicate operating system or executive support for specific processor
|
||||
* capabilities.
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/Control_register#CR4
|
||||
* @see https://wiki.osdev.org/CPU_Registers_x86#CR4
|
||||
*/
|
||||
KERNAUX_ARCH_X86_DEFINE_CR4(I386, uint32_t);
|
||||
KERNAUX_STATIC_TEST_UNION_SIZE(KernAux_Arch_I386_CR4, 4);
|
||||
|
||||
// Global, local or interrupt descriptor table register
|
||||
// TODO: validate this according to spec
|
||||
struct KernAux_Arch_I386_DTR {
|
||||
|
@ -67,7 +71,7 @@ KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_DTR, 6);
|
|||
// Global or local descriptor table entry
|
||||
// TODO: validate this according to spec
|
||||
struct KernAux_Arch_I386_DTE {
|
||||
unsigned limit_low : 16;
|
||||
uint16_t limit_low;
|
||||
unsigned base_low : 24;
|
||||
unsigned accessed : 1;
|
||||
unsigned read_write : 1;
|
||||
|
@ -81,10 +85,12 @@ struct KernAux_Arch_I386_DTE {
|
|||
unsigned always_0 : 1;
|
||||
unsigned big : 1;
|
||||
unsigned gran : 1;
|
||||
unsigned base_high : 8;
|
||||
uint8_t base_high;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_DTE, 8);
|
||||
|
||||
// Interrupt descriptor table entry
|
||||
// TODO: validate this according to spec
|
||||
typedef struct KernAux_Arch_I386_IDTE {
|
||||
|
@ -97,7 +103,7 @@ typedef struct KernAux_Arch_I386_IDTE {
|
|||
KERNAUX_PACKED
|
||||
*KernAux_Arch_I386_IDTE;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_DTE, 8);
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_IDTE, 8);
|
||||
|
||||
void KernAux_Arch_I386_IDTE_set_offset(
|
||||
KernAux_Arch_I386_IDTE idte,
|
||||
|
@ -159,44 +165,54 @@ KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_TSS, 104);
|
|||
|
||||
// Page directory entry
|
||||
// TODO: validate this according to spec
|
||||
struct KernAux_Arch_I386_PDE {
|
||||
unsigned present : 1;
|
||||
unsigned writable : 1;
|
||||
unsigned user : 1;
|
||||
unsigned write_through : 1;
|
||||
unsigned cache_disabled : 1;
|
||||
unsigned accessed : 1;
|
||||
unsigned available0 : 1;
|
||||
unsigned page_size : 1;
|
||||
unsigned available1 : 4;
|
||||
unsigned addr : 20;
|
||||
union KernAux_Arch_I386_PDE {
|
||||
uint32_t number;
|
||||
#ifdef KERNAUX_BITFIELDS
|
||||
struct {
|
||||
unsigned present : 1;
|
||||
unsigned writable : 1;
|
||||
unsigned user : 1;
|
||||
unsigned write_through : 1;
|
||||
unsigned cache_disabled : 1;
|
||||
unsigned accessed : 1;
|
||||
unsigned available0 : 1;
|
||||
unsigned page_size : 1;
|
||||
unsigned available1 : 4;
|
||||
unsigned addr : 20;
|
||||
} KERNAUX_PACKED bitfields;
|
||||
#endif
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PDE, 4);
|
||||
KERNAUX_STATIC_TEST_UNION_SIZE(KernAux_Arch_I386_PDE, 4);
|
||||
|
||||
// Page table entry
|
||||
// TODO: validate this according to spec
|
||||
struct KernAux_Arch_I386_PTE {
|
||||
unsigned present : 1;
|
||||
unsigned writable : 1;
|
||||
unsigned user : 1;
|
||||
unsigned write_through : 1;
|
||||
unsigned cache_disabled : 1;
|
||||
unsigned accessed : 1;
|
||||
unsigned dirty : 1;
|
||||
unsigned attr_table : 1;
|
||||
unsigned global : 1;
|
||||
unsigned available : 3;
|
||||
unsigned addr : 20;
|
||||
union KernAux_Arch_I386_PTE {
|
||||
uint32_t number;
|
||||
#ifdef KERNAUX_BITFIELDS
|
||||
struct {
|
||||
unsigned present : 1;
|
||||
unsigned writable : 1;
|
||||
unsigned user : 1;
|
||||
unsigned write_through : 1;
|
||||
unsigned cache_disabled : 1;
|
||||
unsigned accessed : 1;
|
||||
unsigned dirty : 1;
|
||||
unsigned attr_table : 1;
|
||||
unsigned global : 1;
|
||||
unsigned available : 3;
|
||||
unsigned addr : 20;
|
||||
} KERNAUX_PACKED bitfields;
|
||||
#endif
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PDE, 4);
|
||||
KERNAUX_STATIC_TEST_UNION_SIZE(KernAux_Arch_I386_PTE, 4);
|
||||
|
||||
// Page directory
|
||||
struct KernAux_Arch_I386_PageDir {
|
||||
struct KernAux_Arch_I386_PDE pdes[KERNAUX_ARCH_I386_PAGE_DIR_ENTRIES_COUNT];
|
||||
union KernAux_Arch_I386_PDE pdes[KERNAUX_ARCH_I386_PAGE_DIR_ENTRIES_COUNT];
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -204,7 +220,7 @@ KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PageDir, KERNAUX_ARCH_I386_PAG
|
|||
|
||||
// Page table
|
||||
struct KernAux_Arch_I386_PageTable {
|
||||
struct KernAux_Arch_I386_PTE ptes[KERNAUX_ARCH_I386_PAGE_TABLE_ENTRIES_COUNT];
|
||||
union KernAux_Arch_I386_PTE ptes[KERNAUX_ARCH_I386_PAGE_TABLE_ENTRIES_COUNT];
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
|
|
@ -5,6 +5,107 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <kernaux/macro.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifndef KERNAUX_BITFIELDS
|
||||
#define KERNAUX_ARCH_X86_DEFINE_CR0(arch, number_type) \
|
||||
union KernAux_Arch_##arch##_CR0 { number_type number; } KERNAUX_PACKED
|
||||
#else
|
||||
#define KERNAUX_ARCH_X86_DEFINE_CR0(arch, number_type) \
|
||||
union KernAux_Arch_##arch##_CR0 { \
|
||||
number_type number; \
|
||||
struct { \
|
||||
bool pe : 1; /* 0: Protection Enable */ \
|
||||
bool mp : 1; /* 1: Monitor Coprocessor */ \
|
||||
bool em : 1; /* 2: Emulation (x87 FPU) */ \
|
||||
bool ts : 1; /* 3: Task Switched */ \
|
||||
bool et : 1; /* 4: Extension Type */ \
|
||||
bool ne : 1; /* 5: Numeric Error */ \
|
||||
unsigned _0 : 10; \
|
||||
bool wp : 1; /* 16: Write Protect */ \
|
||||
unsigned _1 : 1; \
|
||||
bool am : 1; /* 18: Alignment Mask */ \
|
||||
unsigned _2 : 10; \
|
||||
bool nw : 1; /* 29: Not Write-trough */ \
|
||||
bool cd : 1; /* 30: Cache Disable */ \
|
||||
bool pg : 1; /* 31: Paging */ \
|
||||
} KERNAUX_PACKED bitfields; \
|
||||
} KERNAUX_PACKED
|
||||
#endif
|
||||
|
||||
#define KERNAUX_ARCH_X86_CR0_PE KERNAUX_BITS32(0) // Protection Enable
|
||||
#define KERNAUX_ARCH_X86_CR0_MP KERNAUX_BITS32(1) // Monitor Coprocessor
|
||||
#define KERNAUX_ARCH_X86_CR0_EM KERNAUX_BITS32(2) // Emulation (x87 FPU)
|
||||
#define KERNAUX_ARCH_X86_CR0_TS KERNAUX_BITS32(3) // Task Switched
|
||||
#define KERNAUX_ARCH_X86_CR0_ET KERNAUX_BITS32(4) // Extension Type
|
||||
#define KERNAUX_ARCH_X86_CR0_NE KERNAUX_BITS32(5) // Numeric Error
|
||||
#define KERNAUX_ARCH_X86_CR0_WP KERNAUX_BITS32(16) // Write Protect
|
||||
#define KERNAUX_ARCH_X86_CR0_AM KERNAUX_BITS32(18) // Alignment Mask
|
||||
#define KERNAUX_ARCH_X86_CR0_NW KERNAUX_BITS32(29) // Not Write-trough
|
||||
#define KERNAUX_ARCH_X86_CR0_CD KERNAUX_BITS32(30) // Cache Disable
|
||||
#define KERNAUX_ARCH_X86_CR0_PG KERNAUX_BITS32(31) // Paging
|
||||
|
||||
#ifndef KERNAUX_BITFIELDS
|
||||
#define KERNAUX_ARCH_X86_DEFINE_CR4(arch, number_type) \
|
||||
union KernAux_Arch_##arch##_CR4 { number_type number; } KERNAUX_PACKED
|
||||
#else
|
||||
#define KERNAUX_ARCH_X86_DEFINE_CR4(arch, number_type) \
|
||||
union KernAux_Arch_##arch##_CR4 { \
|
||||
number_type number; \
|
||||
struct { \
|
||||
bool vme : 1; /* 0: Virtual-8086 Mode Extensions */ \
|
||||
bool pvi : 1; /* 1: Protected-Mode Virtual Interrupts */ \
|
||||
bool tsd : 1; /* 2: Time Stamp Disable */ \
|
||||
bool de : 1; /* 3: Debugging Extensions */ \
|
||||
bool pse : 1; /* 4: Page Size Extension */ \
|
||||
bool pae : 1; /* 5: Physical Address Extension */ \
|
||||
bool mce : 1; /* 6: Machine-Check Exception */ \
|
||||
bool pge : 1; /* 7: Page Global Enable */ \
|
||||
bool pce : 1; /* 8: Performance-Monitoring Counter Enabled */ \
|
||||
bool osfxsr : 1; /* 9: Operating System Support for */ \
|
||||
/* FXSAVE and FXRSTOR instructions */ \
|
||||
bool osxmmexcpt : 1; /* 10: Operating System Support for */ \
|
||||
/* Unmasked SIMD Floating-Point Exceptions */ \
|
||||
bool umip : 1; /* 11: User-Mode Instruction Prevention */ \
|
||||
unsigned _0 : 1; \
|
||||
bool vmxe : 1; /* 13: VME (Virtual Machine Extensions) Enable */ \
|
||||
bool smxe : 1; /* 14: SME (Safer Mode Extensions) Enable */ \
|
||||
unsigned _1 : 1; \
|
||||
bool fsgsbase : 1; /* 16: FSGSBASE Enable */ \
|
||||
bool pcide : 1; /* 17: PCID Enable */ \
|
||||
bool osxsave : 1; /* 18: XSAVE and Processor Extended States Enable */ \
|
||||
unsigned _2 : 1; \
|
||||
bool smep : 1; /* 20: SMEP (Supervisor Mode Execution Protection) Enable */ \
|
||||
bool smap : 1; /* 21: SMAP (Supervisor Mode Access Prevention) Enable */ \
|
||||
bool pke : 1; /* 22: Protection Key Enable */ \
|
||||
unsigned _3 : 9; \
|
||||
} KERNAUX_PACKED bitfields; \
|
||||
} KERNAUX_PACKED
|
||||
#endif
|
||||
|
||||
#define KERNAUX_ARCH_X86_CR4_VME KERNAUX_BITS32(0) // Virtual-8086 Mode Extensions
|
||||
#define KERNAUX_ARCH_X86_CR4_PVI KERNAUX_BITS32(1) // Protected-Mode Virtual Interrupts
|
||||
#define KERNAUX_ARCH_X86_CR4_TSD KERNAUX_BITS32(2) // Time Stamp Disable
|
||||
#define KERNAUX_ARCH_X86_CR4_DE KERNAUX_BITS32(3) // Debugging Extensions
|
||||
#define KERNAUX_ARCH_X86_CR4_PSE KERNAUX_BITS32(4) // Page Size Extension
|
||||
#define KERNAUX_ARCH_X86_CR4_PAE KERNAUX_BITS32(5) // Physical Address Extension
|
||||
#define KERNAUX_ARCH_X86_CR4_MCE KERNAUX_BITS32(6) // Machine-Check Exception
|
||||
#define KERNAUX_ARCH_X86_CR4_PGE KERNAUX_BITS32(7) // Page Global Enable
|
||||
#define KERNAUX_ARCH_X86_CR4_PCE KERNAUX_BITS32(8) // Performance-Monitoring Counter Enabled
|
||||
#define KERNAUX_ARCH_X86_CR4_OSFXSR KERNAUX_BITS32(9) // Operating System Support for FXSAVE and FXRSTOR instructions
|
||||
#define KERNAUX_ARCH_X86_CR4_OSXMMEXCPT KERNAUX_BITS32(10) // Operating System Support for Unmasked SIMD Floating-Point Exceptions
|
||||
#define KERNAUX_ARCH_X86_CR4_UMIP KERNAUX_BITS32(11) // User-Mode Instruction Prevention
|
||||
#define KERNAUX_ARCH_X86_CR4_VMXE KERNAUX_BITS32(13) // VME (Virtual Machine Extensions) Enable
|
||||
#define KERNAUX_ARCH_X86_CR4_SMXE KERNAUX_BITS32(14) // SME (Safer Mode Extensions) Enable
|
||||
#define KERNAUX_ARCH_X86_CR4_FSGSBASE KERNAUX_BITS32(16) // FSGSBASE Enable (enable the instructions RDFSBASE, RDGSBASE, WRFSBASE, and WRGSBASE)
|
||||
#define KERNAUX_ARCH_X86_CR4_PCIDE KERNAUX_BITS32(17) // PCID Enable
|
||||
#define KERNAUX_ARCH_X86_CR4_OSXSAVE KERNAUX_BITS32(18) // XSAVE and Processor Extended States Enable
|
||||
#define KERNAUX_ARCH_X86_CR4_SMEP KERNAUX_BITS32(20) // SMEP (Supervisor Mode Execution Protection) Enable
|
||||
#define KERNAUX_ARCH_X86_CR4_SMAP KERNAUX_BITS32(21) // SMAP (Supervisor Mode Access Prevention) Enable
|
||||
#define KERNAUX_ARCH_X86_CR4_PKE KERNAUX_BITS32(22) // Protection Key Enable
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,33 @@ extern "C" {
|
|||
|
||||
#include <kernaux/arch/x86.h>
|
||||
|
||||
/**
|
||||
* @brief CR0 bits
|
||||
*
|
||||
* @details
|
||||
* Contains system control flags that control
|
||||
* operating mode and states of the processor.
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/Control_register#CR0
|
||||
* @see https://wiki.osdev.org/CPU_Registers_x86#CR0
|
||||
*/
|
||||
KERNAUX_ARCH_X86_DEFINE_CR0(X86_64, uint64_t);
|
||||
KERNAUX_STATIC_TEST_UNION_SIZE(KernAux_Arch_X86_64_CR0, 8);
|
||||
|
||||
/**
|
||||
* @brief CR4 bits
|
||||
*
|
||||
* @details
|
||||
* Contains a group of flags that enable several architectural extensions,
|
||||
* and indicate operating system or executive support for specific processor
|
||||
* capabilities.
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/Control_register#CR4
|
||||
* @see https://wiki.osdev.org/CPU_Registers_x86#CR4
|
||||
*/
|
||||
KERNAUX_ARCH_X86_DEFINE_CR4(X86_64, uint64_t);
|
||||
KERNAUX_STATIC_TEST_UNION_SIZE(KernAux_Arch_X86_64_CR4, 8);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -51,12 +51,19 @@ extern "C" {
|
|||
*********************/
|
||||
|
||||
#define KERNAUX_STATIC_TEST_STRUCT_SIZE(name, size) \
|
||||
__attribute__((unused)) \
|
||||
KERNAUX_UNUSED \
|
||||
static const int \
|
||||
_kernaux_static_test_struct_size_##name[ \
|
||||
sizeof(struct name) == (size) ? 1 : -1 \
|
||||
]
|
||||
|
||||
#define KERNAUX_STATIC_TEST_UNION_SIZE(name, size) \
|
||||
KERNAUX_UNUSED \
|
||||
static const int \
|
||||
_kernaux_static_test_union_size_##name[ \
|
||||
sizeof(union name) == (size) ? 1 : -1 \
|
||||
]
|
||||
|
||||
/*****************
|
||||
* Simple values *
|
||||
*****************/
|
||||
|
|
|
@ -58,10 +58,10 @@ enum KernAux_Multiboot2_Header_Arch {
|
|||
};
|
||||
|
||||
struct KernAux_Multiboot2_Header {
|
||||
unsigned magic : 32;
|
||||
uint32_t magic;
|
||||
enum KernAux_Multiboot2_Header_Arch arch : 32;
|
||||
unsigned total_size : 32;
|
||||
unsigned checksum : 32;
|
||||
uint32_t total_size;
|
||||
uint32_t checksum;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -83,8 +83,8 @@ enum KernAux_Multiboot2_HTag {
|
|||
|
||||
struct KernAux_Multiboot2_HTagBase {
|
||||
enum KernAux_Multiboot2_HTag type : 16;
|
||||
unsigned flags : 16;
|
||||
unsigned size : 32;
|
||||
uint16_t flags;
|
||||
uint32_t size;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -95,8 +95,8 @@ KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTagBase, 8);
|
|||
****************************/
|
||||
|
||||
struct KernAux_Multiboot2_Info {
|
||||
unsigned total_size : 32;
|
||||
unsigned reserved1 : 32;
|
||||
uint32_t total_size;
|
||||
uint32_t reserved1;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -129,7 +129,7 @@ enum KernAux_Multiboot2_ITag {
|
|||
|
||||
struct KernAux_Multiboot2_ITagBase {
|
||||
enum KernAux_Multiboot2_ITag type : 32;
|
||||
unsigned size : 32;
|
||||
uint32_t size;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -150,10 +150,10 @@ enum KernAux_Multiboot2_HTag_RelocatableHeader_Preference {
|
|||
********************************/
|
||||
|
||||
struct KernAux_Multiboot2_ITag_MemoryMap_EntryBase {
|
||||
unsigned long long base_addr : 64;
|
||||
unsigned long long length : 64;
|
||||
unsigned type : 32;
|
||||
unsigned reserved1 : 32;
|
||||
uint64_t base_addr;
|
||||
uint64_t length;
|
||||
uint32_t type;
|
||||
uint32_t reserved1;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -186,10 +186,10 @@ struct KernAux_Multiboot2_HTag_Addr {
|
|||
// size = 24
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
|
||||
unsigned header_addr : 32;
|
||||
unsigned load_addr : 32;
|
||||
unsigned load_end_addr : 32;
|
||||
unsigned bss_end_addr : 32;
|
||||
uint32_t header_addr;
|
||||
uint32_t load_addr;
|
||||
uint32_t load_end_addr;
|
||||
uint32_t bss_end_addr;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -200,7 +200,7 @@ struct KernAux_Multiboot2_HTag_EntryAddr {
|
|||
// size = 12
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
|
||||
unsigned entry_addr : 32;
|
||||
uint32_t entry_addr;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -211,7 +211,7 @@ struct KernAux_Multiboot2_HTag_Flags {
|
|||
// size = 12
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
|
||||
unsigned console_flags : 32;
|
||||
uint32_t console_flags;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -222,9 +222,9 @@ struct KernAux_Multiboot2_HTag_Framebuffer {
|
|||
// size = 20
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
|
||||
unsigned width : 32;
|
||||
unsigned height : 32;
|
||||
unsigned depth : 32;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t depth;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -253,7 +253,7 @@ struct KernAux_Multiboot2_HTag_EFII386EntryAddr {
|
|||
// size = 12
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
|
||||
unsigned entry_addr : 32;
|
||||
uint32_t entry_addr;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -264,7 +264,7 @@ struct KernAux_Multiboot2_HTag_EFIAmd64EntryAddr {
|
|||
// size = 12
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
|
||||
unsigned entry_addr : 32;
|
||||
uint32_t entry_addr;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -275,9 +275,9 @@ struct KernAux_Multiboot2_HTag_RelocatableHeader {
|
|||
// size = 24
|
||||
struct KernAux_Multiboot2_HTagBase base;
|
||||
|
||||
unsigned min_addr : 32;
|
||||
unsigned max_addr : 32;
|
||||
unsigned align : 32;
|
||||
uint32_t min_addr;
|
||||
uint32_t max_addr;
|
||||
uint32_t align;
|
||||
enum KernAux_Multiboot2_HTag_RelocatableHeader_Preference preferences : 32;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
@ -320,8 +320,8 @@ struct KernAux_Multiboot2_ITag_Module {
|
|||
// size > 16
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned mod_start : 32;
|
||||
unsigned mod_end : 32;
|
||||
uint32_t mod_start;
|
||||
uint32_t mod_end;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -332,8 +332,8 @@ struct KernAux_Multiboot2_ITag_BasicMemoryInfo {
|
|||
// size = 16
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned mem_lower : 32;
|
||||
unsigned mem_upper : 32;
|
||||
uint32_t mem_lower;
|
||||
uint32_t mem_upper;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -344,9 +344,9 @@ struct KernAux_Multiboot2_ITag_BIOSBootDevice {
|
|||
// size = 20
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned bios_dev : 32;
|
||||
unsigned partition : 32;
|
||||
unsigned sub_partition : 32;
|
||||
uint32_t bios_dev;
|
||||
uint32_t partition;
|
||||
uint32_t sub_partition;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -357,8 +357,8 @@ struct KernAux_Multiboot2_ITag_MemoryMap {
|
|||
// size > 16
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned entry_size : 32;
|
||||
unsigned entry_version : 32;
|
||||
uint32_t entry_size;
|
||||
uint32_t entry_version;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -369,12 +369,12 @@ struct KernAux_Multiboot2_ITag_VBEInfo {
|
|||
// size = 784
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned vbe_mode : 16;
|
||||
unsigned vbe_interface_seg : 16;
|
||||
unsigned vbe_interface_off : 16;
|
||||
unsigned vbe_interface_len : 16;
|
||||
unsigned char vbe_control_info[512];
|
||||
unsigned char vbe_mode_info[256];
|
||||
uint16_t vbe_mode;
|
||||
uint16_t vbe_interface_seg;
|
||||
uint16_t vbe_interface_off;
|
||||
uint16_t vbe_interface_len;
|
||||
uint8_t vbe_control_info[512];
|
||||
uint8_t vbe_mode_info[256];
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -385,13 +385,13 @@ struct KernAux_Multiboot2_ITag_FramebufferInfo {
|
|||
// size > 31
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned long long framebuffer_addr : 64;
|
||||
unsigned framebuffer_pitch : 32;
|
||||
unsigned framebuffer_width : 32;
|
||||
unsigned framebuffer_height : 32;
|
||||
unsigned framebuffer_bpp : 8;
|
||||
unsigned framebuffer_type : 8;
|
||||
unsigned reserved1 : 8;
|
||||
uint64_t framebuffer_addr;
|
||||
uint32_t framebuffer_pitch;
|
||||
uint32_t framebuffer_width;
|
||||
uint32_t framebuffer_height;
|
||||
uint8_t framebuffer_bpp;
|
||||
uint8_t framebuffer_type;
|
||||
uint8_t reserved1;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -402,10 +402,10 @@ struct KernAux_Multiboot2_ITag_ELFSymbols {
|
|||
// size > 16
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned num : 16;
|
||||
unsigned ent_size : 16;
|
||||
unsigned shndx : 16;
|
||||
unsigned reserved1 : 16;
|
||||
uint16_t num;
|
||||
uint16_t ent_size;
|
||||
uint16_t shndx;
|
||||
uint16_t reserved1;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -416,15 +416,15 @@ struct KernAux_Multiboot2_ITag_APMTable {
|
|||
// size = 28
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned version : 16;
|
||||
unsigned cseg : 16;
|
||||
unsigned offset : 32;
|
||||
unsigned cseg_16 : 16;
|
||||
unsigned dseg : 16;
|
||||
unsigned flags : 16;
|
||||
unsigned cseg_len : 16;
|
||||
unsigned cseg_16_len : 16;
|
||||
unsigned dseg_len : 16;
|
||||
uint16_t version;
|
||||
uint16_t cseg;
|
||||
uint32_t offset;
|
||||
uint16_t cseg_16;
|
||||
uint16_t dseg;
|
||||
uint16_t flags;
|
||||
uint16_t cseg_len;
|
||||
uint16_t cseg_16_len;
|
||||
uint16_t dseg_len;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -435,7 +435,7 @@ struct KernAux_Multiboot2_ITag_EFI32bitSystemTablePtr {
|
|||
// size = 12
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned pointer : 32;
|
||||
uint32_t pointer;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -446,7 +446,7 @@ struct KernAux_Multiboot2_ITag_EFI64bitSystemTablePtr {
|
|||
// size = 16
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned long long pointer : 64;
|
||||
uint64_t pointer;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -457,9 +457,9 @@ struct KernAux_Multiboot2_ITag_SMBIOSTables {
|
|||
// size > 16
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned major : 8;
|
||||
unsigned minor : 8;
|
||||
unsigned char reserved1[6];
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
uint8_t reserved1[6];
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -497,8 +497,8 @@ struct KernAux_Multiboot2_ITag_EFIMemoryMap {
|
|||
// size > 16
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned descriptor_size : 32;
|
||||
unsigned descriptor_version : 32;
|
||||
uint32_t descriptor_size;
|
||||
uint32_t descriptor_version;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -521,7 +521,7 @@ struct KernAux_Multiboot2_ITag_EFI32bitImageHandlePtr {
|
|||
// size = 12
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned pointer : 32;
|
||||
uint32_t pointer;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -535,7 +535,7 @@ struct KernAux_Multiboot2_ITag_EFI64bitImageHandlePtr {
|
|||
// size = 16
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned long long pointer : 64;
|
||||
uint64_t pointer;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
@ -549,7 +549,7 @@ struct KernAux_Multiboot2_ITag_ImageLoadBasePhysAddr {
|
|||
// size = 12
|
||||
struct KernAux_Multiboot2_ITagBase base;
|
||||
|
||||
unsigned load_base_addr : 32;
|
||||
uint32_t load_base_addr;
|
||||
}
|
||||
KERNAUX_PACKED;
|
||||
|
||||
|
|
Loading…
Reference in a new issue