mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 05:52:46 +00:00 
			
		
		
		
	UserspaceEmulator: Make sure the (crappy) VM allocator is page-aligned
We don't want the next_address pointer losing its alignment somehow. This whole thing should be replaced at some point, since UE hosted programs won't be able to run forever with this allocation strategy.
This commit is contained in:
		
							parent
							
								
									df9fe8fa7b
								
							
						
					
					
						commit
						a4a389156d
					
				
					 1 changed files with 5 additions and 7 deletions
				
			
		|  | @ -857,14 +857,12 @@ FlatPtr Emulator::allocate_vm(size_t size, size_t alignment) | |||
| 
 | ||||
|     FlatPtr final_address; | ||||
| 
 | ||||
|     if (alignment) { | ||||
|         // FIXME: What if alignment is not a power of 2?
 | ||||
|         final_address = round_up_to_power_of_two(next_address, alignment); | ||||
|     } else { | ||||
|         final_address = next_address; | ||||
|     } | ||||
|     if (!alignment) | ||||
|         alignment = PAGE_SIZE; | ||||
| 
 | ||||
|     next_address = final_address + size; | ||||
|     // FIXME: What if alignment is not a power of 2?
 | ||||
|     final_address = round_up_to_power_of_two(next_address, alignment); | ||||
|     next_address = round_up_to_power_of_two(final_address + size, PAGE_SIZE); | ||||
|     return final_address; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling