Commit Graph

2814 Commits

Author SHA1 Message Date
Alex Richardson
829fdfa264 libcpp: fix deprecated builtin warning with clang 2025-01-07 22:28:07 -08:00
Alex Richardson
9241c78667 riscv: Add missing parens around macro argument
This triggered a out of range count overflow warning when
building for RV32 (calling the macro with `ticks >> 32`)
since the truncation happened before the shift.
2025-01-07 22:28:07 -08:00
Travis Geiselbrecht
164f9fa47e WIP working with lapic to trigger a timer 2025-01-03 20:54:30 -08:00
Noah Woo
bea3787d6e [kernel][port] add a missing THREAD_UNLOCK call in port_group_remove()
port_group_remove() used to return without unlocking a thread if no
matching read port is found, which is not correct. This patch adds a
call to THREAD_UNLOCK before it returns ERR_BAD_HANDLE.
2025-01-03 20:52:08 -08:00
Travis Geiselbrecht
d1a332891c [arch][x86] add x2apic mode to the local apic driver
Fill in some more x86 feature bits while at it.
2024-12-17 23:57:56 -08:00
Travis Geiselbrecht
6b89609887 WIP x86-64 SMP: get the 64bit secondaries fully started
Rearrange some of the cpu initialization code to be runnable on each cpu
as they come up. Complete the 64bit bootstrap mechanism and call into C
code.

Makes it as far as trying to reschedule via an IPI. Need to implement
local apic based IPI mechanism.
2024-12-13 00:21:16 -08:00
Travis Geiselbrecht
3ea007a237 [arch][x86] split the single GDT.S into two separate ones per subarch
It's getting too hard to maintain a single layout that works with both,
so go ahead and split it. Also redo the layout so it should be usable
with user space and syscall and sysenter instructions from either mode.
2024-12-12 22:23:50 -08:00
Travis Geiselbrecht
6538baea70 WIP x86-smp
add uspace mmu support for x86-64
trampoline x86-64 cpus to long mode and into the kernel aspace
2024-12-11 00:19:57 -08:00
Travis Geiselbrecht
1ca821ec54 WIP x86-smp squelch some warnings in no smp mode 2024-12-06 23:44:19 -08:00
Travis Geiselbrecht
1afb5d7a66 WIP x86 smp: start the framework for detecting and starting secondary cores 2024-12-06 23:40:26 -08:00
Travis Geiselbrecht
181796e843 WIP x86 get x86-32 working with a per-cpu gs: segment register for the kernel 2024-12-06 22:30:48 -08:00
Travis Geiselbrecht
902e2fcb8a WIP set up per cpu structures for x86-64
only on the boot cpu for now
2024-12-06 21:11:51 -08:00
Travis Geiselbrecht
fd79fccdde WIP x86 SMP 2024-12-06 00:03:48 -08:00
Travis Geiselbrecht
6f32a0f377 [arch][riscv] use newly discovered pseudo-instructions for load/stores
I hadn't noticed this before, but you can directly reference a global
variable in a load/store in assembly, which combines a lla + ld/sd into
a 2 instruction pair instead of 3 due to the 12 bit offset provided in
the load/store.
2024-11-27 21:53:29 -08:00
Travis Geiselbrecht
77eb84d152 [arch][x86] a few little tweaks while looking at some older code 2024-11-27 21:34:05 -08:00
Travis Geiselbrecht
adde2d64ba [clang-tidy] turn off the no-recursion complaint
I get the sentiment but I think it's just a bridge too far.
2024-11-27 21:33:31 -08:00
Travis Geiselbrecht
2ca679aeca [arch][riscv][asm] use the call pseudoinstruction instead of jal
This fixes a problem if the text segment gets larger than ~1MB where the
raw jal instruction cannot reach. Using 'call' or 'tail' allows the
assembler to emit a 2 instruction sequence that the linker later
relaxes if it can.
2024-11-14 19:33:46 -08:00
Travis Geiselbrecht
52fa818e21 [arch][arm64] remove an unnecessary call to arm64_el3_to_el1
The existing arm64_elx_to_el1 already handles dropping the primary and
any secondary cpu down to el1 by the time this code path is reached.
2024-11-10 03:39:34 +00:00
Travis Geiselbrecht
6e39e5674c [arch][arm64] Make sure mpidr_el1 and mipr_el1 is configured
When dropping from EL2 (or EL3), load vmpidr_el2 and vpidr_el2 with the
correct values to make sure EL1 sees the 'real' mpidr_el1 and midr_el1.

Though in most cases they're already configured by whatever firmware ran
before, there's no actual guarantee that it is, and it may be full of
random garbage.
2024-11-10 03:31:23 +00:00
Travis Geiselbrecht
98a5703451 [github][ci][clang] add clang 16, 17, 18 to the list 2024-11-07 08:44:27 +00:00
Travis Geiselbrecht
d1579678ab [github][ci] use apt-get to fetch clang to remove a warning 2024-11-07 08:44:27 +00:00
Travis Geiselbrecht
4102844048 [arm64][fpu] add fp arch extension around inline fpu asm
This quiets warnings on clang 18 about the missing fp arch extension
feature when using fp instructions.
2024-11-07 08:44:27 +00:00
Travis Geiselbrecht
afa56793d8 Merge pull request #423 from zhangxp1998/dev
Implement bulk of UEFI protocol needed by linux kernel
2024-11-07 00:10:35 -08:00
Kelvin Zhang
649d432b8a Move UEFI header files into private include namespace
This help reduce the risk of name collision. As MODULE_DIR/include is
automatically added to global includes.
2024-11-06 10:12:17 -08:00
Kelvin Zhang
0d8a1ec055 [app][uefi] Make allocate_pool return identity mapped memory 2024-11-06 10:12:17 -08:00
Kelvin Zhang
1249e8a03b [app][uefi] Add configuration table 2024-11-06 10:12:17 -08:00
Kelvin Zhang
7d77e28430 [app][uefi] Enable mspace feature on dlmalloc
This allows us to use an identitiy mapped piece of memory as the heap
for UEFI app. UEFI app's allocation would go from this heap.
2024-11-06 10:12:17 -08:00
Kelvin Zhang
763ff7ce70 [app][uefi] Call kernel at an identity mapped stack 2024-11-06 10:12:17 -08:00
Kelvin Zhang
347db09959 [app][uefi] Place linux kernel at identity mapped virtual memory addresses 2024-11-06 10:12:17 -08:00
Kelvin Zhang
253e3099ec [app][uefi] Add relocation support for UEFI binary 2024-11-06 10:12:17 -08:00
Kelvin Zhang
6a37823f71 [app][uefi] Add runtime service support 2024-11-06 10:12:17 -08:00
Kelvin Zhang
9fc4532ad7 [app][uefi] Imlement get_memory_map UEFI protocol 2024-11-06 10:12:16 -08:00
Kelvin Zhang
5ea19f1b0a [app][uefi] Setup skeleton for UEFI boot service 2024-11-06 10:12:16 -08:00
Kelvin Zhang
6b903f480c [git] Ignore common linux build files, update README 2024-11-06 10:12:15 -08:00
Travis Geiselbrecht
dbef9ff15d [platform][qemu-m68k] expand the bootinfo parsing code
Break into a separate .c file.
2024-09-07 15:13:20 -07:00
Travis Geiselbrecht
d9362e4dd5 [arch][arm] update stackusage script for python3
The old regexp needed to be updated to remove a warning.
2024-09-07 21:28:08 +00:00
Joshua Seaton
7538a6df67 [git] Sort .gitignore 2024-08-12 17:05:34 -07:00
Joshua Seaton
1b2c449ceb [scripts] Introduce scripts/fetch-toolchains.py
This change introduces $LK_ROOT/toolchain as an official installation
directory for toolchains, as well as a new script for conveniently
installing them there (versus manual GETs + untarring).

getting_started.md is updated to suggest its use.
2024-08-11 22:40:14 -07:00
Travis Geiselbrecht
6f24850de8 [dev][arm-generic-timer] print initialization configuration
This may be unsafe if the platform hasn't initialized a uart or console
by the time this is run. May need to revert or change this if it's an
issue.
2024-08-11 12:18:32 -07:00
Travis Geiselbrecht
84053e4cde [platform][qemu-virt-arm] move uart initialization first
It should be safe to do this since the uart does not use the gic or
timers. This will allow printing from the gic or timer driver.
2024-08-11 12:16:18 -07:00
Travis Geiselbrecht
fdf48a80c8 [scripts][do-qemuarm] add support for using HVF on mac
Detect if it's being run on a darwin host and try to use HVF if the -k
switch is passed.
2024-08-11 12:06:54 -07:00
Travis Geiselbrecht
80e36e4925 [platform][qemu-arm] switch to using the virtual timer interrupt
On mac qemu, trying to use the physical timer does not seem to work, but
really the virtual timer is what you should be using most of the time,
especially when running under emulation.
2024-08-11 12:01:39 -07:00
Travis Geiselbrecht
baaa474628 [console][help] dont print command blocks if no commands are available
When in crash mode, a lot of the commands are unavailable, so delay
printing the command block header until the first unmasked command is
printed.
2024-08-09 19:50:27 -07:00
Travis Geiselbrecht
a7116b18ed [docs] Update getting_started.md with new toolchain path 2024-08-09 19:46:39 -07:00
Joshua Seaton
f10d685722 [console] List commands alphabetically by name in normal mode
This change updates the `help` console command to list the available
commands alphabetically, but only when we're not panicking. This makes
`help`'s helping more helpful.
2024-08-09 19:41:54 -07:00
Travis Geiselbrecht
3579bf2545 [gitignore] add a few more files to .gitignore 2024-08-09 19:31:49 -07:00
Travis Geiselbrecht
e03d4196a3 [platform][halt] refactor the default halt/reboot/shutdown logic
Move common logic into a default routine in platform/power that other
platforms can reuse to implement the general default shutdown logic.
Add helper routines to print the cause.
Refactor the platforms that had substantial halt logic to reuse the
default implementation.
2024-08-09 19:30:20 -07:00
Travis Geiselbrecht
6fd2626359 [dev][uart][pl011] switch configuration to a structure
This should be a bit easier to deal with going forward.
2024-08-09 18:20:30 -07:00
Travis Geiselbrecht
21bc71d8a2 [dev][uart][pl011] add defines for the bits that are used 2024-08-09 18:05:35 -07:00
Travis Geiselbrecht
51bcea6525 [dev][uart][pl011] have the uart be data driven
Initialize the uart by passing in the base and irq, as well as a flag
specifying if it's the debug uart and should directly put data into the
console buffer (if present).
2024-08-09 18:05:35 -07:00