summaryrefslogtreecommitdiff
path: root/Kernel/Arch
AgeCommit message (Collapse)Author
2022-06-02Kernel: Add Interrupts/IRQHandler.cpp to the aarch64 buildTimon Kruiper
This requires a few stubs such that the compiler won't complain.
2022-06-02Kernel: Implement InterruptDisabler using generic Processor functionsTimon Kruiper
Now that the code does not use architectural specific code, it is moved to the generic Arch directory and the paths are modified accordingly.
2022-06-02Kernel: Separate NonMaskableInterruptDisabler into its own fileTimon Kruiper
This is for the upcoming change to make InterruptDisabler class work for the aarch64 build.
2022-06-02Kernel: Add interrupt related functions to Processor classTimon Kruiper
This adds {enable, disable}_interrupts() and are_interrupts_enabled() to the Processor class, and also implements them for x86(_64) and aarch64.
2022-06-02Kernel: Add DAIF system register to aarch64 registersTimon Kruiper
This register can be used to check whether the 4 different types of interrupts are masked. A different variant can be used to set/clear specific interrupt bits.
2022-06-02Kernel: Add GenericInterruptHandler.cpp to aarch64 buildTimon Kruiper
This requires us to add an Interrupts.h file in the Kernel/Arch directory, which includes the architecture specific files. The commit also stubs out the functions to be able to compile the aarch64 Kernel.
2022-05-30Kernel: Do not include AK/Platform.h in mcontext headersSeekingBlues
Including signal.h would cause several ports to fail on build, because it would end up including AK/Platform.h through these mcontext headers. This is problematic because AK/Platform.h defines several macros with very common names, such as `NAKED` (breaks radare2), and `NO_SANITIZE_ADDRESS` and `ALWAYS_INLINE` (breaks ruby).
2022-05-30Kernel: Expose cache size for Intel CPUsLucas CHOLLET
The patch also prevents any try if the CPU's vendor isn't known and improves the const-correctness of the AMD version.
2022-05-29Kernel: Expose size of L1 data/instruction, L2, and L3 CPU caches :^)Linus Groh
These are added as properties of the "caches" object to each processor, if available.
2022-05-21Kernel: Report value of ESR_EL1 when exception happens on aarch64Timon Kruiper
2022-05-21Kernel: Add Exception Syndrome Register to aarch64 Registers.hTimon Kruiper
This allows us to print more information about what kind of exception happend.
2022-05-21Kernel: Add more exception handlers for aarch64 KernelTimon Kruiper
The aarch64 Kernel runs with SP_EL0, thus exceptions that happen can now be handled.
2022-05-21Kernel: Set up initial exception stack when going into EL1 on aarch64Timon Kruiper
When an exception is triggered on aarch64, the processor always switches to the exception stack which is defined by the SP_EL1 register.
2022-05-21Kernel: Add alignment specifier to aarch64 register definitionsTimon Kruiper
When disabling UBSAN, the compiler would complain that the constraints of the inline assembly could not be met. By adding the alignas specifier the compiler can now determine that the struct can be passed into a register, and thus the constraints are met.
2022-05-15Kernel: Implement AVX `XSAVE` supportJesse Buhagiar
This adds some new buffers to the `FPUState` struct, which contains enough space for the `xsave` instruction to run. This instruction writes the upper part of the x86 SIMD registers (YMM0-15) to a seperate 256-byte area, as well as an "xsave header" describing the region. If the underlying processor supports AVX, the `fxsave` instruction is no longer used, as `xsave` itself implictly saves all of the SSE and x87 registers. Co-authored-by: Leon Albrecht <leon.a@serenityos.org>
2022-05-12Kernel: Put code in the aarch64 init.cpp file into the Kernel namespaceTimon Kruiper
2022-05-12Kernel: Move __assertion_failed to aarch64/Panic.cppTimon Kruiper
This is for an upcoming change to add the Kernel namespace to the init.cpp file.
2022-05-12Kernel: Remove Prekernel namespace in the aarch64 KernelTimon Kruiper
Now that we merged all the Prekernel files into the Kernel files, we can get rid of the Prekernel namespace as well.
2022-05-12Kernel: Move the aarch64 boot.S out of the Prekernel directoryTimon Kruiper
2022-05-12Kernel: Move Prekernel{CPU, Exceptions}.cpp out of Prekernel directoryTimon Kruiper
This lets us delete the Prekernel.h file, and gets us closer to deleting the Prekernel from the aarch64 Kernel.
2022-05-12Kernel: Move Prekernel assembly utils to aarch64/ASM_wrapper.hTimon Kruiper
By moving these functions to the ASM_wrapper.h file, we can get rid of another Prekernel file.
2022-05-12Kernel: Replace Prekernel::halt with Processor::halt in aarch64 buildTimon Kruiper
This allows us to get rid of one more Prekernel file.
2022-05-09Kernel: Add initial implementation of Processor in aarch64Timon Kruiper
Instead of storing the current Processor into a core local register, we currently just store it into a global, since we don't support SMP for aarch64 anyway. This simplifies the initial implementation.
2022-05-09Kernel: Call the constructors in the aarch64 init functionTimon Kruiper
Now that we have separated the kmalloc.cpp constructors into a separate library, we can actually call the constructors in the init function.
2022-05-09Kernel: Reorder sections in aarch64 linker script to save spaceTimon Kruiper
By putting the NOLOAD sections (.bss and .super_pages) at the end of the ELF file, objcopy does not have to insert a lot of zeros to make sure that the .ksyms section is at the right place in memory. Now the .ksyms section comes before the two NOLOAD sections. This shrinks the kernel8.img with 6MB, from 8.3M to 2.3M. :^)
2022-05-09Kernel: Add some mission sections to the aarch64 linker scriptTimon Kruiper
The sections did end up in the ELF file, however they weren't explicitely mentioned in the linker.ld script. In the future, we can add the --orphan-handling=error flag to the linker options, which will enforce that the sections used in the sources files also are mentioned in the linker script.
2022-05-03Kernel: Panic when an assertion is failed in aarch64 KernelTimon Kruiper
This in turn makes sure that we get a nice backtrace when an assertion failed, or when a VERIFY_NOT_REACHED() is hit.
2022-05-03Kernel: Remove unused aarch64 Prekernel::panic() functionTimon Kruiper
2022-05-03Kernel: Replace calls to Prekernel::panic() with PANIC macro on aarch64Timon Kruiper
2022-05-03Kernel: Implement __panic() for the aarch64 KernelTimon Kruiper
Now that dump_backtrace() works, we can actually print a helpful backtrace when the Kernel panics.
2022-05-03Kernel: Load the kernel symbol table for the aarch64 KernelTimon Kruiper
Since kmalloc() now works, we can actually load the kernel symbol table! This in turn allows us to call dump_backtrace(), and actually get a useful backtrace in the aarch64 Kernel.
2022-05-03Kernel: Add kmalloc_init() to the init function of the aarch64 KernelTimon Kruiper
With the previous commits, we are now able to call kmalloc() :^)
2022-05-03Kernel: Remove VERIFY_NOT_REACHED in {current, idle}_thread for aarch64Timon Kruiper
These functions are called by kmalloc, and since there is no support for threading in the aarch64 build yet, we can simply remove the VERIFY_NOT_REACHED().
2022-05-03Kernel: Add bare-minimum implementation for aarch64 SpinlockTimon Kruiper
2022-05-03Kernel: Move Arch/x86/Spinlock.h and add stubs for aarch64Timon Kruiper
The code in Spinlock.h has no architectural specific logic, thus can be moved to the Arch directory. This contains no functional change. Also add the Spinlock.cpp file for aarch64 which contains stubs for the lock and unlock functions.
2022-05-03Kernel: Add the .ksyms section to the aarch64 Kernel binaryTimon Kruiper
Previously the embedmap.sh script generated a warning, since there was no section defined where the actual kernel.map could be stored. This is necesarry for generating kernel backtraces.
2022-05-03Kernel: Implement safe_memcpy for the aarch64 buildTimon Kruiper
The implementation just calls the regular memcpy, and is not safe yet. This can be done later.
2022-05-03Kernel: Move Kernel/Arch/x86/SafeMem.h to Kernel/Arch/SafeMem.hTimon Kruiper
The file does not contain any specific architectural code, thus it can be moved to the Kernel/Arch directory.
2022-05-03Kernel: Add KSyms.cpp to the aarch64 buildTimon Kruiper
This is the first step in making dump_backtrace() work.
2022-05-03Kernel: Remove UART::{print_num, print_hex} since they are unusedTimon Kruiper
2022-05-03Kernel: Modify UART::print_str() to also take into account the lengthTimon Kruiper
Previously in the aarch64 Kernel, this would cause dbgln() to actually print more characters of the next string in memory, because strings in the Kernel are not zero terminated by default. Prevent this by using the passed in length of the string.
2022-05-03Kernel: Remove aarch64/Utils.{cpp, h} since they are not used anymoreTimon Kruiper
2022-05-03Kernel: Replace calls to UART::print_str() with dbgln()Timon Kruiper
Since we can now use dbgln() in the aarch64 Kernel, lets use it! :^)
2022-05-03Kernel: Let Processor::is_initialized() of aarch64 return falseTimon Kruiper
When calling dbgln(), the formatting code in AK/Format.h calls Processor::is_initialized() to determine whether to add some text about the current processor to the debug output. Instead of crashing, we just return false, such that we can use dbgln() etc in the aarch64 Kernel.
2022-05-03Kernel: Add aarch64 version of kprintf.cppTimon Kruiper
This allows us to use the AK formatting functions in the aarch64 Kernel. Also add FIXME to make sure that this file will be removed when the proper abstractions are in place in the normal Kernel/kprintf.cpp.
2022-04-26Kernel: Strip null terminators from all CPUID strings, not just brandLinus Groh
I've noticed that the KVM hypervisor vendor ID string contained null terminators in the serialized JSON string in /proc/cpuinfo - let's avoid that, and err on the side of caution and strip them from all strings built from CPUID register values. They may not be fixed width after all.
2022-04-08Kernel: Query OS-enabled CPUID features again at the end of cpu_setup()Linus Groh
For OSPKE this is a no-op as we don't enable PKU yet, but the state of the OSXSAVE flag might have changed if we enabled XSAVE.
2022-04-08Kernel: Rename OSPKU CPUID feature flag to OSPKELinus Groh
Unlike "XSAVE enabled by OS" being indicated by the OSXSAVE flag, in this case it's "PKU enabled by OS" being indicated by the OSPKE flag.
2022-04-08Kernel: Adjust includes after file reorganizationTiaan Louw
2022-04-06Kernel: Improve the aarch64 kernel source files disk layoutJames Mintram