mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 14:48:57 +00:00
Rename sptbr to satp per v1.10 of the privileged architecture spec.
Add a subroutine for updating satp, for use when updating the active pmap. No functional change intended. Reviewed by: jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18462
This commit is contained in:
parent
08c4a937a6
commit
1f5e341b46
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=341693
@ -109,6 +109,13 @@ sfence_vma_page(uintptr_t addr)
|
||||
#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);
|
||||
|
@ -152,7 +152,7 @@ _start:
|
||||
li t0, SATP_MODE_SV39
|
||||
or s2, s2, t0
|
||||
sfence.vma
|
||||
csrw sptbr, s2
|
||||
csrw satp, s2
|
||||
|
||||
.align 2
|
||||
va:
|
||||
@ -297,7 +297,7 @@ ENTRY(mpentry)
|
||||
li t0, SATP_MODE_SV39
|
||||
or s2, s2, t0
|
||||
sfence.vma
|
||||
csrw sptbr, s2
|
||||
csrw satp, s2
|
||||
|
||||
.align 2
|
||||
mpva:
|
||||
|
@ -3302,7 +3302,7 @@ pmap_activate(struct thread *td)
|
||||
|
||||
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();
|
||||
|
@ -223,7 +223,7 @@ ENTRY(cpu_throw)
|
||||
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 @@ ENTRY(cpu_switch)
|
||||
srli t0, t0, PAGE_SHIFT
|
||||
li t1, SATP_MODE_SV39
|
||||
or t0, t0, t1
|
||||
csrw sptbr, t0
|
||||
csrw satp, t0
|
||||
|
||||
/* TODO: Invalidate the TLB */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user