mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:02:45 +00:00 
			
		
		
		
	Kernel: Simplify the Interrupt management initialization
This commit is contained in:
		
							parent
							
								
									caa7a6c2fb
								
							
						
					
					
						commit
						8139688ef1
					
				
					 2 changed files with 7 additions and 24 deletions
				
			
		|  | @ -28,6 +28,7 @@ | ||||||
| #include <AK/StringView.h> | #include <AK/StringView.h> | ||||||
| #include <Kernel/ACPI/MultiProcessorParser.h> | #include <Kernel/ACPI/MultiProcessorParser.h> | ||||||
| #include <Kernel/Arch/i386/CPU.h> | #include <Kernel/Arch/i386/CPU.h> | ||||||
|  | #include <Kernel/CommandLine.h> | ||||||
| #include <Kernel/Interrupts/APIC.h> | #include <Kernel/Interrupts/APIC.h> | ||||||
| #include <Kernel/Interrupts/IOAPIC.h> | #include <Kernel/Interrupts/IOAPIC.h> | ||||||
| #include <Kernel/Interrupts/InterruptManagement.h> | #include <Kernel/Interrupts/InterruptManagement.h> | ||||||
|  | @ -59,6 +60,11 @@ void InterruptManagement::initialize() | ||||||
| { | { | ||||||
|     ASSERT(!InterruptManagement::initialized()); |     ASSERT(!InterruptManagement::initialized()); | ||||||
|     s_interrupt_management = new InterruptManagement(); |     s_interrupt_management = new InterruptManagement(); | ||||||
|  | 
 | ||||||
|  |     if (kernel_command_line().lookup("smp").value_or("off") == "on") | ||||||
|  |         InterruptManagement::the().switch_to_ioapic_mode(); | ||||||
|  |     else | ||||||
|  |         InterruptManagement::the().switch_to_pic_mode(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void InterruptManagement::enumerate_interrupt_handlers(Function<void(GenericInterruptHandler&)> callback) | void InterruptManagement::enumerate_interrupt_handlers(Function<void(GenericInterruptHandler&)> callback) | ||||||
|  |  | ||||||
|  | @ -85,7 +85,6 @@ namespace Kernel { | ||||||
| 
 | 
 | ||||||
| [[noreturn]] static void init_stage2(); | [[noreturn]] static void init_stage2(); | ||||||
| static void setup_serial_debug(); | static void setup_serial_debug(); | ||||||
| static void setup_interrupts(); |  | ||||||
| static void setup_time_management(); | static void setup_time_management(); | ||||||
| 
 | 
 | ||||||
| VirtualConsole* tty0; | VirtualConsole* tty0; | ||||||
|  | @ -121,7 +120,7 @@ extern "C" [[noreturn]] void init() | ||||||
|     for (ctor_func_t* ctor = &start_ctors; ctor < &end_ctors; ctor++) |     for (ctor_func_t* ctor = &start_ctors; ctor < &end_ctors; ctor++) | ||||||
|         (*ctor)(); |         (*ctor)(); | ||||||
| 
 | 
 | ||||||
|     setup_interrupts(); |     InterruptManagement::initialize(); | ||||||
|     ACPI::initialize(); |     ACPI::initialize(); | ||||||
| 
 | 
 | ||||||
|     new VFS; |     new VFS; | ||||||
|  | @ -358,28 +357,6 @@ extern "C" int __cxa_atexit(void (*)(void*), void*, void*) | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void setup_interrupts() |  | ||||||
| { |  | ||||||
|     InterruptManagement::initialize(); |  | ||||||
| 
 |  | ||||||
|     if (!kernel_command_line().contains("smp")) { |  | ||||||
|         InterruptManagement::the().switch_to_pic_mode(); |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
|     auto smp = kernel_command_line().get("smp"); |  | ||||||
|     if (smp == "off") { |  | ||||||
|         InterruptManagement::the().switch_to_pic_mode(); |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
|     if (smp == "on") { |  | ||||||
|         InterruptManagement::the().switch_to_ioapic_mode(); |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     klog() << "smp boot argmuent has an invalid value."; |  | ||||||
|     hang(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void setup_time_management() | void setup_time_management() | ||||||
| { | { | ||||||
|     if (!kernel_command_line().contains("time")) { |     if (!kernel_command_line().contains("time")) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A