Stuff
This commit is contained in:
parent
e5917a40e4
commit
5da56073ad
2
Makefile
2
Makefile
|
@ -217,7 +217,7 @@ $(LOBJDIR)/kaleid.x86_64: $(kal_kern_obj) $(kal_com_obj) $(LOBJDIR)/loader.o
|
|||
-o $(LOBJDIR)/kaleid.x86_64
|
||||
@echo ${CL2}[$@] ${CL}Success.${CL3}
|
||||
|
||||
$(LOBJDIR)/loader.o: $(LOADERDIR)/loader.asm
|
||||
$(LOBJDIR)/loader.o: $(LOADERDIR)/loader.asm $(LOADERDIR)/*/*.inc
|
||||
@echo ${CL2}[$@] ${NC}Making loader...${CL3}
|
||||
@$(ASM) $(ASMFLAGS) $(LOADERDIR)/loader.asm -o $(LOBJDIR)/loader.o > /dev/null
|
||||
@echo ${CL2}[$@] ${CL}Success.${CL3}
|
||||
|
|
11
ProjectTree
11
ProjectTree
|
@ -68,7 +68,16 @@
|
|||
│ │ ├── cpuid.o
|
||||
│ │ ├── cursor.o
|
||||
│ │ ├── heap.o
|
||||
│ │ ├── init
|
||||
│ │ │ ├── init.o
|
||||
│ │ │ └── table.o
|
||||
│ │ ├── init.o
|
||||
│ │ ├── io
|
||||
│ │ │ ├── cursor.o
|
||||
│ │ │ ├── term.o
|
||||
│ │ │ └── vga.o
|
||||
│ │ ├── ke
|
||||
│ │ │ └── panic.o
|
||||
│ │ ├── malloc.o
|
||||
│ │ ├── map.o
|
||||
│ │ ├── panic.o
|
||||
|
@ -159,4 +168,4 @@
|
|||
├── qemu.log
|
||||
└── Readme.md
|
||||
|
||||
28 directories, 106 files
|
||||
31 directories, 112 files
|
||||
|
|
Binary file not shown.
|
@ -32,6 +32,7 @@
|
|||
%include "boot/loader/mem/structures.inc"
|
||||
|
||||
global MB_start
|
||||
global MB_header
|
||||
extern StartKern
|
||||
|
||||
[BITS 32]
|
||||
|
|
|
@ -64,7 +64,7 @@ typedef enum TermColor_t TermColor_t;
|
|||
#define PANICSTR_SIZE 1024
|
||||
|
||||
//Get the BootInfo_t structure
|
||||
#define GetBootInfo() (bootTab)
|
||||
#define GetBootInfo(x) bootTab.x
|
||||
//------------------------------------------//
|
||||
|
||||
//
|
||||
|
@ -101,22 +101,23 @@ struct Processor_t
|
|||
#define FB_EGA_TEXT 2
|
||||
#define FB_INDEXED 0
|
||||
#define FB_RGB 1
|
||||
|
||||
#define BINFO_SIZE 4096
|
||||
struct BootInfo_t
|
||||
{
|
||||
// The Bootloader infos (GRUB in our case)
|
||||
struct {
|
||||
uint grubFlags; //flags
|
||||
uint modulesCount; //mods_count
|
||||
uint modulesAddr; //mods_addr
|
||||
void *modulesAddr; //mods_addr
|
||||
uint grubName; //boot_loader_name
|
||||
void *mbHeaderAddr;
|
||||
} btldr;
|
||||
|
||||
// Informations about drives
|
||||
struct {
|
||||
uint bootDrv; //boot_device
|
||||
uint bufferLength; //drives_length
|
||||
uint bufferAddr; //drives_addr
|
||||
void *bufferAddr; //drives_addr
|
||||
} drives;
|
||||
|
||||
// Informations about memory
|
||||
|
@ -127,7 +128,7 @@ struct BootInfo_t
|
|||
|
||||
//GRUB provided memory map
|
||||
uint mapLength; //mmap_length
|
||||
uint mapAddr; //mmap_addr
|
||||
void *mapAddr; //mmap_addr
|
||||
} memory;
|
||||
|
||||
// Informations about the video drive
|
||||
|
@ -138,7 +139,7 @@ struct BootInfo_t
|
|||
ushort vbeInterfaceSeg; //vbe_interface_seg
|
||||
ushort vbeInterfaceOff; //vbe_interface_off
|
||||
ushort vbeInterfaceLen; //vbe_interface_len
|
||||
ullong framebufferAddr; //framebuffer_addr
|
||||
void* framebufferAddr; //framebuffer_addr
|
||||
uint framebufferPitch; //framebuffer_pitch
|
||||
uint framebufferWidth; //framebuffer_width
|
||||
uint framebufferHeight; //framebuffer_height
|
||||
|
|
|
@ -33,19 +33,45 @@
|
|||
//
|
||||
void InitBootInfo(multiboot_info_t *mbi)
|
||||
{
|
||||
KalAssert(mbi);
|
||||
|
||||
extern uint MB_header;
|
||||
|
||||
//Retrieves the bootloader informations
|
||||
GetBootInfo().btldr.grubFlags = mbi->flags;
|
||||
GetBootInfo().btldr.grubName = mbi->boot_loader_name;
|
||||
GetBootInfo().btldr.modulesCount = mbi->mods_count;
|
||||
GetBootInfo().btldr.modulesAddr = mbi->mods_addr;
|
||||
DebugLog("[InitBootInfo] %s\n", GetBootInfo().btldr.grubName);
|
||||
GetBootInfo(btldr).grubFlags = mbi->flags;
|
||||
GetBootInfo(btldr).grubName = (mbi->boot_loader_name);
|
||||
GetBootInfo(btldr).modulesCount = mbi->mods_count;
|
||||
GetBootInfo(btldr).modulesAddr = (void*)(ullong)mbi->mods_addr;
|
||||
GetBootInfo(btldr).mbHeaderAddr = (void*)(ullong)&MB_header;
|
||||
DebugLog("\n[InitBootInfo] %s\n", GetBootInfo(btldr).grubName);
|
||||
DebugLog("[InitBootInfo] Header address : %p, modules address : %p\n",
|
||||
GetBootInfo(btldr).mbHeaderAddr, GetBootInfo(btldr).modulesAddr);
|
||||
DebugLog("[InitBootInfo] GRUB flags : %x\n", GetBootInfo(btldr).grubFlags);
|
||||
|
||||
//Retrieves the drives informations
|
||||
GetBootInfo().drives.bootDrv = mbi->boot_device;
|
||||
GetBootInfo().drives.bufferLength = mbi->drives_length;
|
||||
GetBootInfo().drives.bufferAddr = mbi->drives_addr;
|
||||
GetBootInfo(drives).bootDrv = mbi->boot_device;
|
||||
GetBootInfo(drives).bufferLength = mbi->drives_length;
|
||||
GetBootInfo(drives).bufferAddr = (void*)(ullong)mbi->drives_addr;
|
||||
DebugLog("[InitBootInfo] Root drive : %x\n",
|
||||
GetBootInfo().drives.bootDrv);
|
||||
GetBootInfo(drives).bootDrv);
|
||||
|
||||
//Retrieves the memory informations
|
||||
GetBootInfo(memory).lowMemory = mbi->mem_lower;
|
||||
GetBootInfo(memory).upMemory = mbi->mem_upper;
|
||||
GetBootInfo(memory).mapAddr = (void*)(ullong)mbi->mmap_addr;
|
||||
GetBootInfo(memory).mapLength = mbi->mmap_length;
|
||||
DebugLog("[InitBootInfo] Low memory : %d Kio, Up memory : %d Mio\n",
|
||||
GetBootInfo(memory).lowMemory, GetBootInfo(memory).upMemory / (MB/KB));
|
||||
DebugLog("[InitBootInfo] Memory map address : %p, length : %d\n",
|
||||
GetBootInfo(memory).mapAddr, GetBootInfo(memory).mapLength);
|
||||
|
||||
// XXX assign video infos, but unused at this time
|
||||
|
||||
// Retrieves the firmware infos
|
||||
GetBootInfo(firmware).apmTable = mbi->apm_table;
|
||||
GetBootInfo(firmware).romTable = mbi->config_table;
|
||||
DebugLog("[InitBootInfo] APM Table : %p, ROM Table : %p\n",
|
||||
GetBootInfo(firmware).apmTable, GetBootInfo(firmware).romTable);
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,6 +97,6 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic)
|
|||
InitMemoryMap();
|
||||
|
||||
// We're out
|
||||
KernLog("\n[Init] Evil never dies");
|
||||
KernLog("\n[Init] Evil never dies !");
|
||||
CrashSystem(); //yay
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue