slavio_intctl: avoid structure holes spotted by pahole
commit07dd0035d83727ed2b1922a85cd5aea5b010025b
authorBlue Swirl <blauwirbel@gmail.com>
Sun, 7 Aug 2011 19:06:26 +0000 (7 19:06 +0000)
committerBlue Swirl <blauwirbel@gmail.com>
Sun, 21 Aug 2011 19:52:31 +0000 (21 19:52 +0000)
treed83989a7a5bd68273a69309befa08cd51f059de0
parent97bbb109b1349051390f6b2ad77b1bfb44e3d760
slavio_intctl: avoid structure holes spotted by pahole

Report from pahole on amd64 host:
struct SLAVIO_INTCTLState {
SysBusDevice               busdev;               /*     0  5648 */
/* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */
uint32_t                   intregm_pending;      /*  5648     4 */
uint32_t                   intregm_disabled;     /*  5652     4 */
uint32_t                   target_cpu;           /*  5656     4 */

/* XXX 4 bytes hole, try to pack */

qemu_irq                   cpu_irqs[16][16];     /*  5664  2048 */
/* --- cacheline 120 boundary (7680 bytes) was 32 bytes ago --- */
SLAVIO_CPUINTCTLState      slaves[16];           /*  7712   384 */
/* --- cacheline 126 boundary (8064 bytes) was 32 bytes ago --- */

/* size: 8096, cachelines: 127 */
/* sum members: 8092, holes: 1, sum holes: 4 */
/* last cacheline: 32 bytes */
}; /* definitions: 1 */

struct SLAVIO_CPUINTCTLState {
uint32_t                   intreg_pending;       /*     0     4 */

/* XXX 4 bytes hole, try to pack */

struct SLAVIO_INTCTLState * master;              /*     8     8 */
uint32_t                   cpu;                  /*    16     4 */
uint32_t                   irl_out;              /*    20     4 */

/* size: 24, cachelines: 1 */
/* sum members: 20, holes: 1, sum holes: 4 */
/* last cacheline: 24 bytes */
}; /* definitions: 1 */

Fix by rearranging the structures to avoid padding.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hw/slavio_intctl.c