[PATCH] ARM: highbank: Add smc calls to enable/disable the L2

Russell King - ARM Linux linux at arm.linux.org.uk
Tue Jun 5 05:49:54 EDT 2012


On Mon, Jun 04, 2012 at 10:11:40PM -0500, Rob Herring wrote:
> +/*
> + * This is common routine to manage secure monitor API
> + * used to modify the PL310 secure registers.
> + * 'r0' contains the value to be modified and 'r12' contains
> + * the monitor API number. It uses few CPU registers
> + * internally and hence they need be backed up including
> + * link register "lr".
> + * Function signature : void highbank_smc1(u32 fn, u32 arg)
> + */
> +
> +ENTRY(highbank_smc1)
> +	stmfd   sp!, {r2-r12, lr}
> +	mov	r12, r0
> +	mov 	r0, r1
> +	dsb
> +	smc	#0
> +	ldmfd   sp!, {r2-r12, pc}
> +ENDPROC(highbank_smc1)

The ABI.  r0-r3 are used to pass arguments, and _may_ be corrupted by
the called function.  r12 is a temporary register which called functions
may corrupt.  lr is not expected to be preserved.  Everything else must
be preserved.  Return values in r0 and maybe r1.

So.  The registers you must preserve across a function call are r4-r11,
and r13(sp).



More information about the linux-arm-kernel mailing list