1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Assembler variants of srmmu access functions. 3 * Implemented in assembler to allow run-time patching. 4 * LEON uses a different ASI for MMUREGS than SUN. 5 * 6 * The leon_1insn_patch infrastructure is used 7 * for the run-time patching. 8 */ 9 10 #include <linux/linkage.h> 11 12 #include <asm/asmmacro.h> 13 #include <asm/pgtsrmmu.h> 14 #include <asm/asi.h> 15 16 /* unsigned int srmmu_get_mmureg(void) */ 17 ENTRY(srmmu_get_mmureg) 18 LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %o0) 19 SUN_PI_(lda [%g0] ASI_M_MMUREGS, %o0) 20 retl 21 nop 22 ENDPROC(srmmu_get_mmureg) 23 24 /* void srmmu_set_mmureg(unsigned long regval) */ 25 ENTRY(srmmu_set_mmureg) 26 LEON_PI(sta %o0, [%g0] ASI_LEON_MMUREGS) 27 SUN_PI_(sta %o0, [%g0] ASI_M_MMUREGS) 28 retl 29 nop 30 ENDPROC(srmmu_set_mmureg) 31 32 /* void srmmu_set_ctable_ptr(unsigned long paddr) */ 33 ENTRY(srmmu_set_ctable_ptr) 34 /* paddr = ((paddr >> 4) & SRMMU_CTX_PMASK); */ 35 srl %o0, 4, %g1 36 and %g1, SRMMU_CTX_PMASK, %g1 37 38 mov SRMMU_CTXTBL_PTR, %g2 39 LEON_PI(sta %g1, [%g2] ASI_LEON_MMUREGS) 40 SUN_PI_(sta %g1, [%g2] ASI_M_MMUREGS) 41 retl 42 nop 43 ENDPROC(srmmu_set_ctable_ptr) 44 45 46 /* void srmmu_set_context(int context) */ 47 ENTRY(srmmu_set_context) 48 mov SRMMU_CTX_REG, %g1 49 LEON_PI(sta %o0, [%g1] ASI_LEON_MMUREGS) 50 SUN_PI_(sta %o0, [%g1] ASI_M_MMUREGS) 51 retl 52 nop 53 ENDPROC(srmmu_set_context) 54 55 56 /* int srmmu_get_context(void) */ 57 ENTRY(srmmu_get_context) 58 mov SRMMU_CTX_REG, %o0 59 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0) 60 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0) 61 retl 62 nop 63 ENDPROC(srmmu_get_context) 64 65 66 /* unsigned int srmmu_get_fstatus(void) */ 67 ENTRY(srmmu_get_fstatus) 68 mov SRMMU_FAULT_STATUS, %o0 69 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0) 70 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0) 71 retl 72 nop 73 ENDPROC(srmmu_get_fstatus) 74 75 76 /* unsigned int srmmu_get_faddr(void) */ 77 ENTRY(srmmu_get_faddr) 78 mov SRMMU_FAULT_ADDR, %o0 79 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0) 80 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0) 81 retl 82 nop 83 ENDPROC(srmmu_get_faddr)
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.