summaryrefslogtreecommitdiff
path: root/Kernel/Prekernel
AgeCommit message (Collapse)Author
2023-01-25Kernel: Unify x86-64 assembly snippets naming for RDSEED & RDRANDkonrad
2023-01-24Kernel: Add KERNEL_MAPPING_BASE to Sections.h and use it in PrekernelTimon Kruiper
2022-12-28Kernel: Reorganize Arch/x86 directory to Arch/x86_64 after i686 removalLiav A
No functional change.
2022-12-28Kernel: Remove i686 supportLiav A
2022-11-29LibC: Use uintptr_t for __stack_chk_guardKeegan Saunders
We used size_t, which is a type that is guarenteed to be large enough to hold an array index, but uintptr_t is designed to be used to hold pointer values, which is the case of stack guards.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-24Kernel: Add a 'disable_kaslr' kernel command line parameterIdan Horowitz
This parameter can be used to disable the KASLR mechanism.
2022-03-23Kernel: Use the whole kernel PD range when randomizing the KASLR offsetIdan Horowitz
Now that we reclaim the memory range that is created by KASLR before the start of the kernel image, there's no need to be conservative with the KASLR offset.
2022-03-22Kernel: Use the pre-image kernel memory range introduced by KASLRIdan Horowitz
This ensures we don't just waste the memory range between the default base load address and the actual load address that was shifted by the KASLR offset.
2022-03-22Kernel: Keep kernel base load address 2 MiB alignedIdan Horowitz
This requirement comes from the fact the Prekernel mapping logic only uses 2 MiB pages. This unfortunately reduces the bits of entropy in kernel addresses from 16 bits to 7, but it could be further improved in the future by making the Prekernel mapping logic a bit more dynamic.
2022-03-22Kernel: Disable KASLR on i686Andreas Kling
The 32-bit CI runners don't seem to happy with KASLR, so let's make it x86-64 only for now.
2022-03-21Kernel: Add an extremely primitive version of KASLRIdan Horowitz
This initial (and very basic) implementation of KASLR simply randomizes the kernel base VA in the 256 MiB range following the default load base.
2022-03-12Kernel: Move aarch64 Prekernel into KernelJakub V. Flasar
As there is no need for a Prekernel on aarch64, the Prekernel code was moved into Kernel itself. The functionality remains the same. SERENITY_KERNEL_AND_INITRD in run.sh specifies a kernel and an inital ramdisk to be used by the emulator. This is needed because aarch64 does not need a Prekernel and the other ones do.
2022-02-09Kernel: Change static constexpr variables to constexpr where possibleLenny Maiorani
Function-local `static constexpr` variables can be `constexpr`. This can reduce memory consumption, binary size, and offer additional compiler optimizations. These changes result in a stripped x86_64 kernel binary size reduction of 592 bytes.
2022-02-03AK+Kernel+LibSanitizer: Store "ubsan-is-deadly" flag as Atomic<bool>Andreas Kling
2022-01-24Prekernel: Handle synchronous EL1 exceptions in C++ on aarch64Jesse Buhagiar
We now have a mechanism to save the current CPU context to the stack, and then pass that to the C++ common exception handler.
2022-01-24Prekernel: Install EL1 vector table at boot on aarch64Jesse Buhagiar
We now have a function to install a (currently default) vector table, meaning that any exceptions (or interrupts for that matter) will be caught by the processor and routed to one of the vectors inside the table.
2022-01-24Prekernel: Implement `print_hex` UART function on aarch64Jesse Buhagiar
This allows us to print a hex number to the serial terminal.
2022-01-07Everywhere: Fix spelling mistakesmjz19910
2022-01-06Kernel: Only use multiboot framebuffer details if presentTom
We should only look at the framebuffer structure members if the MULTIBOOT_INFO_FRAMEBUFFER_INFO bit is set in the flags field. Also add some logging if we ignored the fbdev command line argument due to either not having a framebuffer provided by the bootloader, or because we don't support the framebuffer format.
2021-12-04Kernel: Do not do integer to pointer conversion in constexpr functionsDaniel Bertalan
Creating pointers from arbitrary values is not a valid thing to do in constexpr functions. Furthermore, this functions is always called with runtime values anyways, so there's no use in having it be constexpr. Instead, make it ALWAYS_INLINE.
2021-11-28Kernel: Use peripheral addresses returned from MMIO to map prekernel memJames Mintram
2021-11-28Kernel: Refactor prekernel MMU to use a bump allocatorJames Mintram
2021-11-28Kernel: Rename Aarch64Asm -> ASM_wrapper and add Aarch64::Asm namespaceJames Mintram
2021-11-28Kernel: Rename Aarch64Registers -> Registers and add Aarch64 namespaceJames Mintram
2021-11-28Kernel: Set up and activate the MMU in the aarch64 perkernelJames Mintram
2021-11-28Kernel: Move common aarch64 asm functions into kernel folder and NSJames Mintram
2021-11-28Kernel: Split prekernel exception level code into its own fileJames Mintram
2021-11-28Kernel: Change prekernel to use shared SP across Exception LevelsJames Mintram
2021-11-28Kernel: Replace inline asm with typesafe static member functionsJames Mintram
2021-11-28Kernel: Remove unused header from Aarch64_asm_utilsJames Mintram
2021-10-31Kernel: Draw picture on screen when booting Raspberry PiMarcin Undak
2021-10-31Kernel: Add very simple PPM parser for Aarch64Marcin Undak
This is much simpler and more embeddable version than libGFX one. Solely purpose is to draw initial boot logo on screen before kernel is even booted.
2021-10-31Kernel: Add Framebuffer class for Raspberry PiMarcin Undak
It initializes framebuffer and exposes access to its properties.
2021-10-31Kernel: Refactor Aarch64 MailBox classMarcin Undak
The goal was to reduce common setup of messages. Changes: * MailBox turned into singleton to follow existing patterns * Removed device specific messages from MailBox requiring clients to know the details instead * Created base Message class which clients should deriver from It really simplify the usage for more complicated message queues like framebuffer setup - see followup commits.
2021-10-31Kernel: Add temporary debug printing utilities for Aarch64Marcin Undak
Added dbgln() and warnln() debug functions to help bootstraping. Eventually they are going to be replaced by AK/Format.h implementation.
2021-10-17Toolchain+Meta: Update LLVM version to 13.0.0Daniel Bertalan
This commit updates the Clang toolchain's version to 13.0.0, which comes with better C++20 support and improved handling of new features by clang-format. Due to the newly enabled `-Bsymbolic-functions` flag, our Clang binaries will only be 2-4% slower than if we dynamically linked them, but we save hundreds of megabytes of disk space. The `BuildClang.sh` script has been reworked to build the entire toolchain in just three steps: one for the compiler, one for GNU binutils, and one for the runtime libraries. This reduces the complexity of the build script, and will allow us to modify the CI configuration to only rebuild the libraries when our libc headers change. Most of the compile flags have been moved out to a separate CMake cache file, similarly to how the Android and Fuchsia toolchains are implemented within the LLVM repo. This provides a nicer interface than the heaps of command-line arguments. We no longer build separate toolchains for each architecture, as the same Clang binary can compile code for multiple targets. The horrible mess that `SERENITY_CLANG_ARCH` was, has been removed in this commit. Clang happily accepts an `i686-pc-serenity` target triple, which matches what our GCC toolchain accepts.
2021-10-17Everywhere: Make some symbols `__attribute__((used))` for LTODaniel Bertalan
With these changes, the userland builds correctly with Clang's ThinLTO enabled.
2021-10-17Prekernel: Force enable PAE on Intel Pentium M CPUsTim Schumacher
2021-10-17Prekernel: Split early boot printing into two subroutinesTim Schumacher
2021-10-17Kernel: Print CPU check errors by writing to VRAMTim Schumacher
2021-10-15Kernel: Discover initial exception level when booting Aarch64Marcin Undak
When booting on RPI3 firmware puts CPU in EL2 mode which is different from QEMU's default EL3. I've added logic to discover initial mode at boot and then act accordingly. This results in Serenity corectly switching to EL1 on target hardware now.
2021-10-15Kernel: Make Aarch64 register variables bit more descriptiveMarcin Undak
2021-10-15Kernel: Switch processor to EL1 immediately after boot on Aarch64Marcin Undak
2021-10-15Kernel: Move wait_cycles() function to Aarch_asm_utils.SMarcin Undak
Just a bit of housekeeping.
2021-10-15Kernel: Print current CPU exception level after booting on Aarch64Marcin Undak
This is a first step to switch to exception level 1. This is also my first patch for SerenityOS :)
2021-10-13Kernel: Add post build step to generate kernel8.imgJames Mintram
Add a postbuild step which creates a raw binary file called kernel8.img from the Prekernel elf file.
2021-10-02Kernel: Make aarch64 UART::print_num() print u64sNico Weber
2021-10-02Kernel: Add a Timer class for aarch64Nico Weber
For now, this can only query microseconds since boot. Use this to print a timestamp every second. This busy-loops until a second has passed. This might be a good first use of interrupts soon. qemu used to not implement this timer at some point, but it seems to work fine even in qemu now (qemu v 5.2.0).
2021-10-02Prekernel: Better datasheet link for RPi3Nico Weber