r12 and x16 are of different sizes; when passing r12 as a reference to
do_trap_hypercall on arm64, we end up dereferencing it as a pointer to a
64bit value, but actually it isn't.
Instead, use a temporary variable to pass r12, and write back the result
after the call to do_trap_hypercall.
CID:
1457708
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
do_trap_smc(regs, hsr);
break;
case HSR_EC_HVC32:
+ {
+ register_t nr;
+
GUEST_BUG_ON(!psr_mode_is_32bit(regs->cpsr));
perfc_incr(trap_hvc32);
#ifndef NDEBUG
#endif
if ( hsr.iss == 0 )
return do_trap_hvc_smccc(regs);
- do_trap_hypercall(regs, (register_t *)®s->r12, hsr.iss);
+ nr = regs->r12;
+ do_trap_hypercall(regs, &nr, hsr.iss);
+ regs->r12 = (uint32_t)nr;
break;
+ }
#ifdef CONFIG_ARM_64
case HSR_EC_HVC64:
GUEST_BUG_ON(psr_mode_is_32bit(regs->cpsr));