Skip to content

Commit

Permalink
client: Load initramdisk location
Browse files Browse the repository at this point in the history
For ages both vmlinux and zImage accepted the initramdisk location
in r3/r4 [1] [2]. If r3==r4==0, vmlinux looks at the device tree for
/chosen/linux,initrd-{start|end} but zImage does not so the QEMU user
can only pass vmlinux via -kernel if -initrd is passed as well.

This initializes r3/r4 to point to the initramdisk location when present.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/kernel/prom_init.c?h=v5.3#n3230
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/boot/of.c?h=v5.3#n89

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v2:
* improved readability
  • Loading branch information
aik committed Nov 11, 2019
1 parent 73dea09 commit f9661a2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions slof/fs/client.fs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ VARIABLE client-callback \ Address of client's callback function
>r ciregs >r7 ! ciregs >r6 ! client-entry-point @ ciregs >r5 !
\ Initialise client-stack-pointer
cistack ciregs >r1 !

s" linux,initrd-end" get-chosen IF decode-int nip nip ELSE 0 THEN
s" linux,initrd-start" get-chosen IF decode-int nip nip ELSE 0 THEN
( end start )
tuck - ( start len )
ciregs >r4 !
ciregs >r3 !

\ jump-client maps to call_client in slof/entry.S
\ When jump-client returns, R3 holds the address of a NUL-terminated string
\ that holds the client interface word the client wants to call, R4 holds
Expand Down

0 comments on commit f9661a2

Please sign in to comment.