[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu-devel] [PATCH 11/13] target/arm: Add v8M stack chec
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-arm] [Qemu-devel] [PATCH 11/13] target/arm: Add v8M stack checks for Thumb push/pop |
Date: |
Wed, 3 Oct 2018 11:20:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 02/10/2018 18:35, Peter Maydell wrote:
> Add v8M stack checks for the 16-bit Thumb push/pop
> encodings: STMDB, STMFD, LDM, LDMIA, LDMFD.
>
> Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> target/arm/translate.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index 65df8d6975c..ef64d2559de 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
> @@ -12251,7 +12251,10 @@ static void disas_thumb_insn(DisasContext *s,
> uint32_t insn)
> store_reg(s, rd, tmp);
> break;
> case 4: case 5: case 0xc: case 0xd:
> - /* push/pop */
> + /*
> + * 0b1011_x10x_xxxx_xxxx
> + * - push/pop
> + */
> addr = load_reg(s, 13);
> if (insn & (1 << 8))
> offset = 4;
> @@ -12264,6 +12267,17 @@ static void disas_thumb_insn(DisasContext *s,
> uint32_t insn)
> if ((insn & (1 << 11)) == 0) {
> tcg_gen_addi_i32(addr, addr, -offset);
> }
> +
> + if (s->v8m_stackcheck) {
> + /*
> + * Here 'addr' is the lower of "old SP" and "new SP";
> + * if this is a pop that starts below the limit and ends
> + * above it, it is UNKNOWN whether the limit check triggers;
> + * we choose to trigger.
> + */
> + gen_helper_v8m_stackcheck(cpu_env, addr);
> + }
> +
> for (i = 0; i < 8; i++) {
> if (insn & (1 << i)) {
> if (insn & (1 << 11)) {
>
- [Qemu-arm] [PATCH 07/13] target/arm: Add v8M stack limit checks on NS function calls, (continued)
- [Qemu-arm] [PATCH 07/13] target/arm: Add v8M stack limit checks on NS function calls, Peter Maydell, 2018/10/02
- [Qemu-arm] [PATCH 08/13] target/arm: Add v8M stack checks for LDRD/STRD (imm), Peter Maydell, 2018/10/02
- [Qemu-arm] [PATCH 10/13] target/arm: Add v8M stack checks for T32 load/store single, Peter Maydell, 2018/10/02
- [Qemu-arm] [PATCH 11/13] target/arm: Add v8M stack checks for Thumb push/pop, Peter Maydell, 2018/10/02
- [Qemu-arm] [PATCH 13/13] target/arm: Add v8M stack checks for MSR to SP_NS, Peter Maydell, 2018/10/02
- [Qemu-arm] [PATCH 12/13] target/arm: Add v8M stack checks for VLDM/VSTM, Peter Maydell, 2018/10/02