Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc Avoid unncessary use of double in the kerne...



details:   https://anonhg.NetBSD.org/src/rev/7ec439c94cee
branches:  trunk
changeset: 331505:7ec439c94cee
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Aug 12 20:27:10 2014 +0000

description:
Avoid unncessary use of double in the kernel. With this change,
a LLVM build kernel fully works on TWRP1025.

diffstat:

 sys/arch/powerpc/fpu/fpu_emu.c      |  6 +++---
 sys/arch/powerpc/include/mcontext.h |  6 +++++-
 sys/arch/powerpc/include/reg.h      |  7 ++++++-
 sys/arch/powerpc/powerpc/trap.c     |  8 ++++----
 4 files changed, 18 insertions(+), 9 deletions(-)

diffs (107 lines):

diff -r 32804b70e911 -r 7ec439c94cee sys/arch/powerpc/fpu/fpu_emu.c
--- a/sys/arch/powerpc/fpu/fpu_emu.c    Tue Aug 12 14:22:51 2014 +0000
+++ b/sys/arch/powerpc/fpu/fpu_emu.c    Tue Aug 12 20:27:10 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_emu.c,v 1.16 2012/07/23 04:13:06 matt Exp $ */
+/*     $NetBSD: fpu_emu.c,v 1.17 2014/08/12 20:27:10 joerg Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.16 2012/07/23 04:13:06 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.17 2014/08/12 20:27:10 joerg Exp $");
 
 #include "opt_ddb.h"
 
@@ -324,7 +324,7 @@
                 * Convert to/from single if needed, calculate addr,
                 * and update index reg if needed.
                 */
-               double buf;
+               uint64_t buf;
                size_t size = sizeof(float);
                int store, update;
 
diff -r 32804b70e911 -r 7ec439c94cee sys/arch/powerpc/include/mcontext.h
--- a/sys/arch/powerpc/include/mcontext.h       Tue Aug 12 14:22:51 2014 +0000
+++ b/sys/arch/powerpc/include/mcontext.h       Tue Aug 12 20:27:10 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mcontext.h,v 1.16 2014/07/24 18:19:13 joerg Exp $      */
+/*     $NetBSD: mcontext.h,v 1.17 2014/08/12 20:27:10 joerg Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -86,7 +86,11 @@
 #define        _REG_MQ         38              /* MQ Register (POWER only) */
 
 typedef struct {
+#ifdef _KERNEL
+       unsigned long long      __fpu_regs[32]; /* FP0-31 */
+#else
        double          __fpu_regs[32]; /* FP0-31 */
+#endif
        unsigned int    __fpu_fpscr;    /* FP Status and Control Register */
        unsigned int    __fpu_valid;    /* Set together with _UC_FPU */
 } __fpregset_t;
diff -r 32804b70e911 -r 7ec439c94cee sys/arch/powerpc/include/reg.h
--- a/sys/arch/powerpc/include/reg.h    Tue Aug 12 14:22:51 2014 +0000
+++ b/sys/arch/powerpc/include/reg.h    Tue Aug 12 20:27:10 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: reg.h,v 1.10 2011/01/18 01:02:54 matt Exp $    */
+/*     $NetBSD: reg.h,v 1.11 2014/08/12 20:27:10 joerg Exp $   */
 
 #ifndef _POWERPC_REG_H_
 #define _POWERPC_REG_H_
@@ -58,8 +58,13 @@
 };
 
 struct fpreg {                         /* Floating Point registers */
+#ifdef _KERNEL
+       uint64_t fpreg[32];
+       uint64_t fpscr;                 /* Status and Control Register */
+#else
        double fpreg[32];
        double fpscr;                   /* Status and Control Register */
+#endif
 };
 
 struct vreg {                          /* Vector registers */
diff -r 32804b70e911 -r 7ec439c94cee sys/arch/powerpc/powerpc/trap.c
--- a/sys/arch/powerpc/powerpc/trap.c   Tue Aug 12 14:22:51 2014 +0000
+++ b/sys/arch/powerpc/powerpc/trap.c   Tue Aug 12 20:27:10 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.149 2014/03/03 15:36:36 macallan Exp $      */
+/*     $NetBSD: trap.c,v 1.150 2014/08/12 20:27:10 joerg Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.149 2014/03/03 15:36:36 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.150 2014/08/12 20:27:10 joerg Exp $");
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -736,7 +736,7 @@
                        struct pcb * const pcb = lwp_getpcb(l);
                        const int reg = EXC_ALI_RST(tf->tf_dsisr);
                        const int a_reg = EXC_ALI_RA(tf->tf_dsisr);
-                       double * const fpreg = &pcb->pcb_fpu.fpreg[reg];
+                       uint64_t * const fpreg = &pcb->pcb_fpu.fpreg[reg];
                        register_t* a_reg_addr = &tf->tf_fixreg[a_reg];
 
                        /*
@@ -782,7 +782,7 @@
                        struct pcb * const pcb = lwp_getpcb(l);
                        const int reg = EXC_ALI_RST(tf->tf_dsisr);
                        const int a_reg = EXC_ALI_RA(tf->tf_dsisr);
-                       double * const fpreg = &pcb->pcb_fpu.fpreg[reg];
+                       uint64_t * const fpreg = &pcb->pcb_fpu.fpreg[reg];
                        register_t* a_reg_addr = &tf->tf_fixreg[a_reg];
 
                        /*



Home | Main Index | Thread Index | Old Index