> /* > * The next two structures are marked "__packed" as they normally end up > * being padded in 64-bit mode. > */ > struct netbsd32_vnd_ioctl { > netbsd32_charp vnd_file; /* pathname of file to mount */ > int vnd_flags; /* flags; see below */ > struct vndgeom vnd_geom; /* geometry to emulate */ > unsigned int vnd_osize; /* (returned) size of disk */ > uint64_t vnd_size; /* (returned) size of disk */ > } __packed; > > where the __packed makes the bogus difference. > > I don't understand the comment. Of course they end up being padded > (2 bytes after vnd_flags, 2 bytes after vnd_osize), but that applies to > both the 64bit and the 32bit ABI. > > For which architectures is this __packed important? We need to somehow > conditionalize it. Or am I missing something?
the packed makes it work on x86-64 where the alignment of vnd_size is at 7 * 4 bytes, and plain uint64_t will get padded for 8 byte alignment. this is bogus (thanks, 9 year old me.) can you try this? it removes the __packed and replaces references to the properly aligned types. compile tested only. thanks. .mrg. Index: netbsd32_ioctl.h =================================================================== RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_ioctl.h,v retrieving revision 1.68 diff -p -u -r1.68 netbsd32_ioctl.h --- netbsd32_ioctl.h 20 Aug 2019 09:32:21 -0000 1.68 +++ netbsd32_ioctl.h 3 Sep 2019 18:48:44 -0000 @@ -473,23 +473,19 @@ struct netbsd32_sioc_sg_req { /* from <sys/sockio.h> */ #define SIOCGETSGCNT32 _IOWR('u', 52, struct netbsd32_sioc_sg_req) /* sg pkt cnt */ -/* - * The next two structures are marked "__packed" as they normally end up - * being padded in 64-bit mode. - */ struct netbsd32_vnd_ioctl { netbsd32_charp vnd_file; /* pathname of file to mount */ int vnd_flags; /* flags; see below */ struct vndgeom vnd_geom; /* geometry to emulate */ unsigned int vnd_osize; /* (returned) size of disk */ - uint64_t vnd_size; /* (returned) size of disk */ -} __packed; + netbsd32_uint64 vnd_size; /* (returned) size of disk */ +}; struct netbsd32_vnd_user { int vnu_unit; /* which vnd unit */ - dev_t vnu_dev; /* file is on this device... */ - ino_t vnu_ino; /* ...at this inode */ -} __packed; + netbsd32_dev_t vnu_dev; /* file is on this device... */ + netbsd32_ino_t vnu_ino; /* ...at this inode */ +}; /* from <dev/vndvar.h> */ #define VNDIOCSET32 _IOWR('F', 0, struct netbsd32_vnd_ioctl) /* enable disk */