VESA: requesting framebuffer with GRUB
Posted: Tue Feb 14, 2023 11:19 am
Hi everyone, I am a newbie with os dev programming. I was wondering a question about VESA mode. So let's say I have developed my own osdev experiment that has: gdt, and idt implemented, physical memory management, paging enabled, interrupts working and keyboard working. I'd like to move on, playing with a GRUB framebuffer address.
I read the wiki page about drawing in protected mode, and at the moment I """"""""implemented""""""""""" a really stupid way to get the VESA framebuffer address. In the file that manages the starting of the system (boot.S), I managed to request a framebuffer via multiboot structure (I do not know how, but GRUB understands if I ask mode 1024x768, 32bit depth).
I actually get a pointer (address: 0) and I can write on it and display some pixels. However as soon as I enable physical memory manager (or probably gdt), the framebuffer address is useless. I guess the space allocated for the screen by GRUB is totally overwritten by physical memory manager..
What would your procedure be to request a framebuffer from GRUB and then actually use it, considering I have enabled physical memory managment?
and on the kernel:
I read the wiki page about drawing in protected mode, and at the moment I """"""""implemented""""""""""" a really stupid way to get the VESA framebuffer address. In the file that manages the starting of the system (boot.S), I managed to request a framebuffer via multiboot structure (I do not know how, but GRUB understands if I ask mode 1024x768, 32bit depth).
I actually get a pointer (address: 0) and I can write on it and display some pixels. However as soon as I enable physical memory manager (or probably gdt), the framebuffer address is useless. I guess the space allocated for the screen by GRUB is totally overwritten by physical memory manager..
What would your procedure be to request a framebuffer from GRUB and then actually use it, considering I have enabled physical memory managment?
Code: Select all
.set MAGIC, 0x1badb002
.set FLAGS, 7
.set CHECKSUM, -(MAGIC + FLAGS)
.set MODE_TYPE, 0
.set WIDTH, 1024 /* requested width */
.set HEIGHT, 768 /* requested height */
.set DEPTH, 32 /* requested bits per pixel BPP */
.set HEADER_ADDR, 0
.set LOAD_ADDR, 0
.set LOAD_END_ADDR, 0
.set BSS_END_ADDR, 0
.set ENTRY_ADDR, 0
Code: Select all
int kernel_main(struct multiboot *m){
// m-->framebuffer_address;
}