summaryrefslogtreecommitdiff
path: root/kernel/riscv.h
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2019-07-02 13:40:33 -0400
committerFrans Kaashoek <[email protected]>2019-07-02 13:40:33 -0400
commitda51735980e500922bc108a3444b64ac9450032e (patch)
tree76ad738ff42f56a36ea2300b2d90946e64d5040e /kernel/riscv.h
parent67702cf706bce7adef472f0caa48d81ddfaeb33a (diff)
downloadxv6-labs-da51735980e500922bc108a3444b64ac9450032e.tar.gz
xv6-labs-da51735980e500922bc108a3444b64ac9450032e.tar.bz2
xv6-labs-da51735980e500922bc108a3444b64ac9450032e.zip
Avoid two cores selecting the same process to run
Diffstat (limited to 'kernel/riscv.h')
-rw-r--r--kernel/riscv.h9
1 files changed, 9 insertions, 0 deletions
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