summary refs log tree commit diff stats
path: root/scripts/qapi/gen.py
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-07-23 17:21:41 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-07-27 10:57:39 +0100
commit888f470f123521b4fc9974d2dd1cc48629d73adc (patch)
tree0a190f32375fa6be8d6d38601f3ad978efa49323 /scripts/qapi/gen.py
parent953558291ec319476355900655fa53aa84ab99f0 (diff)
downloadfocaccia-qemu-888f470f123521b4fc9974d2dd1cc48629d73adc.tar.gz
focaccia-qemu-888f470f123521b4fc9974d2dd1cc48629d73adc.zip
target/arm: Enforce that M-profile SP low 2 bits are always zero
For M-profile, unlike A-profile, the low 2 bits of SP are defined to be
RES0H, which is to say that they must be hardwired to zero so that
guest attempts to write non-zero values to them are ignored.

Implement this behaviour by masking out the low bits:
 * for writes to r13 by the gdbstub
 * for writes to any of the various flavours of SP via MSR
 * for writes to r13 via store_reg() in generated code

Note that all the direct uses of cpu_R[] in translate.c are in places
where the register is definitely not r13 (usually because that has
been checked for as an UNDEFINED or UNPREDICTABLE case and handled as
UNDEF).

All the other writes to regs[13] in C code are either:
 * A-profile only code
 * writes of values we can guarantee to be aligned, such as
   - writes of previous-SP-value plus or minus a 4-aligned constant
   - writes of the value in an SP limit register (which we already
     enforce to be aligned)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210723162146.5167-2-peter.maydell@linaro.org
Diffstat (limited to 'scripts/qapi/gen.py')
0 files changed, 0 insertions, 0 deletions