Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Modify syncicache on PowerPC from an inline to a real function.
details: https://anonhg.NetBSD.org/src/rev/551d5069a36e
branches: trunk
changeset: 472004:551d5069a36e
user: ws <ws%NetBSD.org@localhost>
date: Sat Apr 17 21:16:45 1999 +0000
description:
Modify syncicache on PowerPC from an inline to a real function.
Support different cache line sizes with the same object code in userland.
While here, move the function to implementation name space.
diffstat:
lib/libc/arch/powerpc/Makefile.inc | 4 +-
lib/libc/arch/powerpc/gen/Makefile.inc | 5 +-
lib/libc/arch/powerpc/gen/syncicache.c | 89 ++++++++++++++++++++++++++++++
lib/libc/shlib_version | 4 +-
libexec/ld.elf_so/arch/powerpc/ppc_reloc.c | 10 +-
sys/arch/bebox/bebox/machdep.c | 12 ++-
sys/arch/bebox/include/cpu.h | 30 ++-------
sys/arch/bebox/stand/boot/boot.c | 4 +-
sys/arch/macppc/include/cpu.h | 38 ++----------
sys/arch/macppc/macppc/machdep.c | 18 +++--
sys/arch/macppc/stand/ofwboot/boot.c | 6 +-
sys/arch/ofppc/include/cpu.h | 30 ++-------
sys/arch/ofppc/ofppc/machdep.c | 12 ++-
sys/arch/ofppc/stand/ofwboot/boot.c | 6 +-
sys/arch/powerpc/include/cpu.h | 48 ++++++++++++++++
sys/arch/powerpc/powerpc/pmap.c | 6 +-
sys/lib/libkern/arch/powerpc/Makefile.inc | 5 +-
sys/lib/libkern/arch/powerpc/syncicache.c | 89 ++++++++++++++++++++++++++++++
18 files changed, 298 insertions(+), 118 deletions(-)
diffs (truncated from 734 to 300 lines):
diff -r 0096d5311ffe -r 551d5069a36e lib/libc/arch/powerpc/Makefile.inc
--- a/lib/libc/arch/powerpc/Makefile.inc Sat Apr 17 21:00:09 1999 +0000
+++ b/lib/libc/arch/powerpc/Makefile.inc Sat Apr 17 21:16:45 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.1 1997/03/29 20:55:50 thorpej Exp $
+# $NetBSD: Makefile.inc,v 1.2 1999/04/17 21:16:45 ws Exp $
-KMINCLUDES= arch/powerpc/SYS.h
+KMINCLUDES=
KMSRCS=
diff -r 0096d5311ffe -r 551d5069a36e lib/libc/arch/powerpc/gen/Makefile.inc
--- a/lib/libc/arch/powerpc/gen/Makefile.inc Sat Apr 17 21:00:09 1999 +0000
+++ b/lib/libc/arch/powerpc/gen/Makefile.inc Sat Apr 17 21:16:45 1999 +0000
@@ -1,6 +1,9 @@
-# $NetBSD: Makefile.inc,v 1.4 1999/01/15 13:31:20 bouyer Exp $
+# $NetBSD: Makefile.inc,v 1.5 1999/04/17 21:16:45 ws Exp $
SRCS+= _setjmp.S setjmp.S sigsetjmp.S __setjmp14.S __sigsetjmp14.S
SRCS+= isinf.c isnan.c ldexp.c fabs.S flt_rounds.c infinity.c
SRCS+= bswap16.c bswap32.c bswap64.c
SRCS+= frexp.c modf.c
+SRCS+= syncicache.c
+
+KMSRCS+=syncicache.c
diff -r 0096d5311ffe -r 551d5069a36e lib/libc/arch/powerpc/gen/syncicache.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/powerpc/gen/syncicache.c Sat Apr 17 21:16:45 1999 +0000
@@ -0,0 +1,89 @@
+/* $NetBSD: syncicache.c,v 1.1 1999/04/17 21:16:45 ws Exp $ */
+
+/*
+ * Copyright (C) 1995-1997, 1999 Wolfgang Solfrank.
+ * Copyright (C) 1995-1997, 1999 TooLs GmbH.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/param.h>
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/proc.h>
+#include <vm/vm.h>
+#endif
+#include <sys/sysctl.h>
+
+#include <machine/cpu.h>
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+#ifndef CACHELINESIZE
+#error "Must know the size of a cache line"
+#endif
+#else
+static int _cachelinesize;
+#define CACHELINESIZE _cachelinesize
+
+static void
+getcachelinesize()
+{
+ static int cachemib[] = { CTL_MACHDEP, CPU_CACHELINE };
+ int clen = sizeof(_cachelinesize);
+
+ if (sysctl(cachemib, sizeof(cachemib) / sizeof(cachemib[0]),
+ &_cachelinesize, &clen, NULL, 0) < 0
+ || !_cachelinesize)
+ abort();
+}
+#endif
+
+void
+__syncicache(from, len)
+ void *from;
+ int len;
+{
+ int l, off;
+ char *p;
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+ if (!_cachelinesize)
+ getcachelinesize();
+#endif
+ off = (u_int)from & (CACHELINESIZE - 1);
+ l = len += off;
+ p = (char *)from - off;
+ do {
+ __asm__ __volatile ("dcbst 0,%0" :: "r"(p));
+ p += CACHELINESIZE;
+ } while ((l -= CACHELINESIZE) > 0);
+ __asm__ __volatile ("sync");
+ p = (char *)from - off;
+ do {
+ __asm__ __volatile ("icbi 0,%0" :: "r"(p));
+ p += CACHELINESIZE;
+ } while ((len -= CACHELINESIZE) > 0);
+ __asm__ __volatile ("isync");
+}
diff -r 0096d5311ffe -r 551d5069a36e lib/libc/shlib_version
--- a/lib/libc/shlib_version Sat Apr 17 21:00:09 1999 +0000
+++ b/lib/libc/shlib_version Sat Apr 17 21:16:45 1999 +0000
@@ -1,5 +1,5 @@
-# $NetBSD: shlib_version,v 1.68 1999/03/22 17:57:26 sommerfe Exp $
+# $NetBSD: shlib_version,v 1.69 1999/04/17 21:16:45 ws Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
major=12
-minor=40
+minor=41
diff -r 0096d5311ffe -r 551d5069a36e libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
--- a/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c Sat Apr 17 21:00:09 1999 +0000
+++ b/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c Sat Apr 17 21:16:45 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ppc_reloc.c,v 1.3 1999/03/05 04:50:28 tsubai Exp $ */
+/* $NetBSD: ppc_reloc.c,v 1.4 1999/04/17 21:16:46 ws Exp $ */
/*-
* Copyright (C) 1998 Tsubai Masanari
@@ -98,7 +98,7 @@
/* b pltresolve */
where[0] = 0x39600000 | index;
where[1] = 0x48000000 | (distance & 0x03fffffc);
- /* syncicache(where, 8); */
+ /* __syncicache(where, 8); */
}
return 0;
}
@@ -133,7 +133,7 @@
if (abs(distance) < 32*1024*1024) { /* inside 32MB? */
/* b targ_addr # branch directly */
*where = 0x48000000 | (distance & 0x03fffffc);
- syncicache(where, 4);
+ __syncicache(where, 4);
} else {
Elf_Addr *pltcall, *jmptab;
int N = obj->pltrelalim - obj->pltrela;
@@ -153,7 +153,7 @@
/* b pltcall # use pltcall routine */
where[0] = 0x39600000 | reloff;
where[1] = 0x48000000 | (distance & 0x03fffffc);
- syncicache(where, 8);
+ __syncicache(where, 8);
}
return targ_addr;
@@ -189,5 +189,5 @@
pltresolve[3] |= ha(obj);
pltresolve[4] |= l(obj);
- syncicache(pltcall, 72 + N * 8);
+ __syncicache(pltcall, 72 + N * 8);
}
diff -r 0096d5311ffe -r 551d5069a36e sys/arch/bebox/bebox/machdep.c
--- a/sys/arch/bebox/bebox/machdep.c Sat Apr 17 21:00:09 1999 +0000
+++ b/sys/arch/bebox/bebox/machdep.c Sat Apr 17 21:16:45 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.35 1999/04/16 21:47:11 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.36 1999/04/17 21:16:46 ws Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -316,7 +316,7 @@
#endif /* DDB || NIPKDB > 0 */
}
- syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100);
+ __syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100);
/*
* external interrupt handler install
@@ -428,8 +428,8 @@
: "=r"(omsr), "=r"(msr) : "K"((u_short)~PSL_EE));
extint_call = (extint_call & 0xfc000003) | offset;
bcopy(&extint, (void *)EXC_EXI, (size_t)&extsize);
- syncicache((void *)&extint_call, sizeof extint_call);
- syncicache((void *)EXC_EXI, (int)&extsize);
+ __syncicache((void *)&extint_call, sizeof extint_call);
+ __syncicache((void *)EXC_EXI, (int)&extsize);
asm volatile ("mtmsr %0" :: "r"(omsr));
}
@@ -890,7 +890,6 @@
/*
* Machine dependent system variables.
- * None for now.
*/
int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
@@ -905,7 +904,10 @@
/* all sysctl names at this level are terminal */
if (namelen != 1)
return (ENOTDIR);
+
switch (name[0]) {
+ case CPU_CACHELINE:
+ return sysctl_rdint(oldp, oldlenp, newp, CACHELINESIZE);
default:
return (EOPNOTSUPP);
}
diff -r 0096d5311ffe -r 551d5069a36e sys/arch/bebox/include/cpu.h
--- a/sys/arch/bebox/include/cpu.h Sat Apr 17 21:00:09 1999 +0000
+++ b/sys/arch/bebox/include/cpu.h Sat Apr 17 21:16:45 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.3 1997/11/27 10:18:43 sakamoto Exp $ */
+/* $NetBSD: cpu.h,v 1.4 1999/04/17 21:16:46 ws Exp $ */
/*
* Copyright (C) 1995-1997 Wolfgang Solfrank.
@@ -54,28 +54,12 @@
#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1)
#define signotify(p) (astpending = 1)
-#define CACHELINESIZE 32 /* For now XXX */
-
-extern __inline void
-syncicache(from, len)
- void *from;
- int len;
-{
- int l = len;
- void *p = from;
-
- do {
- __asm__ __volatile ("dcbst 0,%0" :: "r"(p));
- p += CACHELINESIZE;
- } while ((l -= CACHELINESIZE) > 0);
- __asm__ __volatile ("sync");
- do {
- __asm__ __volatile ("icbi 0,%0" :: "r"(from));
- from += CACHELINESIZE;
- } while ((len -= CACHELINESIZE) > 0);
- __asm__ __volatile ("isync");
-}
-
extern char *bootpath;
+#ifdef _KERNEL
+#define CACHELINESIZE 32
+#endif
+
+#include <powerpc/cpu.h>
+
#endif /* _MACHINE_CPU_H_ */
diff -r 0096d5311ffe -r 551d5069a36e sys/arch/bebox/stand/boot/boot.c
--- a/sys/arch/bebox/stand/boot/boot.c Sat Apr 17 21:00:09 1999 +0000
+++ b/sys/arch/bebox/stand/boot/boot.c Sat Apr 17 21:16:45 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.6 1999/02/15 04:38:06 sakamoto Exp $ */
+/* $NetBSD: boot.c,v 1.7 1999/04/17 21:16:46 ws Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -278,7 +278,7 @@
printf("read text error: %s\n", strerror(errno));
return;
}
- syncicache((void *)phdr.p_vaddr, phdr.p_filesz);
+ __syncicache((void *)phdr.p_vaddr, phdr.p_filesz);
/* Zero out bss. */
if (phdr.p_filesz < phdr.p_memsz) {
diff -r 0096d5311ffe -r 551d5069a36e sys/arch/macppc/include/cpu.h
--- a/sys/arch/macppc/include/cpu.h Sat Apr 17 21:00:09 1999 +0000
+++ b/sys/arch/macppc/include/cpu.h Sat Apr 17 21:16:45 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.5 1998/10/25 17:39:52 tsubai Exp $ */
+/* $NetBSD: cpu.h,v 1.6 1999/04/17 21:16:46 ws Exp $ */
/*
* Copyright (C) 1995-1997 Wolfgang Solfrank.
@@ -55,37 +55,13 @@
#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1)
#define signotify(p) (astpending = 1)
-#define CACHELINESIZE 32 /* For now XXX */
-
-extern __inline void syncicache __P((void *, int));
-extern __inline void flushcache __P((void *, int));
-
-extern __inline void
Home |
Main Index |
Thread Index |
Old Index