VGA initialization
This commit is contained in:
parent
4c782da79e
commit
fd9f87ddd4
|
@ -107,7 +107,7 @@ struct BootInfo_t
|
||||||
uint modulesCount; //mods_count
|
uint modulesCount; //mods_count
|
||||||
void *modulesAddr; //mods_addr
|
void *modulesAddr; //mods_addr
|
||||||
char *grubName; //boot_loader_name
|
char *grubName; //boot_loader_name
|
||||||
void *mbHeaderAddr;
|
void *kernelAddr;
|
||||||
} btldr;
|
} btldr;
|
||||||
|
|
||||||
// Informations about drives
|
// Informations about drives
|
||||||
|
|
|
@ -32,9 +32,7 @@
|
||||||
//
|
//
|
||||||
void InitBootInfo(multiboot_info_t *mbi)
|
void InitBootInfo(multiboot_info_t *mbi)
|
||||||
{
|
{
|
||||||
extern uint MB_header;
|
extern void MB_header(void);
|
||||||
char *okStr = "available";
|
|
||||||
char *noStr = "unavailable";
|
|
||||||
|
|
||||||
// We need the multiboot structure
|
// We need the multiboot structure
|
||||||
KalAlwaysAssert(mbi);
|
KalAlwaysAssert(mbi);
|
||||||
|
@ -44,7 +42,7 @@ void InitBootInfo(multiboot_info_t *mbi)
|
||||||
|
|
||||||
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOT_LOADER_NAME) {
|
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOT_LOADER_NAME) {
|
||||||
GetBootInfo(btldr).grubName = (char*)(ullong)(mbi->boot_loader_name);
|
GetBootInfo(btldr).grubName = (char*)(ullong)(mbi->boot_loader_name);
|
||||||
GetBootInfo(btldr).mbHeaderAddr = (void*)(ullong)&MB_header;
|
GetBootInfo(btldr).kernelAddr = (void*)&MB_header;
|
||||||
GetBootInfo(btldr).valid = 1;
|
GetBootInfo(btldr).valid = 1;
|
||||||
}
|
}
|
||||||
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MODS) {
|
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MODS) {
|
||||||
|
@ -103,28 +101,6 @@ void InitBootInfo(multiboot_info_t *mbi)
|
||||||
GetBootInfo(firmware).apmTable = mbi->apm_table;
|
GetBootInfo(firmware).apmTable = mbi->apm_table;
|
||||||
GetBootInfo(firmware).apmValid = 1;
|
GetBootInfo(firmware).apmValid = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now we check (debug)
|
|
||||||
/*DebugLog("[InitBootInfo] Flags : %b\n\n",
|
|
||||||
GetBootInfo(btldr).grubFlags);*/
|
|
||||||
DebugLog("[InitBootInfo] Boot loader %s\n",
|
|
||||||
GetBootInfo(btldr).valid ? okStr : noStr);
|
|
||||||
DebugLog("[InitBootInfo] Boot drive %s\n",
|
|
||||||
GetBootInfo(drives).drvValid ? okStr : noStr);
|
|
||||||
DebugLog("[InitBootInfo] Disk buffer %s\n",
|
|
||||||
GetBootInfo(drives).bufferValid ? okStr : noStr);
|
|
||||||
DebugLog("[InitBootInfo] Basic mem %s\n",
|
|
||||||
GetBootInfo(memory).memValid ? okStr : noStr);
|
|
||||||
DebugLog("[InitBootInfo] Memory map %s\n",
|
|
||||||
GetBootInfo(memory).mapValid ? okStr : noStr);
|
|
||||||
DebugLog("[InitBootInfo] Video infos %s\n",
|
|
||||||
GetBootInfo(video).vbeValid ? okStr : noStr);
|
|
||||||
DebugLog("[InitBootInfo] Framebuffer %s\n",
|
|
||||||
GetBootInfo(video).fbuValid ? okStr : noStr);
|
|
||||||
DebugLog("[InitBootInfo] ROM table %s\n",
|
|
||||||
GetBootInfo(firmware).romValid ? okStr : noStr);
|
|
||||||
DebugLog("[InitBootInfo] APM table %s\n\n",
|
|
||||||
GetBootInfo(firmware).apmValid ? okStr : noStr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,6 +112,9 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic)
|
||||||
// We're not ready to deal with interrupts
|
// We're not ready to deal with interrupts
|
||||||
DisableIRQs();
|
DisableIRQs();
|
||||||
|
|
||||||
|
//Initialize the BootInfo_t structure
|
||||||
|
InitBootInfo(mbInfo);
|
||||||
|
|
||||||
// Kernel terminals
|
// Kernel terminals
|
||||||
InitTerms();
|
InitTerms();
|
||||||
|
|
||||||
|
@ -143,10 +122,10 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic)
|
||||||
KernLog("%c%c%c OS/K\n\n", 219, 219, 219);
|
KernLog("%c%c%c OS/K\n\n", 219, 219, 219);
|
||||||
|
|
||||||
KalAlwaysAssert(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC);
|
KalAlwaysAssert(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC);
|
||||||
KernLog("[Init] We have magic : %x\n\n", mbMagic);
|
KernLog("[Init] Kernel successfully loaded at %p with %x magic\n\n",
|
||||||
|
GetBootInfo(btldr).kernelAddr,
|
||||||
//Initialize the BootInfo_t structure
|
mbMagic
|
||||||
InitBootInfo(mbInfo);
|
);
|
||||||
|
|
||||||
//Memory mapping
|
//Memory mapping
|
||||||
error_t mapBad = InitMemoryMap();
|
error_t mapBad = InitMemoryMap();
|
||||||
|
@ -154,6 +133,6 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic)
|
||||||
StartPanic("[Init] The memory map failed to initialize. Error : %d", mapBad);
|
StartPanic("[Init] The memory map failed to initialize. Error : %d", mapBad);
|
||||||
|
|
||||||
// We're out
|
// We're out
|
||||||
KernLog("\n[Init] Evil never dies !");
|
KernLog("\n[Init] Evil never dies !\n");
|
||||||
CrashSystem(); //yay
|
CrashSystem(); //yay
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,9 @@ Terminal_t VGA_Terminal = {
|
||||||
.name = "VGA Output Terminal",
|
.name = "VGA Output Terminal",
|
||||||
.type = "VGA",
|
.type = "VGA",
|
||||||
|
|
||||||
.data = (void *)0xB8000,
|
.data = (void *)0,
|
||||||
.width = 80,
|
.width = 0,
|
||||||
.height = 25,
|
.height = 0,
|
||||||
.currentX = 0,
|
.currentX = 0,
|
||||||
.currentY = 0,
|
.currentY = 0,
|
||||||
|
|
||||||
|
@ -90,7 +90,6 @@ Terminal_t VGA_Terminal = {
|
||||||
.putchar = VGA_PutOnTermUnlocked,
|
.putchar = VGA_PutOnTermUnlocked,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize VGA output
|
// Initialize VGA output
|
||||||
//
|
//
|
||||||
|
@ -98,6 +97,11 @@ void VGA_Init(void)
|
||||||
{
|
{
|
||||||
KalAssert(VGA_Terminal.initDone != INITOK);
|
KalAssert(VGA_Terminal.initDone != INITOK);
|
||||||
|
|
||||||
|
//Use the infos provided in the BootInfo_t structure
|
||||||
|
VGA_Terminal.data = GetBootInfo(video).framebufferAddr;
|
||||||
|
VGA_Terminal.width = GetBootInfo(video).framebufferWidth;
|
||||||
|
VGA_Terminal.height = GetBootInfo(video).framebufferHeight;
|
||||||
|
|
||||||
VGA_Terminal.initDone = INITOK;
|
VGA_Terminal.initDone = INITOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue