[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/8] exec-all.h: Use stl_p to avoid undefinedbeh
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [PATCH 1/8] exec-all.h: Use stl_p to avoid undefinedbehaviour patching x86 jumpss |
Date: |
Tue, 01 Apr 2014 13:09:17 +0100 |
User-agent: |
mu4e 0.9.9.6pre2; emacs 24.3.50.5 |
Richard Henderson <address@hidden> writes:
> From: Peter Maydell <address@hidden>
>
> 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)
Ehh? Is that gcc just being silly and putting parameters for an inline
on the stack frame?
>
> Signed-off-by: Peter Maydell <address@hidden>
> Signed-off-by: Richard Henderson <address@hidden>
<snip>
Reviewed-by: Alex Bennée <address@hidden>
--
Alex Bennée
- Re: [Qemu-devel] [PATCH 1/8] exec-all.h: Use stl_p to avoid undefinedbehaviour patching x86 jumpss,
Alex Bennée <=