Kernel: GeneralAllocator and FixedWidth allocator invalidate TLB caches
We were getting random exceptions when reallocating same addressess and this fixes that problem :)
This commit is contained in:
		
							parent
							
								
									25a2a4879c
								
							
						
					
					
						commit
						46c34db6cb
					
				|  | @ -196,6 +196,7 @@ namespace Kernel | |||
| 
 | ||||
| 		page_vaddr = m_page_table.get_free_page(); | ||||
| 		m_page_table.map_page_at(page_paddr, page_vaddr, PageTable::Flags::UserSupervisor | PageTable::Flags::ReadWrite | PageTable::Flags::Present); | ||||
| 		m_page_table.invalidate(page_vaddr); | ||||
| 	} | ||||
| 
 | ||||
| 	bool FixedWidthAllocator::allocate_page_if_needed(vaddr_t vaddr, uint8_t flags) | ||||
|  |  | |||
|  | @ -43,7 +43,11 @@ namespace Kernel | |||
| 
 | ||||
| 		allocation.address = m_page_table.get_free_contiguous_pages(needed_pages); | ||||
| 		for (size_t i = 0; i < needed_pages; i++) | ||||
| 			m_page_table.map_page_at(allocation.pages[i], allocation.address + i * PAGE_SIZE, PageTable::Flags::UserSupervisor | PageTable::Flags::ReadWrite | PageTable::Flags::Present); | ||||
| 		{ | ||||
| 			vaddr_t vaddr = allocation.address + i * PAGE_SIZE; | ||||
| 			m_page_table.map_page_at(allocation.pages[i], vaddr, PageTable::Flags::UserSupervisor | PageTable::Flags::ReadWrite | PageTable::Flags::Present); | ||||
| 			m_page_table.invalidate(vaddr); | ||||
| 		} | ||||
| 
 | ||||
| 		MUST(m_allocations.push_back(BAN::move(allocation))); | ||||
| 		return allocation.address; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue