Travis Geiselbrecht
6747010a5c
[arch][arm64] restructure some start.S to allow KERNEL_VM and WITH_SMP
...
Currently only supports both set at the same time, but rearrange their
order such that theoretically both are pretty independent.
Somewhat untested in that there's no configuration for !KERNEL_VM and
WITH_SMP, but at least allows that config to be tested.
2025-01-11 17:12:16 -08:00
Travis Geiselbrecht
538f32e09d
[arch][arm64] make sure SPSel is set to SP_ELx at boot
...
Just a safety check, has not been a problem in general, but pulled from
a similar trusty change.
2025-01-11 17:11:27 -08:00
Travis Geiselbrecht
0ac7a2d7cb
[kernel][mp] use proper types when computing idle and active cpus
...
Also return a proper bool instead of an int. No functional change.
2025-01-11 16:59:42 -08:00
Travis Geiselbrecht
6d9a0b5c35
[libc][printf] Handle case where snprintf underflows for len = 0
...
The code would write a null pointer always, even if len = 0, or if the
buffer pointer is null.
Test for this condition and add a unit test.
fixes #407
2025-01-09 23:32:56 -08:00
Alexander Richardson
e7b71623c4
Document how to use clang in README
...
Fixes: https://github.com/littlekernel/lk/issues/426
2025-01-09 19:52:18 -08:00
Travis Geiselbrecht
f9a5a16db5
Merge pull request #429 from zhangxp1998/gbl
...
Add block IO protocol to UEFI loader
2025-01-09 19:49:49 -08:00
Kelvin Zhang
5c066ae52c
[app][uefi] Implement GLB fdt fixiup protocol
2025-01-08 09:54:00 -08:00
Kelvin Zhang
0c1cb6bf03
[app][uefi] Add block device protocol
2025-01-08 09:54:00 -08:00
Kelvin Zhang
1103fd5575
[app][uefi] Pass DTB to linux kernel
2025-01-08 09:53:59 -08:00
Alex Richardson
0fd355ea4b
dlmalloc: fix -Wstrict-prototypes warning
2025-01-07 22:28:07 -08:00
Alex Richardson
d22534704d
pci: remove write-only variable
...
This is not used anywhere so just drop it.
2025-01-07 22:28:07 -08:00
Alex Richardson
d673d211eb
riscv: add missing stdint.h include
...
While this is currently pulled in transitively, uint32_t is defined there
and we should explicitly include the appropriate header.
2025-01-07 22:28:07 -08:00
Alex Richardson
22ae6b6cea
riscv: ensure arguments to __ASM_STR() are expanded first
...
Right now this does not cause any issues, but I had a local change where
missing expansion resulted in compilation errors when reading CSRs.
2025-01-07 22:28:07 -08:00
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
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
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