exec-all.h: Use stl_p to avoid undefined behaviour patching x86 jumps
commit86360ad71df0070283469b8ae59f33cdd013501d
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 28 Mar 2014 15:29:46 +0000 (28 15:29 +0000)
committerRichard Henderson <rth@twiddle.net>
Mon, 12 May 2014 17:03:04 +0000 (12 10:03 -0700)
tree45f6fb13e9e2887e45ca70259a2cdc95ad8a0ea0
parent06b4f00d53637f2c16a62c2cbaa30bffb045cf88
exec-all.h: Use stl_p to avoid undefined behaviour patching x86 jumps

The code which patches x86 jump instructions assumes it can do an
unaligned write of a uint32_t. This is actually safe on x86, but it's
still undefined behaviour. We have infrastructure for doing efficient
unaligned accesses which doesn't engage in undefined behaviour, so
use it.

This is technically fractionally less efficient, at least with gcc 4.6;
instead of one instruction:
 7b2:   89 3e                   mov    %edi,(%rsi)
we get an extra spurious store to the stack slot:
 7b2:   89 7c 24 64             mov    %edi,0x64(%rsp)
 7b6:   89 3e                   mov    %edi,(%rsi)

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
include/exec/exec-all.h