Commit Graph

2797 Commits

Author SHA1 Message Date
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
Travis Geiselbrecht
5fa540dd31 [dev][uart][pl011] first step moving pl011 driver out of qemu-virt-arm
No real functional change, but move the driver implementation out to a
separate place so it can be made to be platform independent.
2024-08-09 18:05:35 -07:00
Travis Geiselbrecht
b236992933 [github][ci] update CI build to ubuntu 24.04
Remove clang-13 from the build list, since it's not present in ubuntu
24.04.

If someone thinks this is an issue, please drop an email and we can see
about adding it back.
2024-08-09 17:57:43 -07:00
Travis Geiselbrecht
6ed970dbb0 [github][ci] bump gcc to 14.2.0 2024-08-09 17:42:45 -07:00
Joshua Seaton
410eaac0c2 [vscode] Update workspace file to better respect local style
This change updates lk.code-workspace to specify
* editor.detectIndentation as false, as otherwise that overrides
  the desired editor.tabSize setting.
* editor.insertSpaces as true, since spaces are preferred over tabs.
* editor.formatOnSave as false for C and C++ files, as - in the absence
  of a .clang-format file - the clangd extension is likely to default to
  choices that don't respect the local style.
2024-08-08 09:53:29 -07:00
Kelvin Zhang
87b7245a6b [github-ci] Add uefi_load unittest to github CI 2024-06-24 14:10:33 -07:00
Travis Geiselbrecht
d1f4b4a546 [target][banana pi f3] quick n dirty port to the bananapi f3 board
A decent 8 core riscv64 board with dual ethernet and 2 or 4GB ram.

Fairly easy to bring up on, though not a lot of docs at the moment.
2024-06-19 16:43:16 -07:00
Travis Geiselbrecht
bd423cad4d [lib][fdtwalk] skip scanning pci busses marked 'disabled' 2024-06-19 16:18:28 -07:00
Travis Geiselbrecht
e3a5f9c363 [lib][fdtwalk] fix some unfound bugs in the riscv isa string detection 2024-06-17 00:45:20 -07:00
Travis Geiselbrecht
e63c132f9c [dev][interrupt][plic] kick the max irqs to 256
Will need to figure out a cleaner way of doing this, but for now just
keep increasing the size.
2024-06-17 00:45:20 -07:00
Travis Geiselbrecht
69b8bccd76 [riscv] switch stimecmp/stimecmph registers to using the raw integer format
Though using the named nmemonics is a generally better idea it has the
unforunate property of not working on older compilers. In this case,
these new registers are for the Sstic extension, which is new enough
that even reasonably recent compilers as GCC 12.1 doesn't understand it.

Fixes issue #410
2024-06-16 22:37:10 -07:00
Travis Geiselbrecht
371a03357a [vscode] some recommended extensions 2024-06-16 22:37:10 -07:00
Travis Geiselbrecht
907d2d5579 [app][uefi] fix warning in uefi code 2024-06-16 22:37:10 -07:00
Travis Geiselbrecht
74864a56c0 [scripts][buildall] catch ctrl-c and abort the script 2024-06-14 15:35:58 -07:00