Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Mar 2014 18:17:52 -0700
From:      Adrian Chadd <adrian@freebsd.org>
To:        John-Mark Gurney <jmg@freebsd.org>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r263214 - in head/sys: compat/freebsd32 kern sys
Message-ID:  <CAJ-Vmon9%2BNmJghpjwi1NB2k1ETc=bPJJSjQzL-TFVKLZHi8iiA@mail.gmail.com>
In-Reply-To: <201403160053.s2G0rfmA073668@svn.freebsd.org>
References:  <201403160053.s2G0rfmA073668@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
How far along does it get?


-a


On 15 March 2014 17:53, John-Mark Gurney <jmg@freebsd.org> wrote:
> Author: jmg
> Date: Sun Mar 16 00:53:40 2014
> New Revision: 263214
> URL: http://svnweb.freebsd.org/changeset/base/263214
>
> Log:
>   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
>
> Modified:
>   head/sys/compat/freebsd32/freebsd32_misc.c
>   head/sys/kern/uipc_shm.c
>   head/sys/kern/vfs_vnops.c
>   head/sys/sys/proc.h
>
> Modified: head/sys/compat/freebsd32/freebsd32_misc.c
> ==============================================================================
> --- head/sys/compat/freebsd32/freebsd32_misc.c  Sun Mar 16 00:22:07 2014        (r263213)
> +++ head/sys/compat/freebsd32/freebsd32_misc.c  Sun Mar 16 00:53:40 2014        (r263214)
> @@ -1504,7 +1504,7 @@ freebsd32_lseek(struct thread *td, struc
>         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;
>
> Modified: head/sys/kern/uipc_shm.c
> ==============================================================================
> --- head/sys/kern/uipc_shm.c    Sun Mar 16 00:22:07 2014        (r263213)
> +++ head/sys/kern/uipc_shm.c    Sun Mar 16 00:53:40 2014        (r263214)
> @@ -270,7 +270,7 @@ shm_seek(struct file *fp, off_t offset,
>                 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);
>
> Modified: head/sys/kern/vfs_vnops.c
> ==============================================================================
> --- head/sys/kern/vfs_vnops.c   Sun Mar 16 00:22:07 2014        (r263213)
> +++ head/sys/kern/vfs_vnops.c   Sun Mar 16 00:53:40 2014        (r263214)
> @@ -2080,7 +2080,7 @@ vn_seek(struct file *fp, off_t offset, i
>         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);
>
> Modified: head/sys/sys/proc.h
> ==============================================================================
> --- head/sys/sys/proc.h Sun Mar 16 00:22:07 2014        (r263213)
> +++ head/sys/sys/proc.h Sun Mar 16 00:53:40 2014        (r263214)
> @@ -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. */
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmon9%2BNmJghpjwi1NB2k1ETc=bPJJSjQzL-TFVKLZHi8iiA>