[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu-devel] [PATCH 08/13] target/arm: Add v8M stack chec
From: |
Richard Henderson |
Subject: |
Re: [Qemu-arm] [Qemu-devel] [PATCH 08/13] target/arm: Add v8M stack checks for LDRD/STRD (imm) |
Date: |
Wed, 3 Oct 2018 15:16:37 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 10/2/18 11:35 AM, Peter Maydell wrote:
> Add the v8M stack checks for:
> * LDRD (immediate)
> * STRD (immediate)
>
> Loads and stores are more complicated than ADD/SUB/MOV, because we
> must ensure that memory accesses below the stack limit are not
> performed, so we can't simply do the check when we actually update
> SP.
>
> For these instructions, if the stack limit check triggers
> we must not:
> * perform any memory access below the SP limit
> * update PC, SP or the load/store base register
> but it is IMPDEF whether we:
> * perform any accesses above or equal to the SP limit
> * update destination registers for loads
>
> For QEMU we choose to always check the limit before doing any other
> part of the load or store, so we won't update any registers or
> perform any memory accesses.
>
> It is UNKNOWN whether the limit check triggers for a load or store
> where the initial SP value is below the limit and one of the stores
> would be below the limit, but the writeback moves SP to above the
> limit. For QEMU we choose to trigger the check in this situation.
>
> Note that limit checks happen only for loads and stores which update
> SP via writeback; they do not happen for loads and stores which
> simply use SP as a base register.
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> target/arm/translate.c | 27 +++++++++++++++++++++++++--
> 1 file changed, 25 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <address@hidden>
r~
- Re: [Qemu-arm] [Qemu-devel] [PATCH 06/13] target/arm: Add v8M stack checks on exception entry, (continued)
- [Qemu-arm] [PATCH 09/13] target/arm: Add v8M stack checks for Thumb2 LDM/STM, Peter Maydell, 2018/10/02
- [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