compiler.h: add QEMU_ALIGNED() to enforce struct alignment

Backports commit 911a4d2215b05267b16925503218f49d607c6b29 from qemu
This commit is contained in:
Emilio G. Cota 2018-02-24 17:32:36 -05:00 committed by Lioncash
parent 48539e54da
commit 8518f55df7
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
5 changed files with 9 additions and 9 deletions

View file

@ -52,7 +52,7 @@ static union MSVC_FLOAT_HACK __NAN = {{0x00, 0x00, 0xC0, 0x7F}};
#define QEMU_ARTIFICIAL
#define QEMU_PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )
#define QEMU_ALIGN(A, B) __declspec(align(A)) B
#define QEMU_ALIGNED(A, B) __declspec(align(A)) B
#define cat(x,y) x ## y
#define cat2(x,y) cat(x,y)
@ -101,7 +101,7 @@ static union MSVC_FLOAT_HACK __NAN = {{0x00, 0x00, 0xC0, 0x7F}};
# define QEMU_PACK( __Declaration__ ) __Declaration__ __attribute__((packed))
#endif
#define QEMU_ALIGN(A, B) B __attribute__((aligned(A)))
#define QEMU_ALIGNED(A, B) B __attribute__((aligned(A)))
#ifndef glue
#define xglue(x, y) x ## y

View file

@ -803,7 +803,7 @@ typedef struct BNDCSReg {
#define MMX_Q(n) _q_MMXReg[n]
typedef union {
floatx80 QEMU_ALIGN(16, d);
floatx80 QEMU_ALIGNED(16, d);
MMXReg mmx;
} FPReg;

View file

@ -70,8 +70,8 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int type,
/* The CIE and FDE header definitions will be common to all hosts. */
typedef struct {
//uint32_t QEMU_ALIGN(sizeof(void *), len);
uint32_t QEMU_ALIGN(8, len);
//uint32_t QEMU_ALIGNED(sizeof(void *), len);
uint32_t QEMU_ALIGNED(8, len);
uint32_t id;
uint8_t version;
char augmentation[1];
@ -81,8 +81,8 @@ typedef struct {
} DebugFrameCIE;
QEMU_PACK( typedef struct {
// uint32_t QEMU_ALIGN(sizeof(void *), len);
uint32_t QEMU_ALIGN(8, len);
// uint32_t QEMU_ALIGNED(sizeof(void *), len);
uint32_t QEMU_ALIGNED(8, len);
uint32_t cie_offset;
uintptr_t func_start;
uintptr_t func_len;

View file

@ -214,7 +214,7 @@ typedef struct TCGLabel {
typedef struct TCGPool {
struct TCGPool *next;
int size;
uint8_t QEMU_ALIGN(8, data[0]);
uint8_t QEMU_ALIGNED(8, data[0]);
} TCGPool;
#define TCG_POOL_CHUNK_SIZE 32768

View file

@ -544,7 +544,7 @@ static inline void *split_cross_256mb(struct uc_struct *uc, void *buf1, size_t s
#endif
#ifdef USE_STATIC_CODE_GEN_BUFFER
static uint8_t QEMU_ALIGN(CODE_GEN_ALIGN, static_code_gen_buffer[DEFAULT_CODE_GEN_BUFFER_SIZE]);
static uint8_t QEMU_ALIGNED(CODE_GEN_ALIGN, static_code_gen_buffer[DEFAULT_CODE_GEN_BUFFER_SIZE]);
void free_code_gen_buffer(struct uc_struct *uc)
{