32bit boot using multiboot2

This commit is contained in:
Alex 2022-10-17 23:52:55 +03:00
parent 961d7d7270
commit 3df98c7c8e
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
5 changed files with 282 additions and 324 deletions

View File

@ -1,43 +1,43 @@
#include <types.h> #include <types.h>
EXTERNC __attribute__((no_stack_protector, section(".multiboot.text"))) void Multiboot2Initializator() #include <boot/protocols/multiboot2.h>
struct multiboot_info
{ {
for (int i = 0; i < 2000; i++) multiboot_uint32_t Size;
multiboot_uint32_t Reserved;
struct multiboot_tag *Tag;
};
EXTERNC __attribute__((no_stack_protector, section(".mb2bootcode.text"))) void Multiboot2Initializator(multiboot_info *Info, unsigned int Magic)
{
if (Info == NULL || Magic == NULL)
{ {
((unsigned int *)0xb8000)[i * 2] = ' '; if (Magic == NULL)
((unsigned int *)0xb8000)[i * 2 + 1] = 0;
}
((uint8_t *)0xb8000)[2 * (80) * (25) - 2] = 'W';
((uint8_t *)0xb8000)[2 * (80) * (25) - 1] = 6;
unsigned char *SMBIOSAddress = (unsigned char *)0xF0000;
while ((unsigned int)(unsigned long)SMBIOSAddress < 0x100000)
{
if (SMBIOSAddress[0] == '_' &&
SMBIOSAddress[1] == 'S' &&
SMBIOSAddress[2] == 'M' &&
SMBIOSAddress[3] == '_')
{ {
unsigned char Checksum = 0; ((unsigned char *)0xb8000)[2 * (80) * (25) - 4] = 'E';
int Length = SMBIOSAddress[5]; ((unsigned char *)0xb8000)[2 * (80) * (25) - 3] = 4;
for (int i = 0; i < Length; i++)
Checksum += SMBIOSAddress[i];
if (Checksum == 0)
break;
} }
SMBIOSAddress += 16; if (Info == NULL)
{
((unsigned char *)0xb8000)[2 * (80) * (25) - 2] = 'R';
((unsigned char *)0xb8000)[2 * (80) * (25) - 1] = 4;
}
while (1)
asmv("hlt");
} }
else if (Magic != MULTIBOOT2_BOOTLOADER_MAGIC)
if ((unsigned int)(unsigned long)SMBIOSAddress == 0x100000)
{ {
// No SMBIOS found ((unsigned char *)0xb8000)[2 * (80) * (25) - 2] = 'M';
((uint8_t *)0xb8000)[2 * (80) * (25) - 4] = 'S'; ((unsigned char *)0xb8000)[2 * (80) * (25) - 1] = 4;
((uint8_t *)0xb8000)[2 * (80) * (25) - 3] = 4;
while (1) while (1)
asmv("hlt"); asmv("hlt");
} }
((uint8_t *)0xb8000)[2 * (80) * (25) - 10] = 'Y'; /* TODO */
((uint8_t *)0xb8000)[2 * (80) * (25) - 9] = 2;
return; ((unsigned char *)0xb8000)[2 * (80) * (25) - 2] = 'Y';
((unsigned char *)0xb8000)[2 * (80) * (25) - 1] = 2;
while (1)
asmv("hlt");
} }

View File

