Skip to content

Commit

Permalink
HVF: advance ELR_EL2 upon trapped SMC call
Browse files Browse the repository at this point in the history
Trapped SMC has a different preferred return path, so ELR_EL2 should be advanced by 4 anyway.
  • Loading branch information
imbushuo authored and osy committed Dec 1, 2020
1 parent 7c9ec50 commit fdf5bd6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion target/arm/hvf/hvf.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,18 @@ int hvf_vcpu_exec(CPUState *cpu)
} else {
DPRINTF("unknown SMC! %016llx", env->xregs[0]);
env->xregs[0] = -1;
env->pc += 4;
}
/*
* Unlike HVC that automatically advances ELR_EL2 to the next
* instruction upon exception entry, trapped SMC has a different
* preferred return path, so ELR_EL2 should be advanced by 4
* anyway.
*
* Apple Silicon does not implement EL3 yet, so SMC trap behavior
* is implementation defined according to the spec.
* But at least this works on M1.
*/
env->pc += 4;
qemu_mutex_unlock_iothread();
break;
default:
Expand Down

0 comments on commit fdf5bd6

Please sign in to comment.