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
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
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
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
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
b3522b19e6
Replace a writeln!() with println!()
2025-09-12 19:36:16 +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
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
bjorn3
1268472103
Move arch::x86_64::cpuid into arch::x86_shared::cpuid
2025-09-10 18:35:36 +02:00
bjorn3
ad6c6c5e41
Share external interrupt handlers between x86 and x86_64
2025-09-10 18:31:28 +02:00
bjorn3
5e6d681fcb
Share exception interrupt handlers between x86 and x86_64
2025-09-10 18:25:22 +02:00
bjorn3
d6c5d0d268
Move semicolons
2025-09-10 18:25:09 +02:00
bjorn3
a3700fa446
Remove the unsafe block from the inner function in interrupt!()
2025-09-10 18:00:02 +02:00
bjorn3
fe1c2f460e
Fix a bunch of errors and warnings after moving to the 2024 edition
2025-09-10 16:44:36 +02:00
bjorn3
cea93f7647
cargo fix --edition & rustfmt
...
Or to be precise:
RUST_TARGET_PATH=$(pwd)/targets cargo fix --edition \
--target targets/x86_64-unknown-kernel.json \
--target targets/i686-unknown-kernel.json \
--target targets/aarch64-unknown-kernel.json \
--target targets/riscv64-unknown-kernel.json \
-Zbuild-std=core,alloc --allow-dirty --bin kernel
cargo fmt
2025-09-10 16:44:36 +02:00
Jeremy Soller
53c3342e9f
snps,dw-apb-uart is usually 32-bit mmio
2025-09-07 20:41:28 -06:00
Jeremy Soller
f1492729d2
riscv64: support snps,dw-apb-uart serial
2025-09-07 20:36:05 -06:00
bjorn3
fefede0d67
Use cfg!() rather than #[cfg] for controlling self_modifying
2025-09-07 12:30:33 +02:00
bjorn3
b5822ac118
Mostly use cfg!() rather than #[cfg] for controlling sys_stat
...
This only adds 48 bytes overhead per cpu core in the PerCpuBlock struct.
Also fixes compilation with sys_stat enabled on x86_64.
2025-09-07 12:27:04 +02:00
bjorn3
f05be85966
Use cfg!() rather than #[cfg] for controlling multi_core
2025-09-07 12:02:16 +02:00
bjorn3
d6e9022c4a
Rustfmt
2025-09-06 17:10:32 +02:00
bjorn3
cf019ab9a5
Remove some unused unsafe blocks
2025-09-06 16:51:05 +02:00