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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
alberinfo
Member
Member
Posts: 122
Joined: Wed Aug 29, 2018 4:42 pm

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

Post 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!
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

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

Post by max »

alberinfo wrote:what can i do?
Tell us what you've tried so far and where you failed
alberinfo
Member
Member
Posts: 122
Joined: Wed Aug 29, 2018 4:42 pm

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

Post 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.
User avatar
bellezzasolo
Member
Member
Posts: 110
Joined: Sun Feb 20, 2011 2:01 pm

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

Post 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.
Whoever said you can't do OS development on Windows?
https://github.com/ChaiSoft/ChaiOS
alberinfo
Member
Member
Posts: 122
Joined: Wed Aug 29, 2018 4:42 pm

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

Post 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
Post Reply