Squash commits for public release

This commit is contained in:
2025-02-12 09:54:05 -05:00
commit 7118adc514
1108 changed files with 80873 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#ifndef _BOOT_LIBBOOT_ABI_DRIVERS_H
#define _BOOT_LIBBOOT_ABI_DRIVERS_H
#include <libboot/types.h>
#define MASKDEFINE(N, P, S) \
N##_POS = (P), \
N##_SIZE = (S), \
N##_MASK = ((~(~0 << (S))) << (P))
#define TOKEN_PASTE_IMPL(x, y) x##y
#define TOKEN_PASTE(x, y) TOKEN_PASTE_IMPL(x, y)
#define SKIP(x, y) char TOKEN_PASTE(prefix, __LINE__)[y - x - 8]
struct drive_desc {
void* init;
void* read;
void* write;
};
typedef struct drive_desc drive_desc_t;
struct fs_desc {
int (*get_inode)(drive_desc_t* drive_desc, const char* path, void* file_inode);
int (*read)(drive_desc_t* drive_desc, const char* path, uint8_t* buf, uint32_t from, uint32_t len);
int (*read_from_inode)(drive_desc_t* drive_desc, void* file_inode, uint8_t* buf, uint32_t from, uint32_t len);
};
typedef struct fs_desc fs_desc_t;
#endif // _BOOT_LIBBOOT_ABI_DRIVERS_H

11
boot/libboot/abi/kernel.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef _BOOT_LIBBOOT_ABI_KERNEL_H
#define _BOOT_LIBBOOT_ABI_KERNEL_H
#include <libboot/types.h>
// Bootloaders and Kernel are tight together and share ABI in order
// to run kernel, see docs/boot.md for more information.
static size_t shadow_area_size() { return 4 << 20; }
#endif // _BOOT_LIBBOOT_ABI_KERNEL_H

45
boot/libboot/abi/memory.h Normal file
View File

@@ -0,0 +1,45 @@
#ifndef _BOOT_LIBBOOT_ABI_MEMORY_H
#define _BOOT_LIBBOOT_ABI_MEMORY_H
#include <libboot/types.h>
enum MEMORY_LAYOUT_FLAGS {
MEMORY_LAYOUT_FLAG_TERMINATE = (1 << 0),
};
struct memory_layout {
uint64_t base;
uint64_t size;
uint32_t flags;
};
typedef struct memory_layout memory_layout_t;
struct memory_boot_desc {
uint64_t ram_base;
uint64_t ram_size;
memory_layout_t* reserved_areas;
};
typedef struct memory_boot_desc memory_boot_desc_t;
struct fb_boot_desc {
uintptr_t vaddr;
uintptr_t paddr;
size_t width;
size_t height;
size_t pixels_per_row;
};
typedef struct fb_boot_desc fb_boot_desc_t;
struct boot_args {
size_t paddr;
size_t vaddr;
size_t kernel_data_size;
memory_boot_desc_t mem_boot_desc;
fb_boot_desc_t fb_boot_desc;
void* devtree;
char cmd_args[32];
char init_process[32];
};
typedef struct boot_args boot_args_t;
#endif // _BOOT_LIBBOOT_ABI_MEMORY_H

View File

@@ -0,0 +1,110 @@
#ifndef _BOOT_LIBBOOT_ABI_MULTIBOOT_H
#define _BOOT_LIBBOOT_ABI_MULTIBOOT_H
#include <libboot/types.h>
#define MULTIBOOT_INFO_MEMORY (0x1)
#define MULTIBOOT_INFO_BOOTDEV (0x2)
#define MULTIBOOT_INFO_CMDLINE (0x4)
#define MULTIBOOT_INFO_MODS (0x8)
#define MULTIBOOT_INFO_AOUT_SYMS (0x10)
#define MULTIBOOT_INFO_ELF_SHDR (0x20)
#define MULTIBOOT_INFO_MEM_MAP (0x40)
#define MULTIBOOT_INFO_DRIVE_INFO (0x80)
#define MULTIBOOT_INFO_CONFIG_TABLE (0x100)
#define MULTIBOOT_INFO_BOOT_LOADER_NAME (0x200)
#define MULTIBOOT_INFO_APM_TABLE (0x400)
#define MULTIBOOT_INFO_VBE_INFO (0x800)
#define MULTIBOOT_INFO_FRAMEBUFFER_INFO (0x1000)
struct multiboot_module_entry {
uint32_t start;
uint32_t end;
uint32_t string_addr;
uint32_t reserved;
};
typedef struct multiboot_module_entry multiboot_module_entry_t;
struct multiboot_aout_symbol_table {
uint32_t tabsize;
uint32_t strsize;
uint32_t addr;
uint32_t reserved;
};
typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
struct multiboot_elf_section_header_table {
uint32_t num;
uint32_t size;
uint32_t addr;
uint32_t shndx;
};
typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
#define MULTIBOOT_MEMORY_AVAILABLE 1
#define MULTIBOOT_MEMORY_RESERVED 2
#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
#define MULTIBOOT_MEMORY_NVS 4
#define MULTIBOOT_MEMORY_BADRAM 5
struct PACKED multiboot_mmap_entry {
uint32_t size;
uint64_t addr;
uint64_t len;
uint32_t type;
};
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
struct multiboot_info {
uint32_t flags;
uint32_t mem_lower;
uint32_t mem_upper;
uint32_t boot_device;
uint32_t cmdline;
uint32_t mods_count;
uint32_t mods_addr;
union {
multiboot_aout_symbol_table_t aout_sym;
multiboot_elf_section_header_table_t elf_sec;
} syms;
uint32_t mmap_length;
uint32_t mmap_addr;
uint32_t drives_length;
uint32_t drives_addr;
uint32_t config_table;
uint32_t boot_loader_name;
uint32_t apm_table;
uint32_t vbe_control_info;
uint32_t vbe_mode_info;
uint16_t vbe_mode;
uint16_t vbe_interface_seg;
uint16_t vbe_interface_off;
uint16_t vbe_interface_len;
uint64_t framebuffer_addr;
uint32_t framebuffer_pitch;
uint32_t framebuffer_width;
uint32_t framebuffer_height;
uint8_t framebuffer_bpp;
uint8_t framebuffer_type;
union {
struct
{
uint32_t framebuffer_palette_addr;
uint16_t framebuffer_palette_num_colors;
};
struct
{
uint8_t framebuffer_red_field_position;
uint8_t framebuffer_red_mask_size;
uint8_t framebuffer_green_field_position;
uint8_t framebuffer_green_mask_size;
uint8_t framebuffer_blue_field_position;
uint8_t framebuffer_blue_mask_size;
};
};
};
typedef struct multiboot_info multiboot_info_t;
#endif // _BOOT_LIBBOOT_ABI_MULTIBOOT_H

View File

@@ -0,0 +1,18 @@
#ifndef _BOOT_LIBBOOT_ABI_RAWIMAGE_H
#define _BOOT_LIBBOOT_ABI_RAWIMAGE_H
#include <libboot/types.h>
struct rawimage_header {
uint64_t kern_off;
uint64_t kern_size;
uint64_t devtree_off;
uint64_t devtree_size;
uint64_t ramdisk_off;
uint64_t ramdisk_size;
uint64_t rawimage_size;
uint64_t padding;
};
typedef struct rawimage_header rawimage_header_t;
#endif // _BOOT_LIBBOOT_ABI_RAWIMAGE_H