summaryrefslogtreecommitdiff
path: root/Kernel/init.cpp
AgeCommit message (Collapse)Author
2021-01-09Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-09Kernel/USB: Implement test transferJesse Buhagiar
We can now test a _very_ basic transaction via `do_debug_transfer()`. This function merely attaches some TDs to the LSCTRL queue head and points some input and output buffers. We then sense an interrupt with USBSTS value of 1, meaning Interrupt On Completion (of the transaction). At this point, the input buffer is filled with some data.
2021-01-09Kernel/USB: Add basic root port detection/managementJesse Buhagiar
We can now read/write to the two root ports exposed to the UHCI controller, and detect when a device is plugged in or out via a kernel process that constantly scans the port for any changes. This is very basic, but is a bit of fun to see the kernel detecting hardware on the fly :^)
2021-01-09Kernel/USB: Move USB classes into `USB` namespaceJesse Buhagiar
The entire USB spec involves more than just UHCI, so let's put everything into it's own nice namespace :^)
2021-01-09Kernel/USB: Move USB related files to into specific directoryJesse Buhagiar
As the USB/UHCI driver grows in size, it'll be much cleaner to have all of the USB related files in one folder where they can be easily accessed :^)
2020-12-27Kernel: Introduce a new partitioning subsystemLiav A
The partitioning code was very outdated, and required a full refactor. The new subsystem removes duplicated code and uses more AK containers. The most important change is that all implementations of the PartitionTable class conform to one interface, which made it possible to remove unnecessary code in the EBRPartitionTable class. Finding partitions is now done in the StorageManagement singleton, instead of doing so in init.cpp. Also, now we don't try to find partitions on demand - the kernel will try to detect if a StorageDevice is partitioned, and if so, will check what is the partition table, which could be MBR, GUID or EBR. Then, it will create DiskPartitionMetadata object for each partition that is available in the partition table. This object will be used by the partition enumeration code to create a DiskPartition with the correct minor number.
2020-12-27Kernel: Move Partition code files to the Storage folderLiav A
This folder is more appropriate for these files.
2020-12-21Kernel: Introduce the StorageManagement classLiav A
The StorageManagement class has 2 roles: 1. During boot, it should find all storage controllers in the machine, and then determine what is the boot device. 2. Later on boot, it is a registrar of all storage controllers and storage devices. Thus, it could be used to show information about these devices when implemented. This change allows the user to specify a boot driver other than /dev/hda and if it's connected in the machine - it will boot.
2020-12-21Kernel: Introduce the new Storage subsystemLiav A
This new subsystem is somewhat replacing the IDE disk code we had with a new flexible design. StorageDevice is a generic class that represent a generic storage device. It is meant that specific storage hardware will override the interface. StorageController is a generic class that represent a storage controller that can be found in a machine. The IDEController class governs two IDEChannels. An IDEChannel is responsible to manage the master & slave devices of the channel, therefore an IDEChannel is an IRQHandler.
2020-11-30Kernel: Allow passing a thread argument for new kernel threadsTom
This adds the ability to pass a pointer to kernel thread/process. Also add the ability to use a closure as thread function, which allows passing information to a kernel thread more easily.
2020-11-26Kernel: Enable VMWareBackdoor immediately at bootTom
Rather than waiting until we get the first mouse packet, enable the absolute mode immediately. This avoids having to click first to be able to move the mouse.
2020-11-12Kernel: Add I8042Controller to detect and manage PS/2 devicesTom
Rework the PS/2 keyboard and mouse drivers to use a common 8042 controller driver. Also, reset and reconfigure the 8042 controller as they are not guaranteed to be in the state that we expect.
2020-10-25Kernel: Set up and calibrate APIC timer, and enable timer on all CPUsTom
This enables the APIC timer on all CPUs, which means Scheduler::timer_tick is now called on all CPUs independently. We still don't do anything on the APs as it instantly crashes due to a number of other problems.
2020-10-25Kernel: Optionally take some arguments to pass to the init programAnotherTest
This makes it possible to start _everything_ under UserspaceEmulator, by setting `init_args` to `--report-to-debug,/bin/SystemServer` and `init` to `/bin/UserspaceEmulator`. With the UE patches before this, we get to spawn WindowServer, and crash because of FLD_RM32 (nothing tested past that) in graphical mode. But we get a working shell in text mode :^) (and DHCPClient fails when setting whatever settings it has received)
2020-09-27Kernel: Make Thread refcountedTom
Similar to Process, we need to make Thread refcounted. This will solve problems that will appear once we schedule threads on more than one processor. This allows us to hold onto threads without necessarily holding the scheduler lock for the entire duration.
2020-09-04Kernel/USB: Start fleshing out a basic UHCI controller driver :^)Andreas Kling
Let's see if we can talk to some USB devices. We will now detect a UHCI controller if present on the PCI bus.
2020-08-25Kernel: Copy command line to a safe placeTom
This avoids kmalloc overwriting it because it may be within the kmalloc or eternal pool.
2020-08-25Kernel: Switch singletons to use new Singleton classTom
MemoryManager cannot use the Singleton class because MemoryManager::initialize is called before the global constructors are run. That caused the Singleton to be re-initialized, causing it to create another MemoryManager instance. Fixes #3226
2020-08-22Revert "Kernel: Switch singletons to use new Singleton class"Andreas Kling
This reverts commit f48feae0b2a300992479abf0b2ded85e45ac6045.
2020-08-22Revert "Kernel: Copy command line to a safe place"Andreas Kling
This reverts commit 41c005cb140c8a9ae94e6b68456d8d6f1d925a8f.
2020-08-22Kernel: Copy command line to a safe placeTom
This avoids kmalloc overwriting it because it may be within the kmalloc or eternal pool.
2020-08-21Kernel: Switch singletons to use new Singleton classTom
Fixes #3226
2020-08-13Kernel: Simplify the way we check for "serial_debug" on command lineAndreas Kling
2020-08-12Kernel: Tell compiler about invisible callsBen Wiederhake
This makes the Kernel build cleanly with -Wmissing-declarations.
2020-08-12Kernel: Group C++ ABI functions togetherBen Wiederhake
As suggested in #3096.
2020-08-10Kernel: Invoke heap constructors separately early onTom
By having a separate list of constructors for the kernel heap code, we can properly use constructors without re-running them after the heap was already initialized. This solves some problems where values were wiped out because they were overwritten by running their constructors later in the initialization process.
2020-08-10Kernel: More PID/TID typingBen Wiederhake
2020-07-30Kernel: Make BXVGA detection actually detect VBoxVGALuke
I decided to play around with trying to run Serenity in VirtualBox. It crashed WindowServer with a beautiful array of multi-color flashing letters :^) Skipping getting side-tracked seeing that it chose MBVGA in the serial debug and trying to debug why it caused such a display, I finally checked BXVGA. While find_framebuffer_address checks for VBoxVGA, init_stage2 didn't. Whoops!
2020-07-17Kernel: Ensure there are all VirtualConsoles properly initializedFlorian Angermeier
It is possible to switch to VirtualConsoles 1 to 4 via the shortcut ALT + [1-4]. Therefor the array of VirtualConsoles should be guaranteed to be initialized. Also add an constant for the maximum number of VirtualConsoles to guarantee consistency.
2020-07-09Kernel: Fix some flaws that caused crashes or hangs during bootTom
We need to halt the BSP briefly until all APs are ready for the first context switch, but we can't hold the same spinlock by all of them while doing so. So, while the APs are waiting on each other they need to release the scheduler lock, and then once signaled re-acquire it. Should solve some timing dependent hangs or crashes, most easily observed using qemu with kvm disabled.
2020-07-06Kernel: Add SMP IPI supportTom
We can now properly initialize all processors without crashing by sending SMP IPI messages to synchronize memory between processors. We now initialize the APs once we have the scheduler running. This is so that we can process IPI messages from the other cores. Also rework interrupt handling a bit so that it's more of a 1:1 mapping. We need to allocate non-sharable interrupts for IPIs. This also fixes the occasional hang/crash because all CPUs now synchronize memory with each other.
2020-07-03Kernel: Consolidate features into CPUFeature enumTom
This allows us to consolidate printing out all the CPU features into one log statement. Also expose them in /proc/cpuinfo
2020-07-03Kernel: Split initialization of Processor structureTom
We need to very early on initialize the Processor structure so that we can use RecursiveSpinLock early on.
2020-07-01Kernel: Boot all APS all the way into their own idle loopTom
2020-07-01Kernel: Add a quickmap region for each processorTom
Threads need to be able to concurrently quickmap things.
2020-07-01Kernel: Turn Thread::current and Process::current into functionsTom
This allows us to query the current thread and process on a per processor basis
2020-07-01Kernel: Implement software context switching and Processor structureTom
Moving certain globals into a new Processor structure for each CPU allows us to eventually run an instance of the scheduler on each CPU.
2020-06-27Kernel: Make Random work on CPUs without rdrandPeter Elliott
- If rdseed is not available, fallback to rdrand. - If rdrand is not available, block for entropy, or use insecure prng depending on if user wants fast or good random.
2020-06-20Kernel: Remove DMI decoder from the kernelAndreas Kling
As suggested by @supercomputer7, we can simply expose this as a blob and decode it in userspace instead. Fixes #2599.
2020-06-12AK: Make string-to-number conversion helpers return OptionalAndreas Kling
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
2020-06-04Kernel: Detect APs and boot them into protected modeTom
This isn't fully working, the APs pretend like they're fully initialized and are just halted permanently for now.
2020-05-27Kernel: Introduce "boot_mode" and "init" cmdline optionsSergey Bugaev
Together, they replace the old text_debug option. * boot_mode should be either "graphical" (the default) or "text". We could potentially support other values here in the future. * init specifies which userspace process the kernel should spawn to bootstrap userspace. By default, this is SystemServer, but you can specify e.g. init=/bin/Shell to run system diagnostics.
2020-05-27Kernel: Port VirtualConsole to LibVT :^)Sergey Bugaev
Unfortunately this drops the feature of preserving VGA buffer contents. Resolves https://github.com/SerenityOS/serenity/issues/2399
2020-05-04Kernel: Use Multiboot macros instead of magic constants (#2090)Nathan Lanza
MUTLIBOOT_FRAMEBUFFER_TYPE_{RGB,EGA_TEXT} are defined in the Multiboot.h header. Use those definitions instead of hard-coding 1 and 2.
2020-04-18Kernel: Remove CommandLine::get() in favor of lookup()Andreas Kling
lookup() returns an Optional<String> which allows us to implement easy default values using lookup(key).value_or(default_value);
2020-04-11Kernel: Instantiate network adapters in their own detect() methodsLiav A
This commit is one step forward for pluggable driver modules. Instead of creating instances of network adapter classes, we let their detect() methods to figure out if there are existing devices to initialize.
2020-04-11Kernel: Keep records of PCI::Address & PCI::ID pairs for enumerationLiav A
2020-04-09Kernel: Create BXVGA device if found in the PCI busLiav A
2020-04-09Kernel: Simplify the Time management initializationLiav A
2020-04-09Kernel: Run clang-format on init.cppLiav A