Unverified Commit 3b0685a3 authored by PhoeniX's avatar PhoeniX

Multiboot VBE framebuffer support

parent 4b56b725
......@@ -12,8 +12,8 @@ _start:
.align 4
multiboot_header:
.long 0x1BADB002
.long 0x00010003
.long -(0x1BADB002+0x00010003)
.long 0x00010005
.long -(0x1BADB002+0x00010005)
.long multiboot_header
.long __text_start__
......@@ -21,6 +21,7 @@ multiboot_header:
.long __bss_end__ + 0x80000
.long multiboot_entry
.long 0, 800, 600, 8
multiboot_entry:
cli
......
......@@ -3,6 +3,7 @@
#include "kernlib.hpp"
#include "efi.hpp"
#include "multiboot_info.hpp"
#include "pagetable.hpp"
#include "font-8x16.hpp"
......@@ -203,6 +204,16 @@ void Display::setup() {
instance = new FramebufferDisplay(fb->base, fb->width, fb->height, pixelFormat);
return;
}
const struct Multiboot::Payload *mb = Multiboot::getPayload();
if (mb && (mb->flags & Multiboot::FLAG_VBETAB)) {
const Multiboot::VBEModeInfo *mode = reinterpret_cast<const Multiboot::VBEModeInfo*>(mb->vbe.pmode_info);
if (mode && mode->lfb_ptr) {
instance = new FramebufferDisplay(
reinterpret_cast<void*>(mode->lfb_ptr),
mode->h_res, mode->v_res, PixelFormatBGRX);
return;
}
}
// Fallback
instance = new ConsoleDisplay();
......
......@@ -348,6 +348,18 @@ void Pagetable::init() {
mmap += ent->size + sizeof(ent->size);
}
}
if (multiboot->flags & Multiboot::FLAG_VBETAB) {
if (multiboot->vbe.pcontrol_info < 0x80000)
multiboot->vbe.pcontrol_info += bss_end;
if (multiboot->vbe.pmode_info < 0x80000)
multiboot->vbe.pmode_info += bss_end;
Multiboot::VBEInfo *vbe = reinterpret_cast<Multiboot::VBEInfo*>(multiboot->vbe.pcontrol_info);
map(vbe); map(vbe+1);
const char *vendor = reinterpret_cast<const char*>(vbe->vendor_string);
map(vendor);
Multiboot::VBEModeInfo *mode = reinterpret_cast<Multiboot::VBEModeInfo*>(multiboot->vbe.pmode_info);
map(mode); map(mode + 1);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment