Skip to content

Commit

Permalink
linux-user: Use correct alignment for long long on i386 guests
Browse files Browse the repository at this point in the history
For i386, the ABI specifies that 'long long' (8 byte values)
need only be 4 aligned, but we were requiring them to be
8-aligned. This meant we were laying out the target_epoll_event
structure wrongly. Add a suitable ifdef to abitypes.h to
specify the i386-specific alignment requirement.

Reported-by: Icenowy Zheng <icenowy@aosc.xyz>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
  • Loading branch information
pm215 authored and Riku Voipio committed Aug 4, 2016
1 parent 09704e6 commit d9fe91d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/exec/user/abitypes.h
Expand Up @@ -15,6 +15,10 @@
#define ABI_LLONG_ALIGNMENT 2
#endif

#if defined(TARGET_I386) && !defined(TARGET_X86_64)
#define ABI_LLONG_ALIGNMENT 4
#endif

#ifndef ABI_SHORT_ALIGNMENT
#define ABI_SHORT_ALIGNMENT 2
#endif
Expand Down

0 comments on commit d9fe91d

Please sign in to comment.