Page 1 of 1

Don't know how to map a memory address with paging

Posted: Sat Mar 02, 2019 12:29 pm
by alberinfo
hi,
i've been trying to map the vbe lfb given by grub, so i can use it with paging enabled, but no matter what i do, the mapping doesnt work.what can i do?

Thanks!

Re: Don't know how to map a memory address with paging

Posted: Sat Mar 02, 2019 12:41 pm
by max
alberinfo wrote:what can i do?
Tell us what you've tried so far and where you failed

Re: Don't know how to map a memory address with paging

Posted: Sat Mar 02, 2019 12:47 pm
by alberinfo
first of all, the map you actually see in my code, which just plots pixels in random colors, and later it crashes and comes back to grub. i've tried to map the memory after paging is enabled, and then flush the tlb with invlpg instruction, it just shows the first area of the memory(probably the first 4kb) corrupt, and then some other things that the OS didn't even boot.

Re: Don't know how to map a memory address with paging

Posted: Wed Mar 06, 2019 4:27 am
by bellezzasolo
Based off https://github.com/alberinfo/Slidoor-OS ... y/paging.c
You're not updating the framebuffer address. All you're doing is mapping the first 4096 bytes of the LFB repeatedly. You increment it in id_map - but that's a local copy.
Secondly, you really should calculate the length, rather than just mapping 4MB. It shouldn't cause problems, but it's good form.
Finally, I suggest moving the LFB mapping code out of paging.c, it should really be in your video driver.

Re: Don't know how to map a memory address with paging

Posted: Wed Mar 06, 2019 12:47 pm
by alberinfo
i think i didn't understand. what do you mean by updating the framebuffer addr?
PD: i after i map, when i enable paging, it will crash and come back to grub, even if i just do 1 map, or 1024 times in a for loop #-o