Commit Graph

646 Commits

Author SHA1 Message Date
bjorn3 8b217edac0 Fix two unsafe block related warnings 2026-03-30 18:42:38 +02:00
bjorn3 2fc2d5897a Fix a couple of unused import warnings 2026-03-30 18:38:25 +02:00
bjorn3 c51aa1ef86 rmm: Make a couple of methods safe 2026-03-29 14:16:53 +02:00
bjorn3 abf710b4a2 Move handling of kernel page table entry copying to RMM
This way it can ensure those page table entries never get unmapped,
ensuring they are kept in sync between all processes.
2026-03-29 14:16:53 +02:00
bjorn3 604e1729cb Rustfmt 2026-03-29 14:16:53 +02:00
bjorn3 b5603422be Check at compile time that KernelMapper is writable if necessary 2026-03-28 23:22:19 +01:00
Philipp Bartsch 5865ec0790 /scheme/sys/cpu: Add aarch64 feature detection
This only lists features from ID_AA64ISAR0_EL1 and ID_AA64ISAR1_EL1.
For other features one would have to evaluate more registers.
2026-03-26 22:15:03 +01:00
Philipp Bartsch 2d5e2b39f5 Drop extra debug print 2026-03-26 00:49:33 +01:00
Philipp Bartsch a60cc25015 Update aarch64 implementers list
Two vendors were missing compared to ARM's official list.

https://developer.arm.com/documentation/ddi0601/2025-12/AArch64-Registers/MIDR-EL1--Main-ID-Register
2026-03-26 00:49:11 +01:00
Connor-GH 8f468ec106 syscall: remove comment about test vs bt x86 instructions
According to Agner Fog's documentation
(https://agner.org/optimize/instruction_tables.pdf), the following information
is true:

These instructions have identical latency and throughput, except for Zen
5, which lists `test` as having reciprocal throughput of 0.25 cycles,
and `bt` having reciprocal throughput of 0.33 cycles. This rules out the
`bt` instruction for being the ideal instruction.

The other `test` instructions were removed as candidates because,
regardless of the size of the memory fetched at the address, at least 64
bytes will need to be fetched because it will be stored in the cache
line. The WORD and DWORD cases can be ruled out because we cannot assume
that `rsp + 16` or `rsp + 17` will not be on a 64-byte alignment
boundary, which would cause two cachelines to be essentially filled with
garbage we don't care about. The best case scenario is that we only need
to fill one cache line with garbage, which is what the BYTE version does
every time.
2026-03-12 09:41:29 -05:00
Wildan M c4e86bfffd Change time offset to RwLock 2026-03-10 05:58:26 +07:00
auronandace 14b8c2b0c1 enforce two lints and collapse some ifs 2026-03-03 14:51:32 +00:00
auronandace f7b0f5ec37 eliminate an unwrap in gdt for x86_shared 2026-03-02 10:56:28 +00:00
Wildan M 3c2b1a11c5 Add ordered lock for time offset mutex 2026-02-25 11:42:17 +07:00
bjorn3 858b712df5 Use naked_asm!() instead of global_asm!() where possible 2026-02-09 22:28:38 +01:00
bjorn3 d51fe0c7e0 Avoid concat!() in inline asm
It is no longer necessary in modern rustc versions.
2026-02-09 22:12:20 +01:00
Ibuki Omatsu 5ac00f5533 Remove namespace management from the kernel. 2026-01-20 20:43:34 -07:00
Pascal Reich a919d2626b Inline Documentation Fixes 2026-01-10 16:19:34 -07:00
Wildan M 92132132c1 Implement clock_getres and handle path to time scheme 2025-12-21 05:24:13 +07:00
Ibuki Omatsu e30ed9ab6a Introduce syscall6. Add unlinkat and remove unlink and rmdir. 2025-12-17 18:31:04 -07:00
Jeremy Soller 7ffc046d46 Enable serial interrupts on aarch64 ACPI 2025-11-21 08:39:38 -07:00
Jeremy Soller 01ec650b1e Add support for userspace stack traces using usercopy 2025-11-10 08:54:06 -07:00
Jeremy Soller 91b835d29f Reduce logging significantly 2025-11-01 20:24:11 -06:00
bjorn3 3b1fd27431 Remove byteorder dependency 2025-10-26 12:43:08 -06:00
bjorn3 0f7b16d89d Partially use cfg!() rather than #[cfg] for controlling the profiling module
This only adds a pointer worth of overhead per cpu core in the
PerCpuBlock struct.

Also fix a bunch of unsafe_op_in_unsafe_fn warnings in the profiling
code.
2025-10-26 18:27:29 +01:00
bjorn3 1498376360 Unify generic irq handling between x86 and x86_64 2025-10-25 19:44:03 +02:00
bjorn3 e8acd82074 Directly define __usercopy_{start,end} in the usercopy functions
As opposed to requiring a linker script
2025-10-25 19:12:27 +02:00
bjorn3 021cdf47f4 Fix a bunch of warnings 2025-10-19 14:27:43 +02:00
bjorn3 9d5ad06b30 Move some code from the trampoline to global_asm!() 2025-10-19 06:23:39 -06:00
bjorn3 4b16e66164 Set arm64 exception handler before entering the rust world 2025-10-19 06:23:39 -06:00
bjorn3 d31e552d08 Set riscv exception handler before entering the rust world 2025-10-19 06:23:39 -06:00
bjorn3 ff65afd003 Don't depend on the stack setup by the bootloader
This way we can choose our own size for the stack and don't have to
identity map it manually. Also this way the bootloader doesn't have to
change the stack pointer right before calling into the kernel (which it
currently does in an unsound way)
2025-10-19 06:23:39 -06:00
bjorn3 7ea41f4fee Remove no longer necessary lint allow 2025-10-19 11:49:14 +02:00
bjorn3 b09659ac25 Remove unnecessary unsafe blocks in naked functions 2025-10-19 11:48:46 +02:00
Speedy_Lex 0931a7f49f Resolve a huge portion of the clippy lints 2025-10-06 06:30:23 -06:00
Jeremy Soller db8fb14614 Fix compilation on other archs 2025-10-04 11:58:04 -06:00
Speedy_Lex ea812e8f2a Run cargo fmt 2025-10-04 01:06:15 +02:00
Speedy_Lex d38002969c Fixes for rust update 2025-10-04 00:55:26 +02:00
bjorn3 ede9a47f9c Move .bss and .data tests to inline asm
If .bss is not properly cleared or .data is incorrectly cleared, there
is no way to tell what will happen if we try to run Rust code.
2025-09-25 09:46:17 -06:00
Jeremy Soller 0203ad750a Fix compilation on aarch64/riscv64gc 2025-09-23 13:46:44 -06:00
Jeremy Soller b6a5245556 Require passing loopback test for hard-coded serial 2025-09-23 11:33:37 -06:00
Jeremy Soller 5dc6f7c3ba lock ordering 2025-09-22 07:48:48 -06:00
bjorn3 e7358e3e5b Deduplicate a bunch of things that use KernelArgs between archs 2025-09-20 19:10:19 +02:00
bjorn3 3f385ba79d Unify KernelArgs type between architectures 2025-09-20 19:10:19 +02:00
bjorn3 b36deffa61 Replace scrolling with wraparound in graphical debug
Inspired by how Haiku does printing for its kernel debugger, this commit
gets rid of the scrolling when the bootlog reaches the end of the screen
and instead wraps around to the start of the screen. Between the last
written line and the first visible written line there is always a blank
line to provide visual separation.

Getting rid of the scrolling significantly simplifies the implementation
of graphical debug and removes the need for double buffering for
performance as we no longer need to read back the framebuffer when
scrolling which is very expensive on write-combining memory like the
framebuffer.
2025-09-20 17:15:02 +02:00
bjorn3 f58bcd584e Separate logical and hardware cpu ids 2025-09-20 15:33:08 +02:00
bjorn3 3a47c3becc Move most HPET logs to the trace log level
This significantly reduces the amount of boot logs produced by the
kernel by default on x86. With this the full kernel boot logs now fit on
a single screen on my system.
2025-09-20 15:21:54 +02:00
bjorn3 68526b2af5 Use naked asm for riscv exception handler 2025-09-18 17:29:50 +02:00
bjorn3 081efd6cfa Allocate IDT for APs on the BSP and statically allocate BSP IDT
This allows them to be immediately installed by kstart/kstart_ap without
having to wait for the page tables to be set up correctly. This removes
the initial IDT.
2025-09-17 21:03:36 +02:00
bjorn3 e81db007b7 Couple of cleanups to the IDT handling 2025-09-17 21:03:36 +02:00