SCP: Add macro's to support packed structures for network traffic
This commit is contained in:
parent
c30c88c24f
commit
77edf89ef5
2 changed files with 15 additions and 3 deletions
15
sim_defs.h
15
sim_defs.h
|
@ -315,6 +315,21 @@ typedef uint32 t_addr;
|
||||||
#define SIM_NOINLINE
|
#define SIM_NOINLINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Packed structure support */
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define PACKED_BEGIN __pragma( pack(push, 1) )
|
||||||
|
# define PACKED_END __pragma( pack(pop) )
|
||||||
|
#else
|
||||||
|
# define PACKED_BEGIN
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# define PACKED_END __attribute__((gcc_struct, packed))
|
||||||
|
#else
|
||||||
|
# define PACKED_END __attribute__((packed))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Storage class modifier for weak link definition for sim_vm_init() */
|
/* Storage class modifier for weak link definition for sim_vm_init() */
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
|
|
@ -62,15 +62,12 @@ typedef uint32_t n_long; /* long as received from the net */
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# define PACKED_BEGIN __pragma( pack(push, 1) )
|
# define PACKED_BEGIN __pragma( pack(push, 1) )
|
||||||
# define PACKED_END __pragma( pack(pop) )
|
# define PACKED_END __pragma( pack(pop) )
|
||||||
# define QEMU_PACKED
|
|
||||||
#else
|
#else
|
||||||
# define PACKED_BEGIN
|
# define PACKED_BEGIN
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# define PACKED_END __attribute__((gcc_struct, packed))
|
# define PACKED_END __attribute__((gcc_struct, packed))
|
||||||
# define QEMU_PACKED __attribute__((gcc_struct, packed))
|
|
||||||
#else
|
#else
|
||||||
# define PACKED_END __attribute__((packed))
|
# define PACKED_END __attribute__((packed))
|
||||||
# define QEMU_PACKED __attribute__((packed))
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue