Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/riscv/include Define curcpu() as lwp_getcpu(curlwp)...
details: https://anonhg.NetBSD.org/src/rev/0ecc74fff472
branches: trunk
changeset: 337038:0ecc74fff472
user: matt <matt%NetBSD.org@localhost>
date: Tue Mar 31 01:11:41 2015 +0000
description:
Define curcpu() as lwp_getcpu(curlwp) since curlwp is always in the "tp"
(thread pointer) register.
diffstat:
sys/arch/riscv/include/cpu.h | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diffs (31 lines):
diff -r 2a7cf1b2c55d -r 0ecc74fff472 sys/arch/riscv/include/cpu.h
--- a/sys/arch/riscv/include/cpu.h Tue Mar 31 01:10:02 2015 +0000
+++ b/sys/arch/riscv/include/cpu.h Tue Mar 31 01:11:41 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.2 2015/03/28 16:13:56 matt Exp $ */
+/* $NetBSD: cpu.h,v 1.3 2015/03/31 01:11:41 matt Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -81,16 +81,13 @@
extern struct cpu_info cpu_info_store;
+// This is also in <sys/lwp.h>
+struct lwp;
+static inline struct cpu_info *lwp_getcpu(struct lwp *);
+
register struct lwp *riscv_curlwp __asm("tp");
#define curlwp riscv_curlwp
-
-static inline struct cpu_info *
-curcpu(void)
-{
- struct cpu_info *ci;
- __asm("csrr\t%0, sscratch" : "=r"(ci));
- return ci;
-}
+#define curcpu() lwp_getcpu(curlwp)
static inline cpuid_t
cpu_number(void)
Home |
Main Index |
Thread Index |
Old Index