Can I pass arguments to my new kernel via the UART chainloader #130
-
Hi All, I would like to be able to pass the pointer to the DTB that the RPI4 bootloader passes to the kernel through the UART chainloader. I.E. I would like to be able to do this inside of the chainloader after we've copied the new kernel into memory:
I'm fairly sure I know how to get the pointer into Rust as it is passed to the kernel via the x0 register by the bootloader - however I'm not certain if I can generate an extern "C" function on the RPI4 and what registers the arguments I pass to it will end up in. Does anyone have any knowledge on the calling conventions on the RPI and if I'm making this more complicated than it needs to be? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Your approach should work, |
Beta Was this translation helpful? Give feedback.
-
Great thank you for the quick feedback, always good to know my intuition serves me well - appreciate all the hard work you've put into these tutorials, they have been very useful! |
Beta Was this translation helpful? Give feedback.
Your approach should work,
extern C
will follow the AArch64 calling convention, which means the chainloaded kernel will find dtb_pointer in x0 when it starts to run in its own_start
inboot.s
.