mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:12:44 +00:00 
			
		
		
		
	UserspaceEmulator: Start executing in _start() instead of main()
This is one step closer to the real thing. :^)
This commit is contained in:
		
							parent
							
								
									066ae29c07
								
							
						
					
					
						commit
						3a73fdd244
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		|  | @ -48,15 +48,15 @@ int main(int argc, char** argv) | |||
| 
 | ||||
|     auto elf = ELF::Loader::create((const u8*)mapped_file.data(), mapped_file.size()); | ||||
| 
 | ||||
|     auto main_symbol = elf->find_demangled_function("main"); | ||||
|     if (!main_symbol.has_value()) { | ||||
|         warn() << "Could not find 'main' symbol in executable"; | ||||
|     auto _start_symbol = elf->find_demangled_function("_start"); | ||||
|     if (!_start_symbol.has_value()) { | ||||
|         warn() << "Could not find '_start' symbol in executable"; | ||||
|         return 1; | ||||
|     } | ||||
| 
 | ||||
|     auto main_code = main_symbol.value().raw_data(); | ||||
|     auto main_code = _start_symbol.value().raw_data(); | ||||
|     X86::SimpleInstructionStream stream((const u8*)main_code.characters_without_null_termination(), main_code.length()); | ||||
| 
 | ||||
|     UserspaceEmulator::Emulator emulator; | ||||
|     return emulator.exec(stream, main_symbol.value().value()); | ||||
|     return emulator.exec(stream, _start_symbol.value().value()); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling