casting td_retval to off_t...
John-Mark Gurney
jmg at funkthat.com
Mon Jan 13 06:04:40 UTC 2014
So, I've been working on bringing FreeBSD back up on an AVILA board
and have run into an issue where we cast td_retval to an off_t to write
back a value (see the end of kern/vfs_vnops.c).
The issue is that td_retval is defined as:
register_t td_retval[2];
and on arm register_t is an int32_t so in struct thread, it doesn't
get aligned to an 8 byte boundary... Recently attilo added an int
before td_retval that caused td_retval to be no longer be aligned to
8 bytes.
What is the best way to fix this?
One simple & quick fix was to add __aligned(sizeof(off_t)) to the
td_retval, but if we really want to fix this cleanly (make it alias
clean), we should change td_retval to be a union, and I guess have
a define for td_retval to access it through the union, something
like:
union {
register_t tdu_retval[2];
off_t tdu_off;
} td_uretoff;
#define td_retval td_uretoff.tdu_retval
Comments?
Thanks.
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
More information about the freebsd-arch
mailing list