[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 09/10] target/arm: Implement AArch32 ERET instru
From: |
Luc Michel |
Subject: |
Re: [Qemu-devel] [PATCH 09/10] target/arm: Implement AArch32 ERET instruction |
Date: |
Thu, 16 Aug 2018 10:10:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 8/14/18 2:42 PM, Peter Maydell wrote:
> ARMv7VE introduced the ERET instruction, which is necessary to
> return from an exception taken to Hyp mode. Implement this.
> In A32 encoding it is a completely new encoding; in T32 it
> is an adjustment of the behaviour of the existing
> "SUBS PC, LR, #<imm8>" instruction.
>
> Signed-off-by: Peter Maydell <address@hidden>
Reviewed-By: Luc Michel <address@hidden>
> ---
> target/arm/translate.c | 31 +++++++++++++++++++++++++++++--
> 1 file changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index 3f5751d4826..5ecc24f12fb 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
> @@ -8887,6 +8887,25 @@ static void disas_arm_insn(DisasContext *s, unsigned
> int insn)
> tcg_temp_free_i32(tmp2);
> store_reg(s, rd, tmp);
> break;
> + case 0x6: /* ERET */
> + if (op1 != 3) {
> + goto illegal_op;
> + }
> + if (!arm_dc_feature(s, ARM_FEATURE_V7VE)) {
> + goto illegal_op;
> + }
> + if ((insn & 0x000fff0f) != 0x0000000e) {
> + /* UNPREDICTABLE; we choose to UNDEF */
> + goto illegal_op;
> + }
> +
> + if (s->current_el == 2) {
> + tmp = load_cpu_field(elr_el[2]);
> + } else {
> + tmp = load_reg(s, 14);
> + }
> + gen_exception_return(s, tmp);
> + break;
> case 7:
> {
> int imm16 = extract32(insn, 0, 4) | (extract32(insn, 8, 12) <<
> 4);
> @@ -11144,8 +11163,16 @@ static void disas_thumb2_insn(DisasContext *s,
> uint32_t insn)
> if (rn != 14 || rd != 15) {
> goto illegal_op;
> }
> - tmp = load_reg(s, rn);
> - tcg_gen_subi_i32(tmp, tmp, insn & 0xff);
> + if (s->current_el == 2) {
> + /* ERET from Hyp uses ELR_Hyp, not LR */
> + if (insn & 0xff) {
> + goto illegal_op;
> + }
> + tmp = load_cpu_field(elr_el[2]);
> + } else {
> + tmp = load_reg(s, rn);
> + tcg_gen_subi_i32(tmp, tmp, insn & 0xff);
> + }
> gen_exception_return(s, tmp);
> break;
> case 6: /* MRS */
>
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 02/10] target/arm: Add missing .cp = 15 to HMAIR1 and HAMAIR1 regdefs, (continued)
- [Qemu-devel] [PATCH 02/10] target/arm: Add missing .cp = 15 to HMAIR1 and HAMAIR1 regdefs, Peter Maydell, 2018/08/14
- [Qemu-devel] [PATCH 07/10] target/arm: Implement ESR_EL2/HSR for AArch32 and no-EL2, Peter Maydell, 2018/08/14
- [Qemu-devel] [PATCH 05/10] target/arm: Implement AArch32 HCR and HCR2, Peter Maydell, 2018/08/14
- [Qemu-devel] [PATCH 09/10] target/arm: Implement AArch32 ERET instruction, Peter Maydell, 2018/08/14
- [Qemu-devel] [PATCH 03/10] target/arm: Implement RAZ/WI HACTLR2, Peter Maydell, 2018/08/14
- [Qemu-devel] [PATCH 01/10] target/arm: Correct typo in HAMAIR1 regdef name, Peter Maydell, 2018/08/14
- [Qemu-devel] [PATCH 10/10] target/arm: Implement support for taking exceptions to Hyp mode, Peter Maydell, 2018/08/14
- Re: [Qemu-devel] [PATCH 00/10] target/arm: Some pieces of support for 32-bit Hyp mode, Edgar E. Iglesias, 2018/08/15