svn commit: r249790 - in head/sys/mips: include mips

Juli Mallett jmallett at FreeBSD.org
Wed Apr 24 02:41:07 UTC 2013


Also: the comment says that the trapframe layout must match regnum.h —
I don't think that's really true.  Why can't we just store things in
the trapframe in whatever order we want?  Why do they need to match
the register numbers.

More worrying, however, is that looking at regnum.h brought to my
attention the fact that Juniper filed the original license off of the
file, and placed a copyright without a license.  The same file seems
to have been published by SGI under a proprietary/unpublished
copyright and under the GPL for Linux, but it's not clear to me that
there's a public domain copy that it would have been acceptable for
Juniper to assert sole copyright over.  It's also definitely
unacceptable that Juniper didn't provide a license for that file.

I don't see why we shouldn't just replace regnum.h with the NetBSD
version, and merge that to all active branches.  Since you're trying
to update these headers, Warner, it would be great if you could do
that.

I wish the project had never accepted any code for the MIPS port from
Juniper, given their penchant (like OpenBSD's MIPS port — what is it
about MIPS ports?) for filing licenses off and placing on their own
(or in Juniper's case, none at all.)  That's just not acceptable for
an open-source project.

Juli.

On Tue, Apr 23, 2013 at 2:38 AM, Warner Losh <imp at freebsd.org> wrote:
> Author: imp
> Date: Tue Apr 23 09:38:18 2013
> New Revision: 249790
> URL: http://svnweb.freebsd.org/changeset/base/249790
>
> Log:
>   Update trapframe to be consistent with the changes made to regnum.h. This
>   should fix the booting problems people have been seeing.
>
> Modified:
>   head/sys/mips/include/frame.h
>   head/sys/mips/include/regnum.h
>   head/sys/mips/mips/db_interface.c
>   head/sys/mips/mips/trap.c
>   head/sys/mips/mips/vm_machdep.c
>
> Modified: head/sys/mips/include/frame.h
> ==============================================================================
> --- head/sys/mips/include/frame.h       Tue Apr 23 06:37:50 2013        (r249789)
> +++ head/sys/mips/include/frame.h       Tue Apr 23 09:38:18 2013        (r249790)
> @@ -37,6 +37,8 @@
>  #ifndef _MACHINE_FRAME_H_
>  #define        _MACHINE_FRAME_H_
>
> +/* Note: This must also match regnum.h and regdef.h */
> +
>  struct trapframe {
>         register_t      zero;
>         register_t      ast;
> @@ -46,6 +48,16 @@ struct trapframe {
>         register_t      a1;
>         register_t      a2;
>         register_t      a3;
> +#if defined(__mips_n32) || defined(__mips_n64)
> +       register_t      a4;
> +       register_t      a5;
> +       register_t      a6;
> +       register_t      a7;
> +       register_t      t0;
> +       register_t      t1;
> +       register_t      t2;
> +       register_t      t3;
> +#else
>         register_t      t0;
>         register_t      t1;
>         register_t      t2;
> @@ -54,6 +66,7 @@ struct trapframe {
>         register_t      t5;
>         register_t      t6;
>         register_t      t7;
> +#endif
>         register_t      s0;
>         register_t      s1;
>         register_t      s2;
>
> Modified: head/sys/mips/include/regnum.h
> ==============================================================================
> --- head/sys/mips/include/regnum.h      Tue Apr 23 06:37:50 2013        (r249789)
> +++ head/sys/mips/include/regnum.h      Tue Apr 23 09:38:18 2013        (r249790)
> @@ -87,10 +87,10 @@
>  #define        T1      9
>  #define        T2      10
>  #define        T3      11
> -#define        TA0     12
> -#define        TA1     13
> -#define        TA2     14
> -#define        TA3     15
> +#define        T4      12
> +#define        T5      13
> +#define        T6      14
> +#define        T7      15
>  #endif
>  #define        S0      16
>  #define        S1      17
>
> Modified: head/sys/mips/mips/db_interface.c
> ==============================================================================
> --- head/sys/mips/mips/db_interface.c   Tue Apr 23 06:37:50 2013        (r249789)
> +++ head/sys/mips/mips/db_interface.c   Tue Apr 23 09:38:18 2013        (r249790)
> @@ -77,6 +77,16 @@ struct db_variable db_regs[] = {
>         { "a1",  DB_OFFSET(a1),         db_frame },
>         { "a2",  DB_OFFSET(a2),         db_frame },
>         { "a3",  DB_OFFSET(a3),         db_frame },
> +#if defined(__mips_n32) || defined(__mips_n64)
> +       { "a4",  DB_OFFSET(a4),         db_frame },
> +       { "a5",  DB_OFFSET(a5),         db_frame },
> +       { "a6",  DB_OFFSET(a6),         db_frame },
> +       { "a7",  DB_OFFSET(a7),         db_frame },
> +       { "t0",  DB_OFFSET(t0),         db_frame },
> +       { "t1",  DB_OFFSET(t1),         db_frame },
> +       { "t2",  DB_OFFSET(t2),         db_frame },
> +       { "t3",  DB_OFFSET(t3),         db_frame },
> +#else
>         { "t0",  DB_OFFSET(t0),         db_frame },
>         { "t1",  DB_OFFSET(t1),         db_frame },
>         { "t2",  DB_OFFSET(t2),         db_frame },
> @@ -85,6 +95,7 @@ struct db_variable db_regs[] = {
>         { "t5",  DB_OFFSET(t5),         db_frame },
>         { "t6",  DB_OFFSET(t6),         db_frame },
>         { "t7",  DB_OFFSET(t7),         db_frame },
> +#endif
>         { "s0",  DB_OFFSET(s0),         db_frame },
>         { "s1",  DB_OFFSET(s1),         db_frame },
>         { "s2",  DB_OFFSET(s2),         db_frame },
>
> Modified: head/sys/mips/mips/trap.c
> ==============================================================================
> --- head/sys/mips/mips/trap.c   Tue Apr 23 06:37:50 2013        (r249789)
> +++ head/sys/mips/mips/trap.c   Tue Apr 23 09:38:18 2013        (r249790)
> @@ -363,10 +363,10 @@ cpu_fetch_syscall_args(struct thread *td
>                         /*
>                          * Non-o32 ABIs support more arguments in registers.
>                          */
> -                       sa->args[3] = locr0->t4;
> -                       sa->args[4] = locr0->t5;
> -                       sa->args[5] = locr0->t6;
> -                       sa->args[6] = locr0->t7;
> +                       sa->args[3] = locr0->t0;
> +                       sa->args[4] = locr0->t1;
> +                       sa->args[5] = locr0->t2;
> +                       sa->args[6] = locr0->t3;
>                         nsaved += 4;
>  #ifdef COMPAT_FREEBSD32
>                 }
> @@ -389,10 +389,10 @@ cpu_fetch_syscall_args(struct thread *td
>                         /*
>                          * Non-o32 ABIs support more arguments in registers.
>                          */
> -                       sa->args[4] = locr0->t4;
> -                       sa->args[5] = locr0->t5;
> -                       sa->args[6] = locr0->t6;
> -                       sa->args[7] = locr0->t7;
> +                       sa->args[4] = locr0->t0;
> +                       sa->args[5] = locr0->t1;
> +                       sa->args[6] = locr0->t2;
> +                       sa->args[7] = locr0->t3;
>                         nsaved += 4;
>  #ifdef COMPAT_FREEBSD32
>                 }
> @@ -1294,12 +1294,19 @@ log_frame_dump(struct trapframe *frame)
>         log(LOG_ERR, "\ta0: %#jx\ta1: %#jx\ta2: %#jx\ta3: %#jx\n",
>             (intmax_t)frame->a0, (intmax_t)frame->a1, (intmax_t)frame->a2, (intmax_t)frame->a3);
>
> +#if defined(__mips_n32) || defined(__mips_n64)
> +       log(LOG_ERR, "\ta4: %#jx\ta5: %#jx\ta6: %#jx\ta6: %#jx\n",
> +           (intmax_t)frame->a4, (intmax_t)frame->a5, (intmax_t)frame->a6, (intmax_t)frame->a7);
> +
> +       log(LOG_ERR, "\tt0: %#jx\tt1: %#jx\tt2: %#jx\tt3: %#jx\n",
> +           (intmax_t)frame->t0, (intmax_t)frame->t1, (intmax_t)frame->t2, (intmax_t)frame->t3);
> +#else
>         log(LOG_ERR, "\tt0: %#jx\tt1: %#jx\tt2: %#jx\tt3: %#jx\n",
>             (intmax_t)frame->t0, (intmax_t)frame->t1, (intmax_t)frame->t2, (intmax_t)frame->t3);
>
>         log(LOG_ERR, "\tt4: %#jx\tt5: %#jx\tt6: %#jx\tt7: %#jx\n",
>             (intmax_t)frame->t4, (intmax_t)frame->t5, (intmax_t)frame->t6, (intmax_t)frame->t7);
> -
> +#endif
>         log(LOG_ERR, "\tt8: %#jx\tt9: %#jx\ts0: %#jx\ts1: %#jx\n",
>             (intmax_t)frame->t8, (intmax_t)frame->t9, (intmax_t)frame->s0, (intmax_t)frame->s1);
>
> @@ -1334,13 +1341,19 @@ trap_frame_dump(struct trapframe *frame)
>
>         printf("\ta0: %#jx\ta1: %#jx\ta2: %#jx\ta3: %#jx\n",
>             (intmax_t)frame->a0, (intmax_t)frame->a1, (intmax_t)frame->a2, (intmax_t)frame->a3);
> +#if defined(__mips_n32) || defined(__mips_n64)
> +       printf("\ta4: %#jx\ta5: %#jx\ta6: %#jx\ta7: %#jx\n",
> +           (intmax_t)frame->a4, (intmax_t)frame->a5, (intmax_t)frame->a6, (intmax_t)frame->a7);
>
>         printf("\tt0: %#jx\tt1: %#jx\tt2: %#jx\tt3: %#jx\n",
>             (intmax_t)frame->t0, (intmax_t)frame->t1, (intmax_t)frame->t2, (intmax_t)frame->t3);
> +#else
> +       printf("\tt0: %#jx\tt1: %#jx\tt2: %#jx\tt3: %#jx\n",
> +           (intmax_t)frame->t0, (intmax_t)frame->t1, (intmax_t)frame->t2, (intmax_t)frame->t3);
>
>         printf("\tt4: %#jx\tt5: %#jx\tt6: %#jx\tt7: %#jx\n",
>             (intmax_t)frame->t4, (intmax_t)frame->t5, (intmax_t)frame->t6, (intmax_t)frame->t7);
> -
> +#endif
>         printf("\tt8: %#jx\tt9: %#jx\ts0: %#jx\ts1: %#jx\n",
>             (intmax_t)frame->t8, (intmax_t)frame->t9, (intmax_t)frame->s0, (intmax_t)frame->s1);
>
>
> Modified: head/sys/mips/mips/vm_machdep.c
> ==============================================================================
> --- head/sys/mips/mips/vm_machdep.c     Tue Apr 23 06:37:50 2013        (r249789)
> +++ head/sys/mips/mips/vm_machdep.c     Tue Apr 23 09:38:18 2013        (r249790)
> @@ -613,6 +613,16 @@ dump_trapframe(struct trapframe *trapfra
>         DB_PRINT_REG(trapframe, a1);
>         DB_PRINT_REG(trapframe, a2);
>         DB_PRINT_REG(trapframe, a3);
> +#if defined(__mips_n32) || defined(__mips_n64)
> +       DB_PRINT_REG(trapframe, a4);
> +       DB_PRINT_REG(trapframe, a5);
> +       DB_PRINT_REG(trapframe, a6);
> +       DB_PRINT_REG(trapframe, a7);
> +       DB_PRINT_REG(trapframe, t0);
> +       DB_PRINT_REG(trapframe, t1);
> +       DB_PRINT_REG(trapframe, t2);
> +       DB_PRINT_REG(trapframe, t3);
> +#else
>         DB_PRINT_REG(trapframe, t0);
>         DB_PRINT_REG(trapframe, t1);
>         DB_PRINT_REG(trapframe, t2);
> @@ -621,6 +631,7 @@ dump_trapframe(struct trapframe *trapfra
>         DB_PRINT_REG(trapframe, t5);
>         DB_PRINT_REG(trapframe, t6);
>         DB_PRINT_REG(trapframe, t7);
> +#endif
>         DB_PRINT_REG(trapframe, s0);
>         DB_PRINT_REG(trapframe, s1);
>         DB_PRINT_REG(trapframe, s2);


More information about the svn-src-head mailing list