diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-10-06 14:27:19 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-10-06 14:27:19 +0200 |
| commit | ad0c08c2de2dde9e60fd4537f3e4b53c89a468eb (patch) | |
| tree | 87b05e60b1194d9b4752f09f46c2d0181129062d /src/include/myalign32.h | |
| parent | 7b93791c3f428c119e35480bbba1dcec7a413db4 (diff) | |
| download | box64-ad0c08c2de2dde9e60fd4537f3e4b53c89a468eb.tar.gz box64-ad0c08c2de2dde9e60fd4537f3e4b53c89a468eb.zip | |
[BOX32] Proper alignment for x86 structures
Diffstat (limited to 'src/include/myalign32.h')
| -rwxr-xr-x | src/include/myalign32.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/include/myalign32.h b/src/include/myalign32.h index fae5b2cf..e77e37e8 100755 --- a/src/include/myalign32.h +++ b/src/include/myalign32.h @@ -131,11 +131,11 @@ struct i386_stat64 { uint32_t st_ctime; uint32_t st_ctime_nsec; uint64_t st_ino; -} __attribute__((packed)); +} __attribute__((packed, aligned(4))); struct i386_fsid { int val[2]; -} __attribute__((packed)); +} __attribute__((packed, aligned(4))); struct i386_statfs { uint32_t f_type; @@ -150,7 +150,7 @@ struct i386_statfs { uint32_t f_frsize; uint32_t f_flags; uint32_t f_spare[4]; -} __attribute__((packed)); +} __attribute__((packed, aligned(4))); struct i386_statfs64 { uint32_t f_type; @@ -165,7 +165,7 @@ struct i386_statfs64 { uint32_t f_frsize; uint32_t f_flags; uint32_t f_spare[4]; -} __attribute__((packed)); +} __attribute__((packed, aligned(4))); struct i386_statvfs64 { ulong_t f_bsize; @@ -182,7 +182,7 @@ struct i386_statvfs64 { ulong_t f_namemax; unsigned int f_type; int __f_spare[5]; -} __attribute__((packed)); +} __attribute__((packed, aligned(4))); struct i386_statvfs { ulong_t f_bsize; @@ -199,7 +199,7 @@ struct i386_statvfs { ulong_t f_namemax; unsigned int f_type; int __f_spare[5]; -} __attribute__((packed)); +} __attribute__((packed, aligned(4))); void UnalignStatVFS_32(const void* source, void* dest); void UnalignStatVFS64_32(const void* source, void* dest); @@ -211,7 +211,7 @@ struct i386_dirent uint16_t d_reclen; uint8_t d_type; char d_name[256]; -}; +} __attribute__((packed, aligned(4))); void UnalignDirent_32(const void* source, void* dest); #if 0 @@ -425,7 +425,7 @@ typedef struct my_flock64_s { int l_pid; } my_flock64_t; -typedef struct __attribute__((packed)) x86_flock64_s { +typedef struct __attribute__((packed, aligned(4))) x86_flock64_s { uint16_t l_type; uint16_t l_whence; int64_t l_start; @@ -470,7 +470,7 @@ struct i386_addrinfo ptr_t ai_addr; // struct sockaddr * ptr_t ai_canonname; // char * ptr_t ai_next; // struct addrinfo * -} __attribute__((packed)); +} __attribute__((packed, aligned(4))); struct i386_hostent { ptr_t h_name; // char * @@ -478,13 +478,13 @@ struct i386_hostent { int h_addrtype; int h_length; ptr_t h_addr_list;// char ** -} __attribute__((packed)); +} __attribute__((packed, aligned(4))); struct i386_iovec { ptr_t iov_base; // void * ulong_t iov_len; -}; +} __attribute__((packed, aligned(4))); struct i386_msghdr { @@ -495,14 +495,14 @@ struct i386_msghdr ptr_t msg_control; // void * ulong_t msg_controllen; int msg_flags; -}; +} __attribute__((packed, aligned(4))); struct i386_cmsghdr { ulong_t cmsg_len; int cmsg_level; int cmsg_type; -}; +} __attribute__((packed, aligned(4))); void AlignIOV_32(void* dest, void* source); // x86 -> Native void UnalignIOV_32(void* dest, void* source); // Native -> x86 @@ -519,7 +519,7 @@ struct i386_passwd ptr_t pw_gecos; // char* ptr_t pw_dir; // char* ptr_t pw_shell; // char* -}; +} __attribute__((packed, aligned(4))); struct i386_group { @@ -527,6 +527,6 @@ struct i386_group ptr_t gr_passwd; // char * __gid_t gr_gid; ptr_t gr_mem; // char ** -}; +} __attribute__((packed, aligned(4))); #endif//__MY_ALIGN32__H_ \ No newline at end of file |