Framebuffer problem
Framebuffer problem
I'm developing my own kernel using the Multiboot2 protocol. I request a 1280x720x32 framebuffer, then handle the tag in kernel_main to initialize the framebuffer. It works perfectly in QEMU (with OVMF) and Bochs, but when I test it on real hardware, the screen stays blank. My kernel: https://github.com/asfi43/upload1
My hardware setup: MSI H510M-B, Intel Core i3-10105F, NVIDIA GT 1030
My hardware setup: MSI H510M-B, Intel Core i3-10105F, NVIDIA GT 1030
-
- Member
- Posts: 5805
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Framebuffer problem
Is it possible the 64-bit framebuffer address doesn't fit in a 32-bit pointer?
Re: Framebuffer problem
W hich bootloader are you using? The specification says that this is a 64-bit address but the boot loader should set it to a value under 4GB.
Re: Framebuffer problem
Serial port output (or i/o) makes debugging display issues very much easier. Ethernet (with telnet) is good too, but serial is easier to drive.
Some machines have a debug port. It's even easier to drive than serial port, you just outb a byte to the port, but it's not universally available and the port number varies. One of the most common ports may conflict with ACPI. If your motherboard has a hex display or is very old (up to MCA or so), you have this. The older machines send it to a serial port, presumably at a fixed speed. Honestly, I'd go for the regular serial port, but I'll paste my notes if you want.
Some machines have a debug port. It's even easier to drive than serial port, you just outb a byte to the port, but it's not universally available and the port number varies. One of the most common ports may conflict with ACPI. If your motherboard has a hex display or is very old (up to MCA or so), you have this. The older machines send it to a serial port, presumably at a fixed speed. Honestly, I'd go for the regular serial port, but I'll paste my notes if you want.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Re: Framebuffer problem
I don't think the issue is with the pointer size because I'm emulating it in qemu-system-x86_64, which means it's also emulating a 64-bit system. That said, my kernel is linked as a 32-bit executable, and GRUB loads it in 32-bit mode, not 64-bit.
I'm using GRUB 2.12.
I can't access the serial port because I don't have a second machine and a serial adapter. I'd really like to see some logs if possible.
I'm using GRUB 2.12.
I can't access the serial port because I don't have a second machine and a serial adapter. I'd really like to see some logs if possible.
-
- Posts: 21
- Joined: Sat Sep 28, 2024 8:00 pm
- GitHub: https://github.com/ThatOSDeveloper
Re: Framebuffer problem
That means you are getting 100% correct multiboot2 implementation, as GRUB2 is the reference implementation for multiboot2.
Try it with qemu-system-i386 to see if it works, if it does, its a QEMU bug, if not, its your code that is doing something wrong.
Yes you can, its a thing in QEMU, pass the flag -serial stdio to log it to the terminal output, or you can just output it to a file, but -serial stdio is better than the file in my opinion because of how it does terminal formatting.
You know the drill what people put in here https://github.com/SlugOS/SlugOS
Re: Framebuffer problem
It does
Yeah, I know I can view the serial output in QEMU. What I meant is, I'd like to see the logs directly on my machine without using serial, since I don't have it set up.AnotherIdiot wrote: ↑Fri May 23, 2025 6:11 am Yes you can, its a thing in QEMU, pass the flag -serial stdio to log it to the terminal output, or you can just output it to a file, but -serial stdio is better than the file in my opinion because of how it does terminal formatting.
-
- Member
- Posts: 5805
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Framebuffer problem
The specification can say whatever it wants; the bootloader has no control over where the firmware chooses to place the framebuffer. (But the firmware might have a setting to place PCI MMIO below 4GB, which would include the framebuffer.)
That just means OVMF has chosen to place the framebuffer below 4GB. It still won't work on any PC where the firmware chooses to place the framebuffer above 4GB.
Re: Framebuffer problem
I fixed this issue by changing the UEFI mode from UEFI to CSM in the BIOS. So, from what I understand, this means my firmware was giving me a 64-bit pointer that couldn't be used because the kernel was in 32-bit mode. Does this mean I need to switch to 64-bit mode? Is there a way to do this by requesting it from GRUB instead of enabling long mode manually?
-
- Member
- Posts: 449
- Joined: Tue Apr 03, 2018 2:44 am
Re: Framebuffer problem
As far as I know, multi-boot and grub don't support native 64-bit mode.mishpro wrote: ↑Sat May 24, 2025 3:32 am I fixed this issue by changing the UEFI mode from UEFI to CSM in the BIOS. So, from what I understand, this means my firmware was giving me a 64-bit pointer that couldn't be used because the kernel was in 32-bit mode. Does this mean I need to switch to 64-bit mode? Is there a way to do this by requesting it from GRUB instead of enabling long mode manually?
But there are other bootloader options that do support loading and running a kernel directly into 64-bit mode, such as Limine or BOOTBOOT.
-
- Member
- Posts: 5805
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Framebuffer problem
No, you can access any 64-bit physical address using PAE paging in 32-bit mode.
No, GRUB can't move the framebuffer or enable paging or switch to 64-bit mode for you.
Re: Framebuffer problem
You may want PAE paging for some other peripherals too.Octocontrabass wrote: ↑Sat May 24, 2025 1:32 pmNo, you can access any 64-bit physical address using PAE paging in 32-bit mode.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie