mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:12:43 +00:00 
			
		
		
		
	Kernel: Detect APs and boot them into protected mode
This isn't fully working, the APs pretend like they're fully initialized and are just halted permanently for now.
This commit is contained in:
		
							parent
							
								
									93b9832fac
								
							
						
					
					
						commit
						0bc92c259d
					
				
					 9 changed files with 463 additions and 108 deletions
				
			
		|  | @ -121,6 +121,7 @@ extern "C" [[noreturn]] void init() | |||
|     for (ctor_func_t* ctor = &start_ctors; ctor < &end_ctors; ctor++) | ||||
|         (*ctor)(); | ||||
| 
 | ||||
|     APIC::initialize(); | ||||
|     InterruptManagement::initialize(); | ||||
|     ACPI::initialize(); | ||||
| 
 | ||||
|  | @ -161,6 +162,26 @@ extern "C" [[noreturn]] void init() | |||
|     ASSERT_NOT_REACHED(); | ||||
| } | ||||
| 
 | ||||
| //
 | ||||
| // This is where C++ execution begins for APs, after boot.S transfers control here.
 | ||||
| //
 | ||||
| // The purpose of init_ap() is to initialize APs for multi-tasking.
 | ||||
| //
 | ||||
| extern "C" [[noreturn]] void init_ap(u32 cpu) | ||||
| { | ||||
|     APIC::the().enable(cpu); | ||||
|      | ||||
| #if 0 | ||||
|     Scheduler::idle_loop(); | ||||
| #else | ||||
|     // FIXME: remove once schedule can handle APs
 | ||||
|     cli(); | ||||
|     for (;;) | ||||
|         asm volatile("hlt"); | ||||
| #endif | ||||
|     ASSERT_NOT_REACHED(); | ||||
| } | ||||
| 
 | ||||
| void init_stage2() | ||||
| { | ||||
|     SyncTask::spawn(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Tom
						Tom