@ -1,84 +1,33 @@
KERNEL_VIRTUAL_BASE EQU 0xE0000000 KERNEL_VIRTUAL_BASE EQU 0xE0000000
section .multiboot2.data section .multiboot2
align 8 align 8
HEADER_START: HEADER_START:
dd 0xE85250D6 dd 0xE85250D6
dd 0 dd 0
dd (HEADER_END - HEADER_START) dd (HEADER_END - HEADER_START)
dd -(0xE85250D6 + (HEADER_END - HEADER_START)) dd -(0xE85250D6 + 0 + (HEADER_END - HEADER_START))
align 8 align 8
MB2_TAG_START:
dw 0 dw 0
dw 0 dw 0
dd 8 dd MB2_TAG_END - MB2_TAG_START
MB2_TAG_END:
HEADER_END: HEADER_END:
section .bss
STACK_BOTTOM: resb 16384
STACK_TOP:
align 4096
BOOT_PAGE_DIR0: resb 4096
BOOT_PAGE_TBL0: resb 4096
BOOT_PAGE_TBL1: resb 4096
section .multiboot2.text
extern x32Entry
extern Multiboot2Initializator extern Multiboot2Initializator
extern _kernel_start
extern _kernel_end
global _start global _start
_start: _start:
mov word [0xb8000], 0x074C ; L
mov word [0xb8002], 0x076F ; o
mov word [0xb8004], 0x0761 ; a
mov word [0xb8006], 0x0764 ; d
mov word [0xb8008], 0x0769 ; i
mov word [0xb800a], 0x076E ; n
mov word [0xb800c], 0x0767 ; g
mov word [0xb800e], 0x072E ; .
mov word [0xb8010], 0x072E ; .
mov word [0xb8012], 0x072E ; .
mov esp, STACK_TOP - KERNEL_VIRTUAL_BASE
mov edi, BOOT_PAGE_TBL0 - KERNEL_VIRTUAL_BASE
mov esi, 0
mov ecx, 2048 - 301
.PagingLoop:
cmp esi, _kernel_start - KERNEL_VIRTUAL_BASE
jl .LoopInside
cmp esi, _kernel_end - KERNEL_VIRTUAL_BASE
jge .LoopEnd
mov eax, esi
or eax, 3
mov [edi], eax
.LoopInside:
add esi, 4096
add edi, 4
loop .PagingLoop
.LoopEnd:
call Multiboot2Initializator
push ebx
mov dword [BOOT_PAGE_DIR0 - KERNEL_VIRTUAL_BASE + (000 * 4)], (BOOT_PAGE_TBL0 - KERNEL_VIRTUAL_BASE + 3)
mov dword [BOOT_PAGE_DIR0 - KERNEL_VIRTUAL_BASE + (001 * 4)], (BOOT_PAGE_TBL1 - KERNEL_VIRTUAL_BASE + 3)
mov dword [BOOT_PAGE_DIR0 - KERNEL_VIRTUAL_BASE + (896 * 4)], (BOOT_PAGE_TBL0 - KERNEL_VIRTUAL_BASE + 3)
mov dword [BOOT_PAGE_DIR0 - KERNEL_VIRTUAL_BASE + (897 * 4)], (BOOT_PAGE_TBL1 - KERNEL_VIRTUAL_BASE + 3)
mov ecx, BOOT_PAGE_DIR0 - KERNEL_VIRTUAL_BASE
mov cr3, ecx
mov ecx, cr0
or ecx, 0x80010000
mov cr0, ecx
add esp, KERNEL_VIRTUAL_BASE
mov eax, CallKernelMain
jmp eax
section .text
CallKernelMain:
push ebx
call x32Entry
cli cli
.hang: mov esp, STACK_TOP
push eax
push ebx
call Multiboot2Initializator
.Hang:
hlt hlt
jmp .hang jmp .Hang
section .mb2bootcode.bss
STACK_BOTTOM: resb 16384
STACK_TOP:

View File

@ -3,24 +3,36 @@ OUTPUT_ARCH(i386)
ENTRY(_start) ENTRY(_start)
KERNEL_VIRTUAL_BASE = 0xE0000000; KERNEL_VIRTUAL_BASE = 0xC0000000;
SECTIONS SECTIONS
{ {
. = 0x00100000; . = 1M;
_kernel_start = . + KERNEL_VIRTUAL_BASE;
.multiboot.data : .boot :
{ {
*(.multiboot2.data) *(.multiboot2 .multiboot2.*)
} }
.multiboot.text : .mb2bootcode.text :
{ {
*(.multiboot2.text) *(.mb2bootcode.text)
} }
.mb2bootcode.data :
{
*(.mb2bootcode.data)
}
.mb2bootcode.bss :
{
*(.mb2bootcode.bss)
}
. += ALIGN(4096);
. += KERNEL_VIRTUAL_BASE; . += KERNEL_VIRTUAL_BASE;
_kernel_start = .;
.text ALIGN(4096) : AT(ADDR(.text) - KERNEL_VIRTUAL_BASE) .text ALIGN(4096) : AT(ADDR(.text) - KERNEL_VIRTUAL_BASE)
{ {
*(.text .text.*) *(.text .text.*)
@ -41,10 +53,8 @@ SECTIONS
.bss ALIGN (4096) : AT(ADDR(.bss) - KERNEL_VIRTUAL_BASE) .bss ALIGN (4096) : AT(ADDR(.bss) - KERNEL_VIRTUAL_BASE)
{ {
_sbss = .;
*(COMMON) *(COMMON)
*(.bss .bss.*) *(.bss .bss.*)
_ebss = .;
} }
_kernel_end = .; _kernel_end = .;

View File

@ -23,61 +23,61 @@
#define MULTIBOOT_HEADER 1 #define MULTIBOOT_HEADER 1
/* How many bytes from the start of the file we search for the header. */ /* How many bytes from the start of the file we search for the header. */
#define MULTIBOOT_SEARCH 32768 #define MULTIBOOT_SEARCH 32768
#define MULTIBOOT_HEADER_ALIGN 8 #define MULTIBOOT_HEADER_ALIGN 8
/* The magic field should contain this. */ /* The magic field should contain this. */
#define MULTIBOOT2_HEADER_MAGIC 0xe85250d6 #define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
/* This should be in %eax. */ /* This should be in %eax. */
#define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289 #define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
/* Alignment of multiboot modules. */ /* Alignment of multiboot modules. */
#define MULTIBOOT_MOD_ALIGN 0x00001000 #define MULTIBOOT_MOD_ALIGN 0x00001000
/* Alignment of the multiboot info structure. */ /* Alignment of the multiboot info structure. */
#define MULTIBOOT_INFO_ALIGN 0x00000008 #define MULTIBOOT_INFO_ALIGN 0x00000008
/* Flags set in the 'flags' member of the multiboot header. */ /* Flags set in the 'flags' member of the multiboot header. */
#define MULTIBOOT_TAG_ALIGN 8 #define MULTIBOOT_TAG_ALIGN 8
#define MULTIBOOT_TAG_TYPE_END 0 #define MULTIBOOT_TAG_TYPE_END 0
#define MULTIBOOT_TAG_TYPE_CMDLINE 1 #define MULTIBOOT_TAG_TYPE_CMDLINE 1
#define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2 #define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2
#define MULTIBOOT_TAG_TYPE_MODULE 3 #define MULTIBOOT_TAG_TYPE_MODULE 3
#define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4 #define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4
#define MULTIBOOT_TAG_TYPE_BOOTDEV 5 #define MULTIBOOT_TAG_TYPE_BOOTDEV 5
#define MULTIBOOT_TAG_TYPE_MMAP 6 #define MULTIBOOT_TAG_TYPE_MMAP 6
#define MULTIBOOT_TAG_TYPE_VBE 7 #define MULTIBOOT_TAG_TYPE_VBE 7
#define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8 #define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8
#define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9 #define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9
#define MULTIBOOT_TAG_TYPE_APM 10 #define MULTIBOOT_TAG_TYPE_APM 10
#define MULTIBOOT_TAG_TYPE_EFI32 11 #define MULTIBOOT_TAG_TYPE_EFI32 11
#define MULTIBOOT_TAG_TYPE_EFI64 12 #define MULTIBOOT_TAG_TYPE_EFI64 12
#define MULTIBOOT_TAG_TYPE_SMBIOS 13 #define MULTIBOOT_TAG_TYPE_SMBIOS 13
#define MULTIBOOT_TAG_TYPE_ACPI_OLD 14 #define MULTIBOOT_TAG_TYPE_ACPI_OLD 14
#define MULTIBOOT_TAG_TYPE_ACPI_NEW 15 #define MULTIBOOT_TAG_TYPE_ACPI_NEW 15
#define MULTIBOOT_TAG_TYPE_NETWORK 16 #define MULTIBOOT_TAG_TYPE_NETWORK 16
#define MULTIBOOT_TAG_TYPE_EFI_MMAP 17 #define MULTIBOOT_TAG_TYPE_EFI_MMAP 17
#define MULTIBOOT_TAG_TYPE_EFI_BS 18 #define MULTIBOOT_TAG_TYPE_EFI_BS 18
#define MULTIBOOT_TAG_TYPE_EFI32_IH 19 #define MULTIBOOT_TAG_TYPE_EFI32_IH 19
#define MULTIBOOT_TAG_TYPE_EFI64_IH 20 #define MULTIBOOT_TAG_TYPE_EFI64_IH 20
#define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR 21 #define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR 21
#define MULTIBOOT_HEADER_TAG_END 0 #define MULTIBOOT_HEADER_TAG_END 0
#define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1 #define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1
#define MULTIBOOT_HEADER_TAG_ADDRESS 2 #define MULTIBOOT_HEADER_TAG_ADDRESS 2
#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS 3 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS 3
#define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS 4 #define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS 4
#define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5 #define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5
#define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6 #define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6
#define MULTIBOOT_HEADER_TAG_EFI_BS 7 #define MULTIBOOT_HEADER_TAG_EFI_BS 7
#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32 8 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32 8
#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9
#define MULTIBOOT_HEADER_TAG_RELOCATABLE 10 #define MULTIBOOT_HEADER_TAG_RELOCATABLE 10
#define MULTIBOOT_ARCHITECTURE_I386 0 #define MULTIBOOT_ARCHITECTURE_I386 0
#define MULTIBOOT_ARCHITECTURE_MIPS32 4 #define MULTIBOOT_ARCHITECTURE_MIPS32 4
#define MULTIBOOT_HEADER_TAG_OPTIONAL 1 #define MULTIBOOT_HEADER_TAG_OPTIONAL 1
#define MULTIBOOT_LOAD_PREFERENCE_NONE 0 #define MULTIBOOT_LOAD_PREFERENCE_NONE 0
@ -89,327 +89,327 @@
#ifndef ASM_FILE #ifndef ASM_FILE
typedef unsigned char multiboot_uint8_t; typedef unsigned char multiboot_uint8_t;
typedef unsigned short multiboot_uint16_t; typedef unsigned short multiboot_uint16_t;
typedef unsigned int multiboot_uint32_t; typedef unsigned int multiboot_uint32_t;
typedef unsigned long long multiboot_uint64_t; typedef unsigned long long multiboot_uint64_t;
struct multiboot_header struct multiboot_header
{ {
/* Must be MULTIBOOT_MAGIC - see above. */ /* Must be MULTIBOOT_MAGIC - see above. */
multiboot_uint32_t magic; multiboot_uint32_t magic;
/* ISA */ /* ISA */
multiboot_uint32_t architecture; multiboot_uint32_t architecture;
/* Total header length. */ /* Total header length. */
multiboot_uint32_t header_length; multiboot_uint32_t header_length;
/* The above fields plus this one must equal 0 mod 2^32. */ /* The above fields plus this one must equal 0 mod 2^32. */
multiboot_uint32_t checksum; multiboot_uint32_t checksum;
}; };
struct multiboot_header_tag struct multiboot_header_tag
{ {
multiboot_uint16_t type; multiboot_uint16_t type;
multiboot_uint16_t flags; multiboot_uint16_t flags;
multiboot_uint32_t size; multiboot_uint32_t size;
}; };
struct multiboot_header_tag_information_request struct multiboot_header_tag_information_request
{ {
multiboot_uint16_t type; multiboot_uint16_t type;
multiboot_uint16_t flags; multiboot_uint16_t flags;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t requests[0]; multiboot_uint32_t requests[0];
}; };
struct multiboot_header_tag_address struct multiboot_header_tag_address
{ {
multiboot_uint16_t type; multiboot_uint16_t type;
multiboot_uint16_t flags; multiboot_uint16_t flags;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t header_addr; multiboot_uint32_t header_addr;
multiboot_uint32_t load_addr; multiboot_uint32_t load_addr;
multiboot_uint32_t load_end_addr; multiboot_uint32_t load_end_addr;
multiboot_uint32_t bss_end_addr; multiboot_uint32_t bss_end_addr;
}; };
struct multiboot_header_tag_entry_address struct multiboot_header_tag_entry_address
{ {
multiboot_uint16_t type; multiboot_uint16_t type;
multiboot_uint16_t flags; multiboot_uint16_t flags;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t entry_addr; multiboot_uint32_t entry_addr;
}; };
struct multiboot_header_tag_console_flags struct multiboot_header_tag_console_flags
{ {
multiboot_uint16_t type; multiboot_uint16_t type;
multiboot_uint16_t flags; multiboot_uint16_t flags;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t console_flags; multiboot_uint32_t console_flags;
}; };
struct multiboot_header_tag_framebuffer struct multiboot_header_tag_framebuffer
{ {
multiboot_uint16_t type; multiboot_uint16_t type;
multiboot_uint16_t flags; multiboot_uint16_t flags;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t width; multiboot_uint32_t width;
multiboot_uint32_t height; multiboot_uint32_t height;
multiboot_uint32_t depth; multiboot_uint32_t depth;
}; };
struct multiboot_header_tag_module_align struct multiboot_header_tag_module_align
{ {
multiboot_uint16_t type; multiboot_uint16_t type;
multiboot_uint16_t flags; multiboot_uint16_t flags;
multiboot_uint32_t size; multiboot_uint32_t size;
}; };
struct multiboot_header_tag_relocatable struct multiboot_header_tag_relocatable
{ {
multiboot_uint16_t type; multiboot_uint16_t type;
multiboot_uint16_t flags; multiboot_uint16_t flags;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t min_addr; multiboot_uint32_t min_addr;
multiboot_uint32_t max_addr; multiboot_uint32_t max_addr;
multiboot_uint32_t align; multiboot_uint32_t align;
multiboot_uint32_t preference; multiboot_uint32_t preference;
}; };
struct multiboot_color struct multiboot_color
{ {
multiboot_uint8_t red; multiboot_uint8_t red;
multiboot_uint8_t green; multiboot_uint8_t green;
multiboot_uint8_t blue; multiboot_uint8_t blue;
}; };
struct multiboot_mmap_entry struct multiboot_mmap_entry
{ {
multiboot_uint64_t addr; multiboot_uint64_t addr;
multiboot_uint64_t len; multiboot_uint64_t len;
#define MULTIBOOT_MEMORY_AVAILABLE 1 #define MULTIBOOT_MEMORY_AVAILABLE 1
#define MULTIBOOT_MEMORY_RESERVED 2 #define MULTIBOOT_MEMORY_RESERVED 2
#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3 #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
#define MULTIBOOT_MEMORY_NVS 4 #define MULTIBOOT_MEMORY_NVS 4
#define MULTIBOOT_MEMORY_BADRAM 5 #define MULTIBOOT_MEMORY_BADRAM 5
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t zero; multiboot_uint32_t zero;
}; };
typedef struct multiboot_mmap_entry multiboot_memory_map_t; typedef struct multiboot_mmap_entry multiboot_memory_map_t;
struct multiboot_tag struct multiboot_tag
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
}; };
struct multiboot_tag_string struct multiboot_tag_string
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
char string[0]; char string[0];
}; };
struct multiboot_tag_module struct multiboot_tag_module
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t mod_start; multiboot_uint32_t mod_start;
multiboot_uint32_t mod_end; multiboot_uint32_t mod_end;
char cmdline[0]; char cmdline[0];
}; };
struct multiboot_tag_basic_meminfo struct multiboot_tag_basic_meminfo
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t mem_lower; multiboot_uint32_t mem_lower;
multiboot_uint32_t mem_upper; multiboot_uint32_t mem_upper;
}; };
struct multiboot_tag_bootdev struct multiboot_tag_bootdev
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t biosdev; multiboot_uint32_t biosdev;
multiboot_uint32_t slice; multiboot_uint32_t slice;
multiboot_uint32_t part; multiboot_uint32_t part;
}; };
struct multiboot_tag_mmap struct multiboot_tag_mmap
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t entry_size; multiboot_uint32_t entry_size;
multiboot_uint32_t entry_version; multiboot_uint32_t entry_version;
struct multiboot_mmap_entry entries[0]; struct multiboot_mmap_entry entries[0];
}; };
struct multiboot_vbe_info_block struct multiboot_vbe_info_block
{ {
multiboot_uint8_t external_specification[512]; multiboot_uint8_t external_specification[512];
}; };
struct multiboot_vbe_mode_info_block struct multiboot_vbe_mode_info_block
{ {
multiboot_uint8_t external_specification[256]; multiboot_uint8_t external_specification[256];
}; };
struct multiboot_tag_vbe struct multiboot_tag_vbe
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint16_t vbe_mode; multiboot_uint16_t vbe_mode;
multiboot_uint16_t vbe_interface_seg; multiboot_uint16_t vbe_interface_seg;
multiboot_uint16_t vbe_interface_off; multiboot_uint16_t vbe_interface_off;
multiboot_uint16_t vbe_interface_len; multiboot_uint16_t vbe_interface_len;
struct multiboot_vbe_info_block vbe_control_info; struct multiboot_vbe_info_block vbe_control_info;
struct multiboot_vbe_mode_info_block vbe_mode_info; struct multiboot_vbe_mode_info_block vbe_mode_info;
}; };
struct multiboot_tag_framebuffer_common struct multiboot_tag_framebuffer_common
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint64_t framebuffer_addr; multiboot_uint64_t framebuffer_addr;
multiboot_uint32_t framebuffer_pitch; multiboot_uint32_t framebuffer_pitch;
multiboot_uint32_t framebuffer_width; multiboot_uint32_t framebuffer_width;
multiboot_uint32_t framebuffer_height; multiboot_uint32_t framebuffer_height;
multiboot_uint8_t framebuffer_bpp; multiboot_uint8_t framebuffer_bpp;
#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0 #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1 #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2 #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
multiboot_uint8_t framebuffer_type; multiboot_uint8_t framebuffer_type;
multiboot_uint16_t reserved; multiboot_uint16_t reserved;
}; };
struct multiboot_tag_framebuffer struct multiboot_tag_framebuffer
{ {
struct multiboot_tag_framebuffer_common common; struct multiboot_tag_framebuffer_common common;
union union
{
struct
{ {
multiboot_uint16_t framebuffer_palette_num_colors; struct
struct multiboot_color framebuffer_palette[0]; {
multiboot_uint16_t framebuffer_palette_num_colors;
struct multiboot_color framebuffer_palette[0];
};
struct
{
multiboot_uint8_t framebuffer_red_field_position;
multiboot_uint8_t framebuffer_red_mask_size;
multiboot_uint8_t framebuffer_green_field_position;
multiboot_uint8_t framebuffer_green_mask_size;
multiboot_uint8_t framebuffer_blue_field_position;
multiboot_uint8_t framebuffer_blue_mask_size;
};
}; };
struct
{
multiboot_uint8_t framebuffer_red_field_position;
multiboot_uint8_t framebuffer_red_mask_size;
multiboot_uint8_t framebuffer_green_field_position;
multiboot_uint8_t framebuffer_green_mask_size;
multiboot_uint8_t framebuffer_blue_field_position;
multiboot_uint8_t framebuffer_blue_mask_size;
};
};
}; };
struct multiboot_tag_elf_sections struct multiboot_tag_elf_sections
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t num; multiboot_uint32_t num;
multiboot_uint32_t entsize; multiboot_uint32_t entsize;
multiboot_uint32_t shndx; multiboot_uint32_t shndx;
char sections[0]; char sections[0];
}; };
struct multiboot_tag_apm struct multiboot_tag_apm
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint16_t version; multiboot_uint16_t version;
multiboot_uint16_t cseg; multiboot_uint16_t cseg;
multiboot_uint32_t offset; multiboot_uint32_t offset;
multiboot_uint16_t cseg_16; multiboot_uint16_t cseg_16;
multiboot_uint16_t dseg; multiboot_uint16_t dseg;
multiboot_uint16_t flags; multiboot_uint16_t flags;
multiboot_uint16_t cseg_len; multiboot_uint16_t cseg_len;
multiboot_uint16_t cseg_16_len; multiboot_uint16_t cseg_16_len;
multiboot_uint16_t dseg_len; multiboot_uint16_t dseg_len;
}; };
struct multiboot_tag_efi32 struct multiboot_tag_efi32
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t pointer; multiboot_uint32_t pointer;
}; };
struct multiboot_tag_efi64 struct multiboot_tag_efi64
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint64_t pointer; multiboot_uint64_t pointer;
}; };
struct multiboot_tag_smbios struct multiboot_tag_smbios
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint8_t major; multiboot_uint8_t major;
multiboot_uint8_t minor; multiboot_uint8_t minor;
multiboot_uint8_t reserved[6]; multiboot_uint8_t reserved[6];
multiboot_uint8_t tables[0]; multiboot_uint8_t tables[0];
}; };
struct multiboot_tag_old_acpi struct multiboot_tag_old_acpi
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint8_t rsdp[0]; multiboot_uint8_t rsdp[0];
}; };
struct multiboot_tag_new_acpi struct multiboot_tag_new_acpi
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint8_t rsdp[0]; multiboot_uint8_t rsdp[0];
}; };
struct multiboot_tag_network struct multiboot_tag_network
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint8_t dhcpack[0]; multiboot_uint8_t dhcpack[0];
}; };
struct multiboot_tag_efi_mmap struct multiboot_tag_efi_mmap
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t descr_size; multiboot_uint32_t descr_size;
multiboot_uint32_t descr_vers; multiboot_uint32_t descr_vers;
multiboot_uint8_t efi_mmap[0]; multiboot_uint8_t efi_mmap[0];
}; };
struct multiboot_tag_efi32_ih struct multiboot_tag_efi32_ih
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t pointer; multiboot_uint32_t pointer;
}; };
struct multiboot_tag_efi64_ih struct multiboot_tag_efi64_ih
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint64_t pointer; multiboot_uint64_t pointer;
}; };
struct multiboot_tag_load_base_addr struct multiboot_tag_load_base_addr
{ {
multiboot_uint32_t type; multiboot_uint32_t type;
multiboot_uint32_t size; multiboot_uint32_t size;
multiboot_uint32_t load_base_addr; multiboot_uint32_t load_base_addr;
}; };
#endif /* ! ASM_FILE */ #endif /* ! ASM_FILE */

View File

@ -1491,7 +1491,6 @@ namespace CPU
: "memory"); : "memory");
#endif #endif
} }
} }
} }