Per the SMCCC specification (see section 3.1 in ARM DEN 0028D), the
function identifier is only stored in the least significant 32-bits.
The most significant 32-bits should be ignored.
Signed-off-by: Roman Skakun <roman_skakun@epam.com>
Acked-by: Volodymyr Babchyk <volodymyr_babchuk@epam.com>
[jgrall: Reword the commit message and comment]
Acked-by: Julien Grall <jgrall@amazon.com>
if ( !ctx )
return false;
- switch ( get_user_reg(regs, 0) )
+ /*
+ * The function identifier is always stored in the least significant
+ * 32-bit (see section ARM DEN 0028D).
+ */
+ switch ( (uint32_t)get_user_reg(regs, 0) )
{
case OPTEE_SMC_CALLS_COUNT:
set_user_reg(regs, 0, OPTEE_MEDIATOR_SMC_COUNT);