mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:52:45 +00:00 
			
		
		
		
	Kernel: Fix memory mapping size of the BootFramebufferConsole
The Multiboot header stores the framebuffer's pitch in bytes, so multiplying it by the pixel's size is not necessary. We ended up allocating 4 times as much memory as needed, which caused us to overlap the MMIO reserved memory area on the Raspberry Pi.
This commit is contained in:
		
							parent
							
								
									3d383974cd
								
							
						
					
					
						commit
						96f89d14a3
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -14,12 +14,12 @@ BootFramebufferConsole::BootFramebufferConsole(PhysicalAddress framebuffer_addr, | |||
|     : GenericFramebufferConsoleImpl(width, height, pitch) | ||||
| { | ||||
|     // NOTE: We're very early in the boot process, memory allocations shouldn't really fail
 | ||||
|     auto framebuffer_end = Memory::page_round_up(framebuffer_addr.offset(height * pitch * sizeof(u32)).get()).release_value(); | ||||
|     auto framebuffer_end = Memory::page_round_up(framebuffer_addr.offset(height * pitch).get()).release_value(); | ||||
|     m_framebuffer = MM.allocate_kernel_region(framebuffer_addr.page_base(), framebuffer_end - framebuffer_addr.page_base().get(), "Boot Framebuffer"sv, Memory::Region::Access::ReadWrite).release_value(); | ||||
| 
 | ||||
|     [[maybe_unused]] auto result = m_framebuffer->set_write_combine(true); | ||||
|     m_framebuffer_data = m_framebuffer->vaddr().offset(framebuffer_addr.offset_in_page()).as_ptr(); | ||||
|     memset(m_framebuffer_data, 0, height * pitch * sizeof(u32)); | ||||
|     memset(m_framebuffer_data, 0, height * pitch); | ||||
| } | ||||
| 
 | ||||
| void BootFramebufferConsole::clear(size_t x, size_t y, size_t length) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Daniel Bertalan
						Daniel Bertalan