Re: [PATCH 3/4] target/arm: Take an exception if PC is misaligned

2021-08-19 Thread Richard Henderson
On 8/19/21 9:24 AM, Peter Maydell wrote: (Did you check the M-profile code too? That also architecturally I think should never let PC have the low bit set; hopefully the code I wrote actually ensures that...) Exception handling in m-profile is much harder to follow, but certainly normal updates

Re: [PATCH 3/4] target/arm: Take an exception if PC is misaligned

2021-08-19 Thread Peter Maydell
On Thu, 19 Aug 2021 at 20:18, Peter Maydell wrote: > Just noticed that section G1.16.7 says that when we report > PC alignment faults to AArch32 they should be prefetch aborts, > not UDEF. The fault address and fault status registers also need > to be set (with slightly varying behaviour for when

Re: [PATCH 3/4] target/arm: Take an exception if PC is misaligned

2021-08-19 Thread Peter Maydell
On Thu, 19 Aug 2021 at 17:57, Richard Henderson wrote: > > On 8/19/21 6:50 AM, Richard Henderson wrote: > > On 8/19/21 3:40 AM, Peter Maydell wrote: > >>> uint32_t insn; > >>> bool is_16bit; > >>> > >>> -if (arm_pre_translate_insn(dc)) { > >>> +if (arm_check_ss_active(dc) || ar

Re: [PATCH 3/4] target/arm: Take an exception if PC is misaligned

2021-08-19 Thread Peter Maydell
On Wed, 18 Aug 2021 at 02:04, Richard Henderson wrote: > > For A64, any input to an indirect branch can cause this. > > For A32, many indirect branch paths force the branch to be aligned, > but BXWritePC does not. This includes the BX instruction but also > other interworking changes to PC. Prio

Re: [PATCH 3/4] target/arm: Take an exception if PC is misaligned

2021-08-19 Thread Richard Henderson
On 8/19/21 6:50 AM, Richard Henderson wrote: On 8/19/21 3:40 AM, Peter Maydell wrote:   uint32_t insn;   bool is_16bit; -    if (arm_pre_translate_insn(dc)) { +    if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { Is it not possible to get a misaligned PC in the Thumb case ?

Re: [PATCH 3/4] target/arm: Take an exception if PC is misaligned

2021-08-19 Thread Richard Henderson
On 8/19/21 3:40 AM, Peter Maydell wrote: uint32_t insn; bool is_16bit; -if (arm_pre_translate_insn(dc)) { +if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { Is it not possible to get a misaligned PC in the Thumb case ? No. The thumb bit is always removed, leavi

Re: [PATCH 3/4] target/arm: Take an exception if PC is misaligned

2021-08-19 Thread Peter Maydell
On Wed, 18 Aug 2021 at 02:04, Richard Henderson wrote: > > For A64, any input to an indirect branch can cause this. > > For A32, many indirect branch paths force the branch to be aligned, > but BXWritePC does not. This includes the BX instruction but also > other interworking changes to PC. Prio

Re: [PATCH 3/4] target/arm: Take an exception if PC is misaligned

2021-08-18 Thread Richard Henderson
On 8/17/21 3:00 PM, Richard Henderson wrote: With v8, this is CONSTRAINED UNDEFINED and may either raise an Bah, UNPREDICTABLE, of course, not UNDEFINED. r~