Skip to content

Commit

Permalink
eir: support booting with framebuffers at over 4 GiB
Browse files Browse the repository at this point in the history
This is needed when booting with a passed-through Intel GPU. This commit
changes the behavior to not fail boot in this case, but instead to not
use the framebuffer in eir, but to map it for thor. This means that in
such cases, eir will only output over serial.
  • Loading branch information
no92 committed Oct 22, 2023
1 parent af87cb7 commit 9db754d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/eir/arch/x86/multiboot2/multiboot2.cpp
Expand Up @@ -175,8 +175,9 @@ extern "C" void eirMultiboot2Main(uint32_t info, uint32_t magic){
case kMb2TagFramebuffer: {
auto *framebuffer_tag = reinterpret_cast<Mb2TagFramebuffer*>(tag);
if(framebuffer_tag->address + framebuffer_tag->width * framebuffer_tag->pitch >= UINTPTR_MAX) {
eir::panicLogger() << "eir: Framebuffer outside of addressable memory!"
eir::infoLogger() << "eir: Framebuffer outside of addressable memory!"
<< frg::endlog;
framebuffer = framebuffer_tag;
}else if(framebuffer_tag->bpp != 32) {
eir::panicLogger() << "eir: Framebuffer does not use 32 bpp!"
<< frg::endlog;
Expand Down Expand Up @@ -336,7 +337,7 @@ extern "C" void eirMultiboot2Main(uint32_t info, uint32_t magic){
framebuf->fbType = framebuffer->type;

// Map the framebuffer.
assert(framebuffer->address & ~(pageSize - 1));
assert(framebuffer->address & ~static_cast<EirPtr>(pageSize - 1));
for(address_t pg = 0; pg < framebuffer->pitch * framebuffer->height; pg += 0x1000)
mapSingle4kPage(0xFFFF'FE00'4000'0000 + pg, framebuffer->address + pg,
PageFlags::write, CachingMode::writeCombine);
Expand Down

0 comments on commit 9db754d

Please sign in to comment.