How to access R11 in a module written in C
Dave Higton (1515) 3526 posts |
How does one access R11 as passed to a module, when the module is written in C? The _kernel_swi_regs structure is only 10 elements long, i.e. it only carries R0 to R9. Even David Pilling’s PDumperSP uses r→r11 from a kernel_swi_regs struct in its dumperentry function. When I try to do the same thing, I get a warning “out-of-bound offset 11 in address”. |
Stuart Swales (8827) 1357 posts |
Are you talking about the SWI handler in the module? If using CMHG to generate the module, you get
If you are talking handers called via |
Dave Higton (1515) 3526 posts |
This is a PDumper module, which have a non-standard interface (i.e. they don’t implement SWIs, and are called differently). There is an entry for several functions such as start job, print strip, stop job, etc. They are selected by the number in R11. The source code to David Pilling’s PDumperSP module (“prints” to a sprite) is available from his web site if you’re interested. I’m trying to write a PDumperIPP module, and I’d like it to be in pure C, but it appears to me to be impossible right now. Still, it only needs a simple veneer, so a rebuild for a future 64-bit OS would not be unduly difficult :-) |
Rick Murray (539) 13840 posts |
I can’t imagine that the familiar SWI interface would be retained in a 64 bit world, especially if the OS is written in something other than assembler. So, I wouldn’t worry about that point too much. ;-) |