Skip to content

Move most of ACPI to userspace

Jacob Lorentzon requested to merge 4lDO2/kernel:outsource-most-acpi into master

This MR removes all AML code, as well as FADT and DMAR table parsing from the kernel. They are now handled in userspace instead.

Only the most essential ACPI functionality is kept, which includes finding the RSDP if not already pointed to by UEFI. It also currently parses the MADT, for starting application processors, and HPET, for a better timer. In the future, we might even move those to userspace as well, and have an ACPI-independent interface for specifying what timer IRQ to use, and what APIC IDs to use when enabling CPUs.

The only non-trivial part left, is whether or not the shutdown logic is good enough. Previously, killing kmain of the bootstrap processor (always PID 1), caused it to run the regular SYS_EXIT() code (like setting the context status), and shutdown the system shortly after. Now, it does nothing except calling kstop directly in that handler, and then waiting for userspace (probably acpid) to receive an event from the kernel/acpi:kstop pipe, and finally waiting for one second before falling back to other shutdown mechanisms. I have however verified that shutdown works properly, at least on QEMU.

Edited by Jacob Lorentzon

Merge request reports