[OpenBIOS] Q: How to "squeeze" C functions in between two symbols?
agraf at suse.de
Fri Oct 8 14:54:19 CEST 2010
On 08.10.2010, at 14:44, Andreas Färber wrote:
> I've gotten AIX 6/7 to instantiate RTAS (patches upcoming) and would like to trace what it's trying to do. I probably need to implement the display-character token.
As you're running in qemu, the gdbstub is very helpful at times.
> The RTAS code in arch/ppc/qemu/start.S currently looks like this:
> ...and I would like to branch to C code from there.
> Is there a way to have code from, say, rtas.c go between the blr and of_rtas_end symbol?
> Or do I need to move the symbols to the ldscript and place the code in a special section? If yes, how?
Why do you want to have the code in between? You can just branch to the C code:
The only thing you need to make sure is that you follow the ABI :). Input parameters go in r3-rsomething, output is in r3, stack pointer (r1) has to be valid.
Also by only doing the b instead of blr you jump to the C function directly, so a return from there actually returns from the rtas function. If the rtas function follows a different ABI, better set up a stack frame and blr into the C function.
> Those symbols are being used for code size calculation and relocation in arch/ppc/qemu/methods.c.
Maybe I don't really understand the question though.
More information about the OpenBIOS