Can anyone point out if there is any better way to have the following inline assembly block functionally complete where the Arguments are able to be defined as part of the C wrapper and used properly within the Assembly?
I'm wanting to keep
r0-r2,r13 and r31 SYS V4 ABI Reserved
r3-r7 for Function Returns and Arguments
r8-r12 for Polymorph Internal variables
r14-r31 for Plugin Internal variables
I have so far got no reason to see why I can not do this ...
Can anyone point me at further reading for clarifying this please?
The code in question is the following... the arguments to the function can be in r3-r7
as per normal(?to my limited understanding at least?) ... is there anything else I should worry about?
That is what I have for now... but I am wondering if I have anything missing for making sure all the details are dealt with properly
APTR ECALL_ExecOpCode16(USHORT offset, LONG a , LONG b , LONG c , LONG d ) { __asm("lhzu %r8,(%r9);\n\t" // Load the Short to Interpret and update the IXP "addi %r8,%r8,%r3;\n\t" // Add the OpCodeVector Offset "rlwinm %r7,2,%r8,2,18;\n\t" // Multiply and Mask restrict the Offset range "mbar;\n\t" // Force DataCache Sync "lwz %r8,(%r7);\n\t" // What OpCodeVector Address to call? "isync;\n\t" // Instruction Sequence lock "bl (%r8);\n\t" // ECPU OpCodeVector() Execution "mbar;\n\t" // Force DataCache Sync "nop;\n\t" "nop;\n\t" ); return; }