mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 14:35:34 +00:00
target/arm: Diagnose base == pc for LDM/STM
We have been using store_reg and not store_reg_for_load when writing back a loaded value into the base register. At first glance this is incorrect when base == pc, however that case is UNPREDICTABLE. Backports commit b0e382b8cf365fed8b8c43482029ac7655961a85 from qemu
This commit is contained in:
parent
1a0986ee25
commit
ed9b8ad2ea
|
@ -10196,7 +10196,7 @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n)
|
||||||
|
|
||||||
list = a->list;
|
list = a->list;
|
||||||
n = ctpop16(list);
|
n = ctpop16(list);
|
||||||
if (n < min_n) {
|
if (n < min_n || a->rn == 15) {
|
||||||
unallocated_encoding(s);
|
unallocated_encoding(s);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -10277,7 +10277,7 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n)
|
||||||
|
|
||||||
list = a->list;
|
list = a->list;
|
||||||
n = ctpop16(list);
|
n = ctpop16(list);
|
||||||
if (n < min_n) {
|
if (n < min_n || a->rn == 15) {
|
||||||
unallocated_encoding(s);
|
unallocated_encoding(s);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -10317,6 +10317,7 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n)
|
||||||
op_addr_block_post(s, a, addr, n);
|
op_addr_block_post(s, a, addr, n);
|
||||||
|
|
||||||
if (loaded_base) {
|
if (loaded_base) {
|
||||||
|
/* Note that we reject base == pc above. */
|
||||||
store_reg(s, a->rn, loaded_var);
|
store_reg(s, a->rn, loaded_var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue