How to map vbe buffer

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.
Askodem
Posts: 12
Joined: Thu Aug 11, 2016 8:31 am

Re: How to map vbe buffer

Post by Askodem »

@sleephacker, Does this code work correctly?
User avatar
sleephacker
Member
Member
Posts: 97
Joined: Thu Aug 06, 2015 6:41 am
Location: Netherlands

Re: How to map vbe buffer

Post by sleephacker »

The vbe page entries look a bit weird...
Also I just noticed that you used:

Code: Select all

uint32_t vbe_buff_size = vbe_height * vbe_width * (vbe_bpp / 8) * vbe_pitch;
to calculate the framebuffer size, but you should do it like this:

Code: Select all

uint32_t vbe_buff_size = vbe_height * vbe_pitch;
because vbe_pitch is a replacement for width * bbp / 8.
Askodem
Posts: 12
Joined: Thu Aug 11, 2016 8:31 am

Re: How to map vbe buffer

Post by Askodem »

sleephacker wrote:The vbe page entries look a bit weird...
Also I just noticed that you used:

Code: Select all

uint32_t vbe_buff_size = vbe_height * vbe_width * (vbe_bpp / 8) * vbe_pitch;
to calculate the framebuffer size, but you should do it like this:

Code: Select all

uint32_t vbe_buff_size = vbe_height * vbe_pitch;
because vbe_pitch is a replacement for width * bbp / 8.
VBE works even without:

Code: Select all

for(uint32_t i = vbe_first_page; i < vbe_first_page + vbe_page_count; i++)
		page_table[0][i] = i * PAGE_SIZE | PAGE_PRESENT | PAGE_RW | PAGE_USER;
Post Reply