summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authortsubai <tsubai@NetBSD.org>2000-06-11 16:32:42 +0000
committertsubai <tsubai@NetBSD.org>2000-06-11 16:32:42 +0000
commit1bfa0fc6b61ec17271f8dcd1b8d95ea46cda61a5 (patch)
tree7bab4663551224ea32aea02f777388f6c470c49f /sys/arch
parent598be7b0b7a041c93680f1f9fcf8134cddd6efe5 (diff)
Add cpu_counter().
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amigappc/include/rnd.h3
-rw-r--r--sys/arch/bebox/include/rnd.h3
-rw-r--r--sys/arch/macppc/include/rnd.h3
-rw-r--r--sys/arch/ofppc/include/rnd.h3
-rw-r--r--sys/arch/powerpc/include/rnd.h51
-rw-r--r--sys/arch/powerpc/include/types.h4
-rw-r--r--sys/arch/prep/include/rnd.h3
7 files changed, 69 insertions, 1 deletions
diff --git a/sys/arch/amigappc/include/rnd.h b/sys/arch/amigappc/include/rnd.h
new file mode 100644
index 00000000000..2a1f01058f2
--- /dev/null
+++ b/sys/arch/amigappc/include/rnd.h
@@ -0,0 +1,3 @@
+/* $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:42 tsubai Exp $ */
+
+#include <powerpc/rnd.h>
diff --git a/sys/arch/bebox/include/rnd.h b/sys/arch/bebox/include/rnd.h
new file mode 100644
index 00000000000..a6d83f44746
--- /dev/null
+++ b/sys/arch/bebox/include/rnd.h
@@ -0,0 +1,3 @@
+/* $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:43 tsubai Exp $ */
+
+#include <powerpc/rnd.h>
diff --git a/sys/arch/macppc/include/rnd.h b/sys/arch/macppc/include/rnd.h
new file mode 100644
index 00000000000..a6d83f44746
--- /dev/null
+++ b/sys/arch/macppc/include/rnd.h
@@ -0,0 +1,3 @@
+/* $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:43 tsubai Exp $ */
+
+#include <powerpc/rnd.h>
diff --git a/sys/arch/ofppc/include/rnd.h b/sys/arch/ofppc/include/rnd.h
new file mode 100644
index 00000000000..80d3fca2e94
--- /dev/null
+++ b/sys/arch/ofppc/include/rnd.h
@@ -0,0 +1,3 @@
+/* $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:44 tsubai Exp $ */
+
+#include <powerpc/rnd.h>
diff --git a/sys/arch/powerpc/include/rnd.h b/sys/arch/powerpc/include/rnd.h
new file mode 100644
index 00000000000..f162468b3eb
--- /dev/null
+++ b/sys/arch/powerpc/include/rnd.h
@@ -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 --git a/sys/arch/powerpc/include/types.h b/sys/arch/powerpc/include/types.h
index c81af95cc15..77b185136bf 100644
--- a/sys/arch/powerpc/include/types.h
+++ b/sys/arch/powerpc/include/types.h
@@ -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 unsigned long long u_int64_t;
typedef int32_t register_t;
+#define __HAVE_CPU_COUNTER
+
#endif /* _MACHTYPES_H_ */
diff --git a/sys/arch/prep/include/rnd.h b/sys/arch/prep/include/rnd.h
new file mode 100644
index 00000000000..80d3fca2e94
--- /dev/null
+++ b/sys/arch/prep/include/rnd.h
@@ -0,0 +1,3 @@
+/* $NetBSD: rnd.h,v 1.1 2000/06/11 16:32:44 tsubai Exp $ */
+
+#include <powerpc/rnd.h>