1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00
os-k/include/kernel/init/boot.h

128 lines
4.7 KiB
C

//----------------------------------------------------------------------------//
// OS on Kaleid //
// //
// Desc: Kaleid kernel base include file //
// //
// //
// Copyright © 2018-2021 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#ifndef _KERNEL_H
#include <kernel.h>
#endif
#ifndef MULTIBOOT_HEADER
#include <init/mboot.h>
#endif
#ifndef _INIT_BOOT_H
#define _INIT_BOOT_H
//----------------------------------------------------------------------------//
#define FB_EGA_TEXT 2
#define FB_INDEXED 0
#define FB_RGB 1
#define BINFO_SIZE 4096
struct BootInfo_t
{
// The Bootloader infos
struct {
void *modulesAddr; //mods_addr
void *kernelAddr;
void *codeSegment;
void *kernelEndAddr;
void *stackEndAddr; // stack begins 16B after kernelEndAddr
uint grubFlags; //flags
uint modulesCount; //mods_count
ushort valid;
char *grubName; //boot_loader_name
} btldr;
// Informations about drives
struct {
void *bufferAddr; //drives_addr
uint bootDrv; //boot_device
uint bufferLength; //drives_length
ushort drvValid;
ushort bufferValid;
} drives;
// Informations about memory
struct {
ushort memValid;
ushort mapValid;
//BIOS provided low and up memory
uint lowMemory; //mem_lower
uint upMemory; //mem_upper
//GRUB provided memory map
void *mapAddr; //mmap_addr
uint mapLength; //mmap_length
uint ramSize; //The ram (init by map.c)
} memory;
// Informations about the video drive
struct {
void *vbeControl; //vbe_control_info
void *vbeModeInfo; //vbe_mode_info
void *framebufferAddr; //framebuffer_addr
uint framebufferPitch; //framebuffer_pitch
uint framebufferWidth; //framebuffer_width
uint framebufferHeight; //framebuffer_height
ushort vbeValid;
ushort fbuValid;
ushort vbeMode; //vbe_mode
ushort vbeInterfaceSeg; //vbe_interface_seg
ushort vbeInterfaceOff; //vbe_interface_off
ushort vbeInterfaceLen; //vbe_interface_len
uchar framebufferBpp; //framebuffer_bpp
uchar framebufferType; //framebuffer_type
} video;
// Informations about the microcode firmware (BIOS/EFI)
struct {
uint apmTable; //apm_table
uint romTable; //config_table
ushort apmValid;
ushort romValid;
} firmware;
};
//----------------------------------------------------------------------------//
extern volatile BootInfo_t BtBootTab;
#define BtLoaderInfo (BtBootTab.btldr)
#define BtDrivesInfo (BtBootTab.drives)
#define BtMemoryInfo (BtBootTab.memory)
#define BtVideoInfo (BtBootTab.video)
#define BtFirmwareInfo (BtBootTab.firmware)
//----------------------------------------------------------------------------//
void BtDoSanityChecks(uint);
void BtInitBootInfo(multiboot_info_t *, void *);
//----------------------------------------------------------------------------//
#endif