mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:12:46 +00:00 
			
		
		
		
	 5e81464245
			
		
	
	
		5e81464245
		
	
	
	
	
		
			
			This is by default left empty, so people won't run the kernel in a mode which they didn't want to. The embedded string will override the supplied commandline from the bootloader, which is good for debugging sessions. This change seemed important for me, because I debug the kernel on bare metal with iPXE, and every change to the commandline meant that I needed rewrite a new iPXE USB image with a modified iPXE script.
		
			
				
	
	
		
			89 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/HashMap.h>
 | |
| #include <AK/Optional.h>
 | |
| #include <AK/String.h>
 | |
| #include <AK/Vector.h>
 | |
| 
 | |
| namespace Kernel {
 | |
| 
 | |
| enum class BootMode {
 | |
|     NoFramebufferDevices,
 | |
|     SelfTest,
 | |
|     Graphical
 | |
| };
 | |
| 
 | |
| enum class HPETMode {
 | |
|     Periodic,
 | |
|     NonPeriodic
 | |
| };
 | |
| 
 | |
| enum class AcpiFeatureLevel {
 | |
|     Enabled,
 | |
|     Limited,
 | |
|     Disabled,
 | |
| };
 | |
| 
 | |
| enum class PCIAccessLevel {
 | |
|     IOAddressing,
 | |
|     MappingPerBus,
 | |
|     MappingPerDevice,
 | |
| };
 | |
| 
 | |
| enum class AHCIResetMode {
 | |
|     ControllerOnly,
 | |
|     Complete,
 | |
|     None
 | |
| };
 | |
| 
 | |
| class CommandLine {
 | |
|     AK_MAKE_ETERNAL;
 | |
| 
 | |
| public:
 | |
|     static void early_initialize(const char* cmd_line);
 | |
|     static void initialize();
 | |
| 
 | |
|     [[nodiscard]] const String& string() const { return m_string; }
 | |
|     Optional<String> lookup(const String& key) const;
 | |
|     [[nodiscard]] bool contains(const String& key) const;
 | |
| 
 | |
|     [[nodiscard]] bool is_boot_profiling_enabled() const;
 | |
|     [[nodiscard]] bool is_ide_enabled() const;
 | |
|     [[nodiscard]] bool is_smp_enabled() const;
 | |
|     [[nodiscard]] bool is_vmmouse_enabled() const;
 | |
|     [[nodiscard]] PCIAccessLevel pci_access_level() const;
 | |
|     [[nodiscard]] bool is_legacy_time_enabled() const;
 | |
|     [[nodiscard]] bool is_no_framebuffer_devices_mode() const;
 | |
|     [[nodiscard]] bool is_force_pio() const;
 | |
|     [[nodiscard]] AcpiFeatureLevel acpi_feature_level() const;
 | |
|     [[nodiscard]] BootMode boot_mode() const;
 | |
|     [[nodiscard]] HPETMode hpet_mode() const;
 | |
|     [[nodiscard]] bool disable_physical_storage() const;
 | |
|     [[nodiscard]] bool disable_ps2_controller() const;
 | |
|     [[nodiscard]] bool disable_uhci_controller() const;
 | |
|     [[nodiscard]] bool disable_virtio() const;
 | |
|     [[nodiscard]] AHCIResetMode ahci_reset_mode() const;
 | |
|     [[nodiscard]] String userspace_init() const;
 | |
|     [[nodiscard]] Vector<String> userspace_init_args() const;
 | |
|     [[nodiscard]] String root_device() const;
 | |
|     [[nodiscard]] size_t switch_to_tty() const;
 | |
| 
 | |
| private:
 | |
|     CommandLine(const String&);
 | |
| 
 | |
|     void add_arguments(const Vector<String>& args);
 | |
|     void build_commandline(const String& cmdline_from_bootloader);
 | |
| 
 | |
|     String m_string;
 | |
|     HashMap<String, String> m_params;
 | |
| };
 | |
| 
 | |
| const CommandLine& kernel_command_line();
 | |
| 
 | |
| }
 |