2018-03-06 12:18:53 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#define MULTIBOOT_MAGIC 0x1BADB002
|
|
|
|
#define MULTIBOOT_EAX_MAGIC 0x2BADB002
|
|
|
|
#define MULTIBOOT_FLAG_MEM 0x001
|
|
|
|
#define MULTIBOOT_FLAG_DEVICE 0x002
|
|
|
|
#define MULTIBOOT_FLAG_CMDLINE 0x004
|
|
|
|
#define MULTIBOOT_FLAG_MODS 0x008
|
|
|
|
#define MULTIBOOT_FLAG_AOUT 0x010
|
|
|
|
#define MULTIBOOT_FLAG_ELF 0x020
|
|
|
|
#define MULTIBOOT_FLAG_MMAP 0x040
|
2018-05-21 16:31:49 +03:00
|
|
|
#define MULTIBOOT_FLAG_DRIVE 0x080
|
|
|
|
#define MULTIBOOT_FLAG_CONFIG 0x100
|
|
|
|
#define MULTIBOOT_FLAG_LOADER 0x200
|
|
|
|
#define MULTIBOOT_FLAG_APM 0x400
|
|
|
|
#define MULTIBOOT_FLAG_VBE 0x800
|
2021-05-31 06:31:01 +03:00
|
|
|
#define MULTIBOOT_FLAG_FB 0x1000
|
2018-03-06 12:18:53 +03:00
|
|
|
|
|
|
|
struct multiboot
|
|
|
|
{
|
2018-07-11 10:09:19 +03:00
|
|
|
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;
|
|
|
|
uint32_t num;
|
|
|
|
uint32_t size;
|
|
|
|
uint32_t addr;
|
|
|
|
uint32_t shndx;
|
|
|
|
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;
|
2021-05-31 06:31:01 +03:00
|
|
|
uint16_t vbe_mode;
|
|
|
|
uint16_t vbe_interface_seg;
|
|
|
|
uint16_t vbe_interface_off;
|
|
|
|
uint16_t vbe_interface_len;
|
|
|
|
uint64_t framebuffer_addr;
|
2018-07-12 04:53:36 +03:00
|
|
|
uint32_t framebuffer_pitch;
|
|
|
|
uint32_t framebuffer_width;
|
|
|
|
uint32_t framebuffer_height;
|
2021-05-31 06:31:01 +03:00
|
|
|
uint8_t framebuffer_bpp;
|
|
|
|
uint8_t framebuffer_type;
|
2018-03-06 12:18:53 +03:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint16_t attributes;
|
|
|
|
uint8_t winA, winB;
|
|
|
|
uint16_t granularity;
|
|
|
|
uint16_t winsize;
|
|
|
|
uint16_t segmentA, segmentB;
|
|
|
|
uint32_t realFctPtr;
|
|
|
|
uint16_t pitch;
|
|
|
|
|
|
|
|
uint16_t Xres, Yres;
|
|
|
|
uint8_t Wchar, Ychar, planes, bpp, banks;
|
|
|
|
uint8_t memory_model, bank_size, image_pages;
|
|
|
|
uint8_t reserved0;
|
|
|
|
|
|
|
|
uint8_t red_mask, red_position;
|
|
|
|
uint8_t green_mask, green_position;
|
|
|
|
uint8_t blue_mask, blue_position;
|
|
|
|
uint8_t rsv_mask, rsv_position;
|
|
|
|
uint8_t directcolor_attributes;
|
|
|
|
|
|
|
|
uint32_t physbase;
|
|
|
|
uint32_t reserved1;
|
|
|
|
uint16_t reserved2;
|
|
|
|
} __attribute__ ((packed)) vbe_info_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2018-07-11 10:09:19 +03:00
|
|
|
uint32_t mod_start;
|
|
|
|
uint32_t mod_end;
|
|
|
|
uint32_t cmdline;
|
|
|
|
uint32_t reserved;
|
2018-03-06 12:18:53 +03:00
|
|
|
} __attribute__ ((packed)) mboot_mod_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint32_t size;
|
|
|
|
uint64_t base_addr;
|
|
|
|
uint64_t length;
|
|
|
|
uint32_t type;
|
|
|
|
} __attribute__ ((packed)) mboot_memmap_t;
|
|
|
|
|
|
|
|
extern struct multiboot *copy_multiboot(struct multiboot *mboot_ptr);
|
|
|
|
extern void dump_multiboot(struct multiboot *mboot_ptr);
|
|
|
|
extern char * ramdisk;
|
|
|
|
extern struct multiboot * mboot_ptr;
|
2021-06-14 05:11:37 +03:00
|
|
|
extern void boot(void);
|