aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn-Mark Gurney <jmg@FreeBSD.org>2014-03-16 00:53:40 +0000
committerJohn-Mark Gurney <jmg@FreeBSD.org>2014-03-16 00:53:40 +0000
commit6f2b769cacc0332e3e2e46712921f6924bdf489c (patch)
tree59a8765c3a1415fa4b57a58fdbafad794de0152c
parent0775fbb475e9aba1fe9f8530b86ee96cac8136ce (diff)
downloadsrc-6f2b769cacc0332e3e2e46712921f6924bdf489c.tar.gz
src-6f2b769cacc0332e3e2e46712921f6924bdf489c.zip
change td_retval into a union w/ off_t, with defines to mask the
change... This eliminates a cast, and also forces td_retval (often 2 32-bit registers) to be aligned so that off_t's can be stored there on arches with strict alignment requirements like armeb (AVILA)... On i386, this doesn't change alignment, and on amd64 it doesn't either, as register_t is already 64bits... This will also prevent future breakage due to people adding additional fields to the struct... This gets AVILA booting a bit farther... Reviewed by: bde
Notes
Notes: svn path=/head/; revision=263214
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c2
-rw-r--r--sys/kern/uipc_shm.c2
-rw-r--r--sys/kern/vfs_vnops.c2
-rw-r--r--sys/sys/proc.h6
4 files changed, 8 insertions, 4 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index c7b677f703b8..749c91d587b8 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -1504,7 +1504,7 @@ freebsd32_lseek(struct thread *td, struct freebsd32_lseek_args *uap)
ap.whence = uap->whence;
error = sys_lseek(td, &ap);
/* Expand the quad return into two parts for eax and edx */
- pos = *(off_t *)(td->td_retval);
+ pos = td->td_uretoff.tdu_off;
td->td_retval[RETVAL_LO] = pos & 0xffffffff; /* %eax */
td->td_retval[RETVAL_HI] = pos >> 32; /* %edx */
return error;
diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c
index cf00ff480141..bb414e1f46cd 100644
--- a/sys/kern/uipc_shm.c
+++ b/sys/kern/uipc_shm.c
@@ -270,7 +270,7 @@ shm_seek(struct file *fp, off_t offset, int whence, struct thread *td)
if (offset < 0 || offset > shmfd->shm_size)
error = EINVAL;
else
- *(off_t *)(td->td_retval) = offset;
+ td->td_uretoff.tdu_off = offset;
}
foffset_unlock(fp, offset, error != 0 ? FOF_NOUPDATE : 0);
return (error);
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index ec995c7e18a6..8cde4287f02b 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -2080,7 +2080,7 @@ vn_seek(struct file *fp, off_t offset, int whence, struct thread *td)
if (error != 0)
goto drop;
VFS_KNOTE_UNLOCKED(vp, 0);
- *(off_t *)(td->td_retval) = offset;
+ td->td_uretoff.tdu_off = offset;
drop:
foffset_unlock(fp, offset, error != 0 ? FOF_NOUPDATE : 0);
return (error);
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index fce1f8aa7692..bd2e10af60eb 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -300,7 +300,11 @@ struct thread {
TDS_RUNQ,
TDS_RUNNING
} td_state; /* (t) thread state */
- register_t td_retval[2]; /* (k) Syscall aux returns. */
+ union {
+ register_t tdu_retval[2];
+ off_t tdu_off;
+ } td_uretoff; /* (k) Syscall aux returns. */
+#define td_retval td_uretoff.tdu_retval
struct callout td_slpcallout; /* (h) Callout for sleep. */
struct trapframe *td_frame; /* (k) */
struct vm_object *td_kstack_obj;/* (a) Kstack object. */