Page 2 of 2

Re: How to map vbe buffer

Posted: Sun Aug 14, 2016 11:41 pm
by Askodem
@sleephacker, Does this code work correctly?

Re: How to map vbe buffer

Posted: Mon Aug 15, 2016 5:42 am
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.

Re: How to map vbe buffer

Posted: Mon Aug 15, 2016 8:47 am
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;