summaryrefslogtreecommitdiff
path: root/Kernel/Prekernel/CMakeLists.txt
AgeCommit message (Collapse)Author
2022-12-28Kernel: Remove i686 supportLiav A
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-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.
2021-11-28Kernel: Rename Aarch64Asm -> ASM_wrapper and add Aarch64::Asm 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: Replace inline asm with typesafe static member functionsJames 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: 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-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: 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-09-27Kernel: Adjust aarch64 linker scriptNico Weber
- .text now starts at 0x80000, where an actual (non-qemu) RPi expects - use magic section name ".text.first" to make sure the linker script puts the kernel entry point at the start of the .text section - remove a few things from the x86 linker script that aren't needed for aarch64 (yet?)
2021-09-27Kernel: Move prekernel linker.ld into Arch subdirectoriesNico Weber
This moves Kernel/Prekernel/linker.ld unchanged to Kernel/Prekernel/Arch/aarch64 and Kernel/Prekernel/Arch/x86. The aarch64 will change in a future commit. No behavior change.
2021-09-26Kernel: Add UART class for aarch64Nico Weber
2021-09-26Kernel: Add a GPIO class for aarch64Nico Weber
This allows configuring the alternate pin functions and pin pull up/down states, which is needed for using the UART.
2021-09-19Kernel: Add a Mailbox class for aarch64Nico Weber
As a demo, query the firmware version. `Meta/serenity.sh gdb aarch64` can be used to observe that qemu puts 0x548E1 in x0 in response to this mailbox message.
2021-09-19Kernel: Add a MMIO class for aarch64Nico Weber
It doesn't do anything yet except figure out the peripheral base address. Very likely belongs in Kernel, not Prekernel, eventually.
2021-09-17Kernel: Don't link Prekernel against kernel_heapNico Weber
This was added in b5c98ede084e5d29, but it looks like a copy-paste mistake from Kernel/CMakeLists.txt. Unbreaks building for aarch64.
2021-09-15Meta: Switch to a SuperBuild that splits host and target buildsAndrew Kaster
Replace the old logic where we would start with a host build, and swap all the CMake compiler and target variables underneath it to trick CMake into building for Serenity after we configured and built the Lagom code generators. The SuperBuild creates two ExternalProjects, one for Lagom and one for Serenity. The Serenity project depends on the install stage for the Lagom build. The SuperBuild also generates a CMakeToolchain file for the Serenity build to use that replaces the old toolchain file that was only used for Ports. To ensure that code generators are rebuilt when core libraries such as AK and LibCore are modified, developers will need to direct their manual `ninja` invocations to the SuperBuild's binary directory instead of the Serenity binary directory. This commit includes warning coalescing and option style cleanup for the affected CMakeLists in the Kernel, top level, and runtime support libraries. A large part of the cleanup is replacing USE_CLANG_TOOLCHAIN with the proper CMAKE_CXX_COMPILER_ID variable, which will no longer be confused by a host clang compiler.
2021-09-12Kernel: Add a class to wrap aarch64 MIDR_EL1Nico Weber
We'll need part_num() to determine the MMIO address base. It's 0x3F000000 on rpi3 but 0xFE000000 on rpi4.
2021-09-12Kernel: Put boot.S first in aarch64 Prekernel source listNico Weber
The better fix is to have a linker script. We'll need this to set the entry point to 0x80000 for bare-metal builds anyways. But I'd like to get some UART output in qemu before I add this (otherwise I can't check if the bare-metal version does anything), so put in this temporary kludge for now.
2021-09-12Kernel: Build Prekernel with -fno-threadsafe-staticsNico Weber
Else, function-local statics create calls to __cxa_guard_acquire / __cxa_guard_release on aarch64, which we don't (yet?) implement. Since Prekernel is single-threaded, just sidestep that for now.
2021-09-08Kernel: Don't link Prekernel against libsupc++Nico Weber
It isn't needed. Also, we stopped linking Kernel against it in 67f0c0d5f074. libsupc++ depends on symbols like free() or realloc() which we removed from Kernel/StdLib.cpp after 67f0c0d5f074 and which don't exist in Prekernel either. (It also happens to make the aarc64 link fail in less obvious ways.)
2021-09-07Kernel: Build MiniStdLib.cpp in aarch64 buildsNico Weber
2021-09-07Kernel: Build UBSanitizer.cpp in aarch64 buildsNico Weber
All these symbols will be needed once we build MiniStdLib.cpp.
2021-09-06Kernel: Let aarch64 port call into C++Nico Weber
Put all but the first core into a loop, make room for some stack, and call init().
2021-08-28Prekernel: Make build on aarch64Nico Weber
Add a dummy Arch/aarch64/boot.S that for now does nothing but let all processor cores sleep. For now, none of the actual Prekernel code is built for aarch64.
2021-08-28Prekernel: Move boot.S and multiboot.S into an Arch/x86 subfolderNico Weber
2021-08-25CMake: Remove Prekernel incompatible options instead of overridingBrian Gianforcaro
The pattern of having Prekernel inherit all of the build flags of the Kernel, and then disabling some flags by adding `-fno-<flag>` options to then disable those options doesn't work in all scenarios. For example the ASAN flag `-fasan-shadow-offset=<offset>` has no option to disable it once it's been passed, so in a future change where this flag is added we need to be able to disable it cleanly. The cleaner way is to just allow the Prekernel CMake logic to filter out the COMPILE_OPTIONS specified for that specific target. This allows us to remove individual options without trashing all inherited options.
2021-08-08Meta: Add Clang support to the CMake build scriptsDaniel Bertalan
2021-07-30Prekernel: Disable KASAN, so it has no effect when enabledBrian Gianforcaro
I was working on some more KASAN changes and realized the system no longer links when passing -DENABLE_KERNEL_ADDRESS_SANITIZER=ON. Prekernel will likely never have KASAN support given it's limited environment, so just suppress it's usage.
2021-07-27Kernel: Support loading the kernel at almost arbitrary virtual addressesGunnar Beutner
This enables further work on implementing KASLR by adding relocation support to the pre-kernel and updating the kernel to be less dependent on specific virtual memory layouts.
2021-07-26Kernel: Add option to build with coverage instrumentation and KCOVPatrick Meyer
GCC and Clang allow us to inject a call to a function named __sanitizer_cov_trace_pc on every edge. This function has to be defined by us. By noting down the caller in that function we can trace the code we have encountered during execution. Such information is used by coverage guided fuzzers like AFL and LibFuzzer to determine if a new input resulted in a new code path. This makes fuzzing much more effective. Additionally this adds a basic KCOV implementation. KCOV is an API that allows user space to request the kernel to start collecting coverage information for a given user space thread. Furthermore KCOV then exposes the collected program counters to user space via a BlockDevice which can be mmaped from user space. This work is required to add effective support for fuzzing SerenityOS to the Syzkaller syscall fuzzer. :^) :^)
2021-07-23Prekernel: Don't build the prekernel as a PIE imageGunnar Beutner
This is unnecessary because the prekernel is always loaded at a known base address.
2021-07-18Kernel: Introduce basic pre-kernel environmentGunnar Beutner
This implements a simple bootloader that is capable of loading ELF64 kernel images. It does this by using QEMU/GRUB to load the kernel image from disk and pass it to our bootloader as a Multiboot module. The bootloader then parses the ELF image and sets it up appropriately. The kernel's entry point is a C++ function with architecture-native code. Co-authored-by: Liav A <liavalb@gmail.com>