feat: add support for aarch64 timer/interrupts, port MontaukOS userspace

This commit is contained in:
daniel committed 2026-10-25 08:27:09 +01:00
1 parent 8b6379fb7e
commit 8c09ccef66
101 files changed
+1720 -629

No files matched your search

+27 -1
View File
@@ -6,11 +6,16 @@ Two cross toolchains live here, both installed to `toolchain/local/`:
|--------|--------|---------|
| `build-toolchain.sh` | `x86_64-elf` | Bare-metal compiler for the kernel |
| `build-montauk-toolchain.sh` | `x86_64-montauk` | OS-aware compiler for userspace programs |
| `build-montauk-toolchain.sh aarch64` | `aarch64-montauk` | the same for the ARM port |
Both use Binutils 2.43.1 + GCC 14.2.0 and share the source trees in
`src/`. The Montauk target is added by the patches in `patches/` plus
the target header `files/montauk.h` (installed as
`gcc/config/montauk.h` in the GCC tree).
`gcc/config/montauk.h` in the GCC tree). The AArch64 target is a second
pair of patches (`*-montauk-aarch64.patch`) applied on top, with its
target header `files/aarch64-montauk.h` (installed as
`gcc/config/aarch64/montauk.h`). The ARM kernel is built with clang, not
with a bare-metal GCC.
## The x86_64-montauk target
@@ -42,6 +47,27 @@ The in-tree programs are built `-fno-exceptions -fno-rtti` (the project
convention), but that is a project style choice, not a toolchain limit —
see the STL section below.
## The aarch64-montauk target
`./toolchain/build-montauk-toolchain.sh aarch64` builds
`aarch64-montauk-gcc/g++` next to the x86 compilers, with its sysroot in
`toolchain/sysroot-aarch64/` and its libc from
`programs/lib/libc/build-aarch64/`. On a first build the libc cannot be
compiled yet, so the script builds GCC against the headers alone and
completes the sysroot afterwards. The target matches x86_64-montauk
(static `ET_EXEC` at 0x400000, 4 KiB segment alignment, the same crt
files and `-lc`), plus two defaults chosen so the shared userspace
behaves the same on both architectures:
- `-fsigned-char`: plain `char` is signed, as on x86 (AAPCS64 makes it
unsigned). The GUI's CP1252 text handling assumes signed bytes.
- `-mno-outline-atomics`: inline LL/SC atomics. Outline atomics choose
LSE at run time from HWCAP, which Montauk does not provide, and their
helpers are in libgcc, which `-nostdlib` programs never link.
`make ARCH=aarch64` at the repository root builds the userspace with it
(into `programs/bin-aarch64/`); see `programs/mk/arch.mk`.
## C++ standard library (hosted libstdc++)
`build-montauk-toolchain.sh` builds and installs a **hosted** libstdc++