View Single Post
Old 14 January 2020, 11:17   #7
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,730
Quote:
Originally Posted by Hedeon View Post
Can you confirm i can use any volatile register I want (r3-r12) inside the asm code without trashing stuff?
Using __asm() inside a C function? No. The compiler does not know what happens inside such a block.

Or did you think about calling an assembler function or inline routine? Then yes, the compiler always treats the ABI-defined volatile registers accordingly and may save them before a call. If your function does not use all volatile registers you may specify that with __regsused().

Quote:
And non-volatile (r13-r31) are saved on the stack before jumping to a(n asm) function?
Saving and restoring non-volatile registers is always the duty of the callee, not of the caller.
phx is offline  
 
Page generated in 0.07054 seconds with 11 queries