Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Add cpu_counter().



details:   https://anonhg.NetBSD.org/src/rev/79d589405542
branches:  trunk
changeset: 487698:79d589405542
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Sun Jun 11 16:32:42 2000 +0000

description:
Add cpu_counter().

diffstat:

 sys/arch/amigappc/include/rnd.h  |   3 ++
 sys/arch/bebox/include/rnd.h     |   3 ++
 sys/arch/macppc/include/rnd.h    |   3 ++
 sys/arch/ofppc/include/rnd.h     |   3 ++
 sys/arch/powerpc/include/rnd.h   |  51 ++++++++++++++++++++++++++++++++++++++++
 sys/arch/powerpc/include/types.h |   4 ++-
 sys/arch/prep/include/rnd.h      |   3 ++
 7 files changed, 69 insertions(+), 1 deletions(-)

diffs (106 lines):

diff -r d919826c4330 -r 79d589405542 sys/arch/amigappc/include/rnd.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amigappc/include/rnd.h   Sun Jun 11 16:32:42 2000 +0000
@@ -0,0 +1,3 @@
+/*     $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:42 tsubai Exp $   */
+
+#include <powerpc/rnd.h>
diff -r d919826c4330 -r 79d589405542 sys/arch/bebox/include/rnd.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/bebox/include/rnd.h      Sun Jun 11 16:32:42 2000 +0000
@@ -0,0 +1,3 @@
+/*     $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:43 tsubai Exp $   */
+
+#include <powerpc/rnd.h>
diff -r d919826c4330 -r 79d589405542 sys/arch/macppc/include/rnd.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/macppc/include/rnd.h     Sun Jun 11 16:32:42 2000 +0000
@@ -0,0 +1,3 @@
+/*     $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:43 tsubai Exp $   */
+
+#include <powerpc/rnd.h>
diff -r d919826c4330 -r 79d589405542 sys/arch/ofppc/include/rnd.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ofppc/include/rnd.h      Sun Jun 11 16:32:42 2000 +0000
@@ -0,0 +1,3 @@
+/*     $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:44 tsubai Exp $   */
+
+#include <powerpc/rnd.h>
diff -r d919826c4330 -r 79d589405542 sys/arch/powerpc/include/rnd.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/powerpc/include/rnd.h    Sun Jun 11 16:32:42 2000 +0000
@@ -0,0 +1,51 @@
+/*     $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:45 tsubai Exp $   */
+
+/*-
+ * Copyright (c) 2000 Tsubai Masanari.  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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
+ */
+
+#ifndef _POWERPC_RND_H_
+#define _POWERPC_RND_H_
+
+/*
+ * Machine-specific support for rnd(4)
+ */
+
+#ifdef _KERNEL
+
+#define cpu_hascounter() 1
+
+static __inline u_int32_t
+cpu_counter(void)
+{
+       u_int32_t rv;
+
+       __asm __volatile ("mftb %0" : "=r"(rv));
+       return rv;
+}
+
+#endif /* _KERNEL */
+
+#endif /* _POWERPC_RND_H_ */
diff -r d919826c4330 -r 79d589405542 sys/arch/powerpc/include/types.h
--- a/sys/arch/powerpc/include/types.h  Sun Jun 11 16:26:53 2000 +0000
+++ b/sys/arch/powerpc/include/types.h  Sun Jun 11 16:32:42 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: types.h,v 1.8 1998/08/13 02:10:39 eeh Exp $    */
+/*     $NetBSD: types.h,v 1.9 2000/06/11 16:32:45 tsubai Exp $ */
 
 /*-
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -71,4 +71,6 @@
 
 typedef        int32_t                 register_t;
 
+#define __HAVE_CPU_COUNTER
+
 #endif /* _MACHTYPES_H_ */
diff -r d919826c4330 -r 79d589405542 sys/arch/prep/include/rnd.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/prep/include/rnd.h       Sun Jun 11 16:32:42 2000 +0000
@@ -0,0 +1,3 @@
+/*     $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:44 tsubai Exp $   */
+
+#include <powerpc/rnd.h>



Home | Main Index | Thread Index | Old Index