3
Ranchonyx
233d

VESA is driving me crazy.

I'm trying to set my video mode via VESA functions which works, the QEMU window size changes, ton of more space.

Problem now however is that I have no idea where in the name of god the goddamn framebuffer starts.

Apparently it's address is located withing the mode info block which I have successfully queried and stored in ES:DI.

Problem now is getting this info block into my 32-bit kernel.

I tried smacking it on the stack which only produces hot garbage.

Essentially it goes like this

[...make sure pointer to block is stored within ES:DI...]

mov ebx, [ES:DI]

[Switch to 32 bit mode, ebx is not erased by doing so]

;Set up stack
mov ebp, 0x90000
mov esp, ebp

call kernel_main
jmp $

kernel_main takes this pointer as an argument, hence why I've pushed it onto stack:
main(uint32_t *ptr);

When I try accessing it however by doing the following:
vbe_mode_info_block* info_block = (vbe_mode_info_block)ptr;

And then try accessing the in the member 'framebuffer' using 'info_block->framebuffer' it's giving me hot garbage.

I'm probably doing something obvious wrong.
Frustrating.
I'm gonna try passing ES and DI seperately and converting them to a real mode address by doing addr = (ES*0x10)+DI;

MAYBE MAYBE MAYBE

Comments
  • 2
    Maybe extract the info you need *before* jumping to kernel main? You may not be able to access it after the jump.
  • 0
    @RememberMe Oh yeah fun fact.
    I did this, fucked it up again and then fixed it and like 20ish days ago it worked.
Add Comment