From da51735980e500922bc108a3444b64ac9450032e Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Tue, 2 Jul 2019 13:40:33 -0400 Subject: Avoid two cores selecting the same process to run --- kernel/riscv.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'kernel/riscv.h') diff --git a/kernel/riscv.h b/kernel/riscv.h index c3371a4..e5c0f64 100644 --- a/kernel/riscv.h +++ b/kernel/riscv.h @@ -304,6 +304,15 @@ w_tp(uint64 x) asm volatile("mv tp, %0" : : "r" (x)); } +static inline uint64 +r_ra() +{ + uint64 x; + asm volatile("mv %0, ra" : "=r" (x) ); + return x; +} + + #define PGSIZE 4096 // bytes per page #define PGSHIFT 12 // bits of offset within a page -- cgit v1.2.3