Here's how I get the information.
entry.asm, grub multiboot header
Code: Select all
header_magic equ 0x1BADB002
header_flags equ 7
align 4
mboot:
; This is the GRUB Multiboot header
dd header_magic
dd header_flags
dd -(header_magic + header_flags) ; header checksum
dd 0 ; unused
dd 0 ; unused
dd 0 ; unused
dd 0 ; unused
dd 0 ; unused
dd 0 ; graphics mode type, 0 = gfx, 1 = text
dd 800 ; width
dd 600 ; height
dd 8 ; depth, number of bits per pixel
mm.h, grub multiboot structure, obtained from pointer in initial ebx
Code: Select all
typedef struct
{
u32int flags; // 0
u32int mem_lower; // 4
u32int mem_upper; // 8
u32int boot_device; // 12
string cmdline; // 16
u32int mods_count; // 20
u32int *mods_addr; // 24
u32int syms[4]; // 28, 32, 36, 40
u32int mmap_length; // 44
mmap_field_t *mmap_addr; // 48
u32int drives_length; // 52
u32int *drives_addr; // 56
u32int config_table; // 60
string boot_loader_name; // 64
u32int apm_table;
u32int vbe_control_info;
u32int vbe_mode_info;
u32int vbe_mode;
u32int vbe_interface_seg;
u32int vbe_interface_off;
u32int vbe_interface_len;
} multiboot_structure_t;
video.h, grub's VBE mode info structure obtained from multiboot_structure_t->vbe_mode_info
Code: Select all
typedef struct
{
u16int ModeAttributes;
u8int WinAAttributes;
u8int WinBAttributes;
u16int WinGranularity;
u16int WinSize;
u16int WinASegment;
u16int WinBSegment;
void *WinFuncPtr;
u16int BytesPerScanLine;
u16int XRes;
u16int YRes;
u8int Xu8intSize;
u8int Yu8intSize;
u8int NumberOfPlanes;
u8int BitsPerPixel;
u8int NumberOfBanks;
u8int MemoryModel;
u8int BankSize;
u8int NumberOfImagePages;
u8int res1;
u8int RedMaskSize;
u8int RedFieldPosition;
u8int GreenMaskSize;
u8int GreenFieldPosition;
u8int BlueMaskSize;
u8int BlueFieldPosition;
u8int RsvedMaskSize;
u8int RsvedFieldPosition;
//VBE 2.0
u32int *PhysBasePtr;
u32int OffScreenMemOffset;
u16int OffScreenMemSize;
//VBE 2.1
u16int LinbytesPerScanLine;
u8int BankNumberOfImagePages;
u8int LinNumberOfImagePages;
u8int LinRedMaskSize;
u8int LinRedFieldPosition;
u8int LingreenMaskSize;
u8int LinGreenFieldPosition;
u8int LinBlueMaskSize;
u8int LinBlueFieldPosition;
u8int LinRsvdMaskSize;
u8int LinRsvdFieldPosition;
u8int res2[194];
} vbeModeInfo_t;
video.c, printing out all the values
Code: Select all
void video_install(multiboot_structure_t *multiboot)
{
// assert the presence of vbe info
assert(multiboot->flags & bit(11));
vbeModeInfo_t *vbeModeInfo = (vbeModeInfo_t*)multiboot->vbe_mode_info;
print_serial("ModeAttributes: %x\n", vbeModeInfo->ModeAttributes);
print_serial("WinAAttributes: %x\n", vbeModeInfo->WinAAttributes);
print_serial("WinBAttributes: %x\n", vbeModeInfo->WinBAttributes);
print_serial("WinGranularity: %x\n", vbeModeInfo->WinGranularity);
print_serial("WinSize: %x\n", vbeModeInfo->WinSize);
print_serial("WinASegment: %x\n", vbeModeInfo->WinASegment);
print_serial("WinBSegment: %x\n", vbeModeInfo->WinBSegment);
print_serial("WinFuncPtr: %x\n", vbeModeInfo->WinFuncPtr);
print_serial("BytesPerScanLine: %x\n", vbeModeInfo->BytesPerScanLine);
print_serial("XRes: %x\n", vbeModeInfo->XRes);
print_serial("YRes: %x\n", vbeModeInfo->YRes);
print_serial("Xu8intSize: %x\n", vbeModeInfo->Xu8intSize);
print_serial("Yu8intSize: %x\n", vbeModeInfo->Yu8intSize);
print_serial("NumberOfPlanes: %x\n", vbeModeInfo->NumberOfPlanes);
print_serial("BitsPerPixel: %x\n", vbeModeInfo->BitsPerPixel);
print_serial("NumberOfBanks: %x\n", vbeModeInfo->NumberOfBanks);
print_serial("MemoryModel: %x\n", vbeModeInfo->MemoryModel);
print_serial("BankSize: %x\n", vbeModeInfo->BankSize);
print_serial("NumberOfImagePages: %x\n", vbeModeInfo->NumberOfImagePages);
print_serial("res1: %x\n", vbeModeInfo->res1);
print_serial("RedMaskSize: %x\n", vbeModeInfo->RedMaskSize);
print_serial("RedFieldPosition: %x\n", vbeModeInfo->RedFieldPosition);
print_serial("GreenMaskSize: %x\n", vbeModeInfo->GreenMaskSize);
print_serial("GreenFieldPosition: %x\n", vbeModeInfo->GreenFieldPosition);
print_serial("BlueMaskSize: %x\n", vbeModeInfo->BlueMaskSize);
print_serial("BlueFieldPosition: %x\n", vbeModeInfo->BlueFieldPosition);
print_serial("RsvedMaskSize: %x\n", vbeModeInfo->RsvedMaskSize);
print_serial("RsvedFieldPosition: %x\n", vbeModeInfo->RsvedFieldPosition);
print_serial("PhysBasePtr: %x\n", vbeModeInfo->PhysBasePtr);
print_serial("OffScreenMemOffset: %x\n", vbeModeInfo->OffScreenMemOffset);
print_serial("OffScreenMemSize: %x\n", vbeModeInfo->OffScreenMemSize);
}
Need anything else? I think this is all the relevent code. I know the multiboot_structure_t works because I successfully use its mmap_* fields in my memory manager.