Commit Graph

2220 Commits

Author SHA1 Message Date
Elle Rhumsaa 0022bd448c dtb: remove allocation for in-memory DTB
Replaces the `Once<Vec<u8>>` with `Once<&'static [u8]>` to avoid an
unnecessary allocation.

Adds some basic documentation.

Signed-off-by: Elle Rhumsaa <elle@weathered-steel.dev>
2025-09-19 06:43:19 -06: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
bjorn3 742a7f4492 Remove Option around IDTs HashMap 2025-09-17 21:03:36 +02:00
Jeremy Soller 2bf580b260 Reimplement iostat 2025-09-16 20:39:06 -06:00
bjorn3 25d526e9a1 Inline load_segments 2025-09-16 19:58:56 +02:00
bjorn3 647c87c5a0 Allocate PCR for APs on the BSP
This allows them to be immediately installed by kstart_ap without having
to wait for the page tables to be set up correctly. This removes the
initial GDT.
2025-09-16 19:57:31 +02:00
bjorn3 dbe25b78e3 Make it possible to change KernelArgsAp without changing the trampolines 2025-09-16 19:33:07 +02:00
bjorn3 019564ee0e Statically allocate PCR for the BSP 2025-09-15 22:01:15 +02:00
bjorn3 4884d749af Make PercpuBlock const constructable 2025-09-15 19:00:03 +02:00
bjorn3 3329a41121 Unify set_tss_stack and set_userspace_io_allowed signatures between x86 and x86_64 2025-09-15 18:37:27 +02:00
bjorn3 05e344bd9e Unify tss alignment method between x86 and x86_64 2025-09-15 18:23:29 +02:00
bjorn3 9a14f9a80d Unify gdt handling between x86 and x86_64 2025-09-14 20:30:57 +02:00
bjorn3 d1c7177038 Remove unused macro 2025-09-14 20:21:46 +02:00
bjorn3 200aeac2ba Reduce visibility of a couple of idt things 2025-09-14 19:10:09 +02:00
bjorn3 d3b17177b2 Avoid allocating during panics and infer kernel image size without explicitly storing it 2025-09-14 13:11:13 +02:00
bjorn3 9f71f02532 Reduce indentation in stack_trace 2025-09-13 21:34:02 +02:00
bjorn3 6334977090 Inline symbol_trace into strack_trace 2025-09-13 21:34:02 +02:00
bjorn3 30bbafdfa4 Use the object crate for panic backtraces
This increases the kernel image size by about 16kb, but in return
significantly simplifies things.
2025-09-13 21:34:02 +02:00
bjorn3 ad4ea619e8 Fix interrupt race condition on arm64 and riscv64 2025-09-13 20:29:32 +02:00
bjorn3 9e37ccaae8 Fix enable_and_halt on arm64
I accidentally used nop instead of wfi
2025-09-13 19:07:01 +02:00
bjorn3 83b4538d7c Merge two asm blocks
There is no guarantee they will be atomic otherwise
2025-09-13 18:55:16 +02:00
bjorn3 61db2b2ad5 Use core::hint::spin_loop() where possible 2025-09-13 18:55:16 +02:00
bjorn3 711ea9a4ed Move system76_ec::init() into serial::init() 2025-09-13 18:55:16 +02:00
bjorn3 5a6117b5ae Replace the log crate with a custom logging system
This avoids the need to explicitly set a logger early during boot, which
reduces the amount of moving parts that could go wrong slightly. And it
cuts the kernel image size by 13kb.
2025-09-13 18:55:16 +02:00
Jeremy Soller 8a2aa411e2 Explicitly scope all locks, fixing multi_core hangs. Allow contexts on any CPU 2025-09-13 10:10:07 -06:00
bjorn3 da6f7adb42 Use HashMap rather than BTreeMap for scheme handles
According to the comments this previously wasn't done due to hashbrown
not having a const constructor. While it is true that HashMap::new() is
not const, HashMap::with_hasher() is const. HashMap::new() becoming
const is likely blocked on const traits.

This shrinks the kernel image by about 35kb.
2025-09-13 12:00:37 +02:00
bjorn3 9aef07372e Make insert_global panic on errors
All callers unwrap the result anyway
2025-09-12 19:56:14 +02:00
bjorn3 6ae6f571c7 Use cfg!() rather than #[cfg] for configuring lpss_debug 2025-09-12 19:36:17 +02:00
bjorn3 92e5397efa Introduce SerialKind::NotPresent 2025-09-12 19:36:17 +02:00
bjorn3 2394db2dc5 Move most of the arch debug::Writer impls into a common location 2025-09-12 19:36:17 +02:00
bjorn3 fbbe24c82b Use writeln!() rather than print!() + concat!() in println!()
This fixes using format arg captures
2025-09-12 19:36:17 +02:00
bjorn3 b3522b19e6 Replace a writeln!() with println!() 2025-09-12 19:36:16 +02:00
bjorn3 a782c1f9e1 Fix warning about unused function 2025-09-12 19:03:39 +02:00
bjorn3 8aa08e1e3d Unconditionally enable serial_debug on arm64 and riscv64 2025-09-12 18:59:48 +02:00
bjorn3 520453f779 Move x86 serial port assignment to the init function 2025-09-12 18:46:11 +02:00
bjorn3 31cbb3b361 Remove duplicate serial port initialization on x86 2025-09-12 18:41:42 +02:00
bjorn3 7a4dd1a1a9 Use SerialKind on x86 2025-09-12 18:40:21 +02:00
bjorn3 f0eea47896 Fix compilation with lpss_debug feature enabled 2025-09-12 18:33:16 +02:00
bjorn3 eb06f5676f Unify SerialKind between arm64 and riscv64 2025-09-12 18:19:15 +02:00
bjorn3 6ca9a9a806 Move uart_pl011.rs to src/devices 2025-09-12 18:02:30 +02:00
bjorn3 f9a4178898 Always enable graphical_debug
We already gracefully handle a missing framebuffer.
2025-09-11 21:41:30 +02:00
bjorn3 9a2203076a Merge aarch64 and x86/x86_64 debugger implementations
And make the debugger partially work on riscv64.
2025-09-11 20:02:56 +02:00
bjorn3 e131bf219d Merge x86 and x86_64 debugger implementations 2025-09-11 20:02:56 +02:00
bjorn3 d1668e232a Begin deduplicating debugger code between architectures 2025-09-11 20:02:56 +02:00
bjorn3 40605e643e Move stac/clac for SMAP in debugger to just around the stack read loop
This fixes a crash when returning from the debugger on x86_64.
2025-09-11 20:02:56 +02:00
bjorn3 26dd87b1ff Fix debugger feature on arm64
And fix unsafe_op_in_unsafe_fn warnings
2025-09-11 20:02:56 +02:00
bjorn3 38188b0640 Expand a macro invocation 2025-09-10 18:45:13 +02:00
bjorn3 786c9eabcb Share print! and println! between architectures 2025-09-10 18:40:30 +02:00