Page MenuHomeFreeBSD

D18462.diff
No OneTemporary

D18462.diff

Index: head/sys/riscv/include/cpufunc.h
===================================================================
--- head/sys/riscv/include/cpufunc.h
+++ head/sys/riscv/include/cpufunc.h
@@ -109,6 +109,13 @@
#define rdinstret() csr_read64(instret)
#define rdhpmcounter(n) csr_read64(hpmcounter##n)
+static __inline void
+load_satp(uint64_t val)
+{
+
+ __asm __volatile("csrw satp, %0" :: "r"(val));
+}
+
#define cpufunc_nullop() riscv_nullop()
void riscv_nullop(void);
Index: head/sys/riscv/riscv/locore.S
===================================================================
--- head/sys/riscv/riscv/locore.S
+++ head/sys/riscv/riscv/locore.S
@@ -152,7 +152,7 @@
li t0, SATP_MODE_SV39
or s2, s2, t0
sfence.vma
- csrw sptbr, s2
+ csrw satp, s2
.align 2
va:
@@ -297,7 +297,7 @@
li t0, SATP_MODE_SV39
or s2, s2, t0
sfence.vma
- csrw sptbr, s2
+ csrw satp, s2
.align 2
mpva:
Index: head/sys/riscv/riscv/pmap.c
===================================================================
--- head/sys/riscv/riscv/pmap.c
+++ head/sys/riscv/riscv/pmap.c
@@ -3302,7 +3302,7 @@
reg = SATP_MODE_SV39;
reg |= (td->td_pcb->pcb_l1addr >> PAGE_SHIFT);
- __asm __volatile("csrw sptbr, %0" :: "r"(reg));
+ load_satp(reg);
pmap_invalidate_all(pmap);
critical_exit();
Index: head/sys/riscv/riscv/swtch.S
===================================================================
--- head/sys/riscv/riscv/swtch.S
+++ head/sys/riscv/riscv/swtch.S
@@ -223,7 +223,7 @@
srli t0, t0, PAGE_SHIFT
li t1, SATP_MODE_SV39
or t0, t0, t1
- csrw sptbr, t0
+ csrw satp, t0
/* TODO: Invalidate the TLB */
@@ -341,7 +341,7 @@
srli t0, t0, PAGE_SHIFT
li t1, SATP_MODE_SV39
or t0, t0, t1
- csrw sptbr, t0
+ csrw satp, t0
/* TODO: Invalidate the TLB */

File Metadata

Mime Type
text/plain
Expires
Wed, Feb 11, 2:05 PM (11 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28653974
Default Alt Text
D18462.diff (1 KB)

Event Timeline