[PATCH] ARM: EXYNOS: Add smc call to support trustzone feature

Russell King - ARM Linux linux at arm.linux.org.uk
Mon Jun 11 05:44:23 EDT 2012


On Mon, Jun 11, 2012 at 06:04:40PM +0900, Kyungmin Park wrote:
> +/*
> + * Read registers
> + * Function signature: u32 exynos_smc_readsfr(u32 addr, u32 *val)

What address space is 'addr' in?

> + */
> +ENTRY(exynos_smc_readsfr)
> +	stmfd	sp!, {r4-r11, lr}
> +	mov	r2, #0
> +	lsr	r0, r0, #2
> +	mov	ip, r1
> +	mov	r3, r2
> +	orr	r1, r0, #0xC0000000

I assume this is not PAGE_OFFSET.

> +	mvn	r0, #100

Hmm.  The compiler will automatically use mvn instead of a normal mov with
negative numbers.  It may be clearer to write:

	mov	r0, #-101

> +	dsb
> +	smc	#0
> +	cmn	r0, #101

Same here:
	cmp	r0, #-101

Notice that writing it this way means it's obvious that you're checking
for -101, the original value passed in.

> +	beq	1f
> +	cmp	r0, #0
> +	streq	r2, [ip]
> +	ldmfd	sp!, {r4-r11, pc}
> +1:	subs	r0, r1, #0

Isn't this just a normal:
	movs	r0, r1

?

> +	streq	r2, [ip]
> +	ldmfd	sp!, {r4-r11, pc}
> +ENDPROC(exynos_smc_readsfr)

In any case, can't this end part be written:

	cmp	r0, #-101
	moveq	r0, r1
	teq	r0, #0		@ I prefer teq over cmp to test equality
	streq	r2, [ip]
	ldmfd	sp!, {r4 - r11, pc}



More information about the linux-arm-kernel mailing list