Skip to content

Commit 7c69b7c

Browse files
committed
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20181008' into staging
target-arm queue: * target/arm: fix error in a code comment * virt: Suppress external aborts on virt-2.10 and earlier * target/arm: Correct condition for v8M callee stack push * target/arm: Don't read r4 from v8M exception stackframe twice * target/arm: Support SVE in system emulation mode * target/arm: Implement v8M hardware stack limit checking * hw/display/bcm2835_fb: Silence Coverity warning about multiply overflow # gpg: Signature made Mon 08 Oct 2018 14:58:53 BST # gpg: using RSA key 3C2525ED14360CDE # gpg: Good signature from "Peter Maydell <[email protected]>" # gpg: aka "Peter Maydell <[email protected]>" # gpg: aka "Peter Maydell <[email protected]>" # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20181008: (33 commits) hw/display/bcm2835_fb: Silence Coverity warning about multiply overflow target/arm: Add v8M stack checks for MSR to SP_NS target/arm: Add v8M stack checks for VLDM/VSTM target/arm: Add v8M stack checks for Thumb push/pop target/arm: Add v8M stack checks for T32 load/store single target/arm: Add v8M stack checks for Thumb2 LDM/STM target/arm: Add v8M stack checks for LDRD/STRD (imm) target/arm: Add v8M stack limit checks on NS function calls target/arm: Add v8M stack checks on exception entry target/arm: Add some comments in Thumb decode target/arm: Add v8M stack checks on ADD/SUB/MOV of SP target/arm: Move v7m_using_psp() to internals.h target/arm: Define new EXCP type for v8M stack overflows target/arm: Define new TBFLAG for v8M stack checking target/arm: Pass TCGMemOpIdx to sve memory helpers target/arm: Rewrite vector gather first-fault loads target/arm: Rewrite vector gather stores target/arm: Rewrite vector gather loads target/arm: Split contiguous stores for endianness target/arm: Split contiguous loads for endianness ... Signed-off-by: Peter Maydell <[email protected]>
2 parents 079911c + 74e2e59 commit 7c69b7c

File tree

16 files changed

+2623
-1108
lines changed

16 files changed

+2623
-1108
lines changed

hw/arm/virt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,6 +1926,8 @@ static void virt_machine_2_10_options(MachineClass *mc)
19261926
{
19271927
virt_machine_2_11_options(mc);
19281928
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_10);
1929+
/* before 2.11 we never faulted accesses to bad addresses */
1930+
mc->ignore_memory_transaction_failures = true;
19291931
}
19301932
DEFINE_VIRT_MACHINE(2, 10)
19311933

hw/display/bcm2835_fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static void fb_update_display(void *opaque)
190190
}
191191

192192
if (s->invalidate) {
193-
hwaddr base = s->config.base + xoff + yoff * src_width;
193+
hwaddr base = s->config.base + xoff + (hwaddr)yoff * src_width;
194194
framebuffer_update_memory_section(&s->fbsection, s->dma_mr,
195195
base,
196196
s->config.yres, src_width);

target/arm/cpu.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#define EXCP_SEMIHOST 16 /* semihosting call */
5757
#define EXCP_NOCP 17 /* v7M NOCP UsageFault */
5858
#define EXCP_INVSTATE 18 /* v7M INVSTATE UsageFault */
59+
#define EXCP_STKOF 19 /* v8M STKOF UsageFault */
5960
/* NB: add new EXCP_ defines to the array in arm_log_exception() too */
6061

6162
#define ARMV7M_EXCP_RESET 1
@@ -910,12 +911,20 @@ int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,
910911
int aarch64_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
911912
int aarch64_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
912913
void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq);
914+
void aarch64_sve_change_el(CPUARMState *env, int old_el, int new_el);
915+
#else
916+
static inline void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq) { }
917+
static inline void aarch64_sve_change_el(CPUARMState *env, int o, int n) { }
913918
#endif
914919

915920
target_ulong do_arm_semihosting(CPUARMState *env);
916921
void aarch64_sync_32_to_64(CPUARMState *env);
917922
void aarch64_sync_64_to_32(CPUARMState *env);
918923

924+
int fp_exception_el(CPUARMState *env, int cur_el);
925+
int sve_exception_el(CPUARMState *env, int cur_el);
926+
uint32_t sve_zcr_len_for_el(CPUARMState *env, int el);
927+
919928
static inline bool is_a64(CPUARMState *env)
920929
{
921930
return env->aarch64;
@@ -1336,8 +1345,10 @@ FIELD(V7M_CCR, UNALIGN_TRP, 3, 1)
13361345
FIELD(V7M_CCR, DIV_0_TRP, 4, 1)
13371346
FIELD(V7M_CCR, BFHFNMIGN, 8, 1)
13381347
FIELD(V7M_CCR, STKALIGN, 9, 1)
1348+
FIELD(V7M_CCR, STKOFHFNMIGN, 10, 1)
13391349
FIELD(V7M_CCR, DC, 16, 1)
13401350
FIELD(V7M_CCR, IC, 17, 1)
1351+
FIELD(V7M_CCR, BP, 18, 1)
13411352

13421353
/* V7M SCR bits */
13431354
FIELD(V7M_SCR, SLEEPONEXIT, 1, 1)
@@ -1378,6 +1389,7 @@ FIELD(V7M_CFSR, UNDEFINSTR, 16 + 0, 1)
13781389
FIELD(V7M_CFSR, INVSTATE, 16 + 1, 1)
13791390
FIELD(V7M_CFSR, INVPC, 16 + 2, 1)
13801391
FIELD(V7M_CFSR, NOCP, 16 + 3, 1)
1392+
FIELD(V7M_CFSR, STKOF, 16 + 4, 1)
13811393
FIELD(V7M_CFSR, UNALIGNED, 16 + 8, 1)
13821394
FIELD(V7M_CFSR, DIVBYZERO, 16 + 9, 1)
13831395

@@ -2842,6 +2854,9 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env)
28422854
/* For M profile only, Handler (ie not Thread) mode */
28432855
#define ARM_TBFLAG_HANDLER_SHIFT 21
28442856
#define ARM_TBFLAG_HANDLER_MASK (1 << ARM_TBFLAG_HANDLER_SHIFT)
2857+
/* For M profile only, whether we should generate stack-limit checks */
2858+
#define ARM_TBFLAG_STACKCHECK_SHIFT 22
2859+
#define ARM_TBFLAG_STACKCHECK_MASK (1 << ARM_TBFLAG_STACKCHECK_SHIFT)
28452860

28462861
/* Bit usage when in AArch64 state */
28472862
#define ARM_TBFLAG_TBI0_SHIFT 0 /* TBI0 for EL0/1 or TBI for EL2/3 */
@@ -2884,6 +2899,8 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env)
28842899
(((F) & ARM_TBFLAG_BE_DATA_MASK) >> ARM_TBFLAG_BE_DATA_SHIFT)
28852900
#define ARM_TBFLAG_HANDLER(F) \
28862901
(((F) & ARM_TBFLAG_HANDLER_MASK) >> ARM_TBFLAG_HANDLER_SHIFT)
2902+
#define ARM_TBFLAG_STACKCHECK(F) \
2903+
(((F) & ARM_TBFLAG_STACKCHECK_MASK) >> ARM_TBFLAG_STACKCHECK_SHIFT)
28872904
#define ARM_TBFLAG_TBI0(F) \
28882905
(((F) & ARM_TBFLAG_TBI0_MASK) >> ARM_TBFLAG_TBI0_SHIFT)
28892906
#define ARM_TBFLAG_TBI1(F) \

target/arm/cpu64.c

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -410,45 +410,3 @@ static void aarch64_cpu_register_types(void)
410410
}
411411

412412
type_init(aarch64_cpu_register_types)
413-
414-
/* The manual says that when SVE is enabled and VQ is widened the
415-
* implementation is allowed to zero the previously inaccessible
416-
* portion of the registers. The corollary to that is that when
417-
* SVE is enabled and VQ is narrowed we are also allowed to zero
418-
* the now inaccessible portion of the registers.
419-
*
420-
* The intent of this is that no predicate bit beyond VQ is ever set.
421-
* Which means that some operations on predicate registers themselves
422-
* may operate on full uint64_t or even unrolled across the maximum
423-
* uint64_t[4]. Performing 4 bits of host arithmetic unconditionally
424-
* may well be cheaper than conditionals to restrict the operation
425-
* to the relevant portion of a uint16_t[16].
426-
*
427-
* TODO: Need to call this for changes to the real system registers
428-
* and EL state changes.
429-
*/
430-
void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq)
431-
{
432-
int i, j;
433-
uint64_t pmask;
434-
435-
assert(vq >= 1 && vq <= ARM_MAX_VQ);
436-
assert(vq <= arm_env_get_cpu(env)->sve_max_vq);
437-
438-
/* Zap the high bits of the zregs. */
439-
for (i = 0; i < 32; i++) {
440-
memset(&env->vfp.zregs[i].d[2 * vq], 0, 16 * (ARM_MAX_VQ - vq));
441-
}
442-
443-
/* Zap the high bits of the pregs and ffr. */
444-
pmask = 0;
445-
if (vq & 3) {
446-
pmask = ~(-1ULL << (16 * (vq & 3)));
447-
}
448-
for (j = vq / 4; j < ARM_MAX_VQ / 4; j++) {
449-
for (i = 0; i < 17; ++i) {
450-
env->vfp.pregs[i].p[j] &= pmask;
451-
}
452-
pmask = 0;
453-
}
454-
}

0 commit comments

Comments
 (0)