mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
baremetal: working aarch64 svc example adapted from takeharukato
Not yet generalized for usage on multiple files.
This commit is contained in:
17
README.adoc
17
README.adoc
@@ -8967,7 +8967,13 @@ less "$(./getvar --arch aarch64 run_dir)/trace.txt"
|
||||
Output the trace to stdout instead of a file:
|
||||
|
||||
....
|
||||
./run --arch aarch64 --eval 'm5 exit' --emulator gem5 --trace Exec --trace-stdout
|
||||
./run \
|
||||
--arch aarch64 \
|
||||
--emulator gem5 \
|
||||
--eval 'm5 exit' \
|
||||
--trace Exec \
|
||||
--trace-stdout \
|
||||
;
|
||||
....
|
||||
|
||||
This would produce a lot of output however, so you will likely not want that when tracing a Linux kernel boot instructions. But it can be very convenient for smaller traces.
|
||||
@@ -11201,6 +11207,14 @@ output:
|
||||
|
||||
Setup a handler for `svc`, do an `svc`, and observe that the handler got called and returned:
|
||||
|
||||
....
|
||||
./run --arch aarch64 --baremetal arch/aarch64/svc_asm
|
||||
....
|
||||
|
||||
Source: link:baremetal/arch/aarch64/svc_asm.S[]
|
||||
|
||||
TODO: factor out the above, and make it also work on C:
|
||||
|
||||
....
|
||||
./run --arch aarch64 --baremetal arch/aarch64/svc
|
||||
....
|
||||
@@ -11261,6 +11275,7 @@ This reset value is defined `UNKNOWN` by <<armarm8>> D10.2.116 "VBAR_EL1, Vector
|
||||
|
||||
Bibliography:
|
||||
|
||||
* https://github.com/torvalds/linux/blob/v4.20/arch/arm64/kernel/entry.S#L430 this is where the kernel defines the vector table
|
||||
* https://github.com/dwelch67/qemu_arm_samples/tree/07162ba087111e0df3f44fd857d1b4e82458a56d/swi01
|
||||
* https://github.com/NienfengYao/armv8-bare-metal/blob/572c6f95880e70aa92fe9fed4b8ad7697082a764/vector.S#L168
|
||||
* https://stackoverflow.com/questions/51094092/how-to-make-timer-irq-work-on-qemu-machine-virt-cpu-cortex-a57
|
||||
|
||||
Reference in New Issue
Block a user