On 5 February 2015 at 11:43, Peter Maydell <peter.mayd...@linaro.org> wrote: > On 5 February 2015 at 09:59, Pranavkumar Sawargaonkar > <pranavku...@linaro.org> wrote: >> + >> + /* In 32bit guest endianess is determined by looking at CPSR's E bit */ >> + if (!is_a64(env)) { >> + return (env->pstate & CPSR_E) ? 1 : 0; > > This is wrong, because if we're not 32-bit then the CPSR > isn't in env->pstate but in env->cpsr_uncached. (I'm guessing > you didn't test 32-bit guests.)
Actually thinking about it your code would have worked for the common 32-bit guest case, since if we fall through to looking at SCTLR then (assuming the guest is at EL1 which it will be when it's messing with the virtio device) we'll end up checking the 32-bit SCTLR EE bit, which will be the same as the current guest endianness for any sane guest kernel. So I apologise for suggesting you didn't test that case. -- PMM