riscv: abstract out CSR names for supervisor vs machine mode
Many of the privileged CSRs exist in a supervisor and machine version that are used very similarly. Provide versions of the CSR names and fields that map to either the S-mode or M-mode variant depending on a new CONFIG_RISCV_M_MODE kconfig symbol. Contains contributions from Damien Le Moal <Damien.LeMoal@wdc.com> and Paul Walmsley <paul.walmsley@sifive.com>. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> # for drivers/clocksource, drivers/irqchip [paul.walmsley@sifive.com: updated to apply] Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
This commit is contained in:
committed by
Paul Walmsley
parent
0c3ac28931
commit
a4c3733d32
@@ -18,7 +18,7 @@ ENTRY(__asm_copy_from_user)
|
||||
|
||||
/* Enable access to user memory */
|
||||
li t6, SR_SUM
|
||||
csrs CSR_SSTATUS, t6
|
||||
csrs CSR_STATUS, t6
|
||||
|
||||
add a3, a1, a2
|
||||
/* Use word-oriented copy only if low-order bits match */
|
||||
@@ -47,7 +47,7 @@ ENTRY(__asm_copy_from_user)
|
||||
|
||||
3:
|
||||
/* Disable access to user memory */
|
||||
csrc CSR_SSTATUS, t6
|
||||
csrc CSR_STATUS, t6
|
||||
li a0, 0
|
||||
ret
|
||||
4: /* Edge case: unalignment */
|
||||
@@ -72,7 +72,7 @@ ENTRY(__clear_user)
|
||||
|
||||
/* Enable access to user memory */
|
||||
li t6, SR_SUM
|
||||
csrs CSR_SSTATUS, t6
|
||||
csrs CSR_STATUS, t6
|
||||
|
||||
add a3, a0, a1
|
||||
addi t0, a0, SZREG-1
|
||||
@@ -94,7 +94,7 @@ ENTRY(__clear_user)
|
||||
|
||||
3:
|
||||
/* Disable access to user memory */
|
||||
csrc CSR_SSTATUS, t6
|
||||
csrc CSR_STATUS, t6
|
||||
li a0, 0
|
||||
ret
|
||||
4: /* Edge case: unalignment */
|
||||
@@ -114,11 +114,11 @@ ENDPROC(__clear_user)
|
||||
/* Fixup code for __copy_user(10) and __clear_user(11) */
|
||||
10:
|
||||
/* Disable access to user memory */
|
||||
csrs CSR_SSTATUS, t6
|
||||
csrs CSR_STATUS, t6
|
||||
mv a0, a2
|
||||
ret
|
||||
11:
|
||||
csrs CSR_SSTATUS, t6
|
||||
csrs CSR_STATUS, t6
|
||||
mv a0, a1
|
||||
ret
|
||||
.previous
|
||||
|
||||
Reference in New Issue
Block a user