1 /* Assembler variants of srmmu access functions.
2 * Implemented in assembler to allow run-time patching.
3 * LEON uses a different ASI for MMUREGS than SUN.
5 * The leon_1insn_patch infrastructure is used
6 * for the run-time patching.
9 #include <linux/linkage.h>
11 #include <asm/asmmacro.h>
12 #include <asm/pgtsrmmu.h>
15 /* unsigned int srmmu_get_mmureg(void) */
16 ENTRY(srmmu_get_mmureg)
17 LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %o0)
18 SUN_PI_(lda [%g0] ASI_M_MMUREGS, %o0)
21 ENDPROC(srmmu_get_mmureg)
23 /* void srmmu_set_mmureg(unsigned long regval) */
24 ENTRY(srmmu_set_mmureg)
25 LEON_PI(sta %o0, [%g0] ASI_LEON_MMUREGS)
26 SUN_PI_(sta %o0, [%g0] ASI_M_MMUREGS)
29 ENDPROC(srmmu_set_mmureg)
31 /* void srmmu_set_ctable_ptr(unsigned long paddr) */
32 ENTRY(srmmu_set_ctable_ptr)
33 /* paddr = ((paddr >> 4) & SRMMU_CTX_PMASK); */
35 and %g1, SRMMU_CTX_PMASK, %g1
37 mov SRMMU_CTXTBL_PTR, %g2
38 LEON_PI(sta %g1, [%g2] ASI_LEON_MMUREGS)
39 SUN_PI_(sta %g1, [%g2] ASI_M_MMUREGS)
42 ENDPROC(srmmu_set_ctable_ptr)
45 /* void srmmu_set_context(int context) */
46 ENTRY(srmmu_set_context)
47 mov SRMMU_CTX_REG, %g1
48 LEON_PI(sta %o0, [%g1] ASI_LEON_MMUREGS)
49 SUN_PI_(sta %o0, [%g1] ASI_M_MMUREGS)
52 ENDPROC(srmmu_set_context)
55 /* int srmmu_get_context(void) */
56 ENTRY(srmmu_get_context)
57 mov SRMMU_CTX_REG, %o0
58 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0)
59 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0)
62 ENDPROC(srmmu_get_context)
65 /* unsigned int srmmu_get_fstatus(void) */
66 ENTRY(srmmu_get_fstatus)
67 mov SRMMU_FAULT_STATUS, %o0
68 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0)
69 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0)
72 ENDPROC(srmmu_get_fstatus)
75 /* unsigned int srmmu_get_faddr(void) */
76 ENTRY(srmmu_get_faddr)
77 mov SRMMU_FAULT_ADDR, %o0
78 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0)
79 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0)
82 ENDPROC(srmmu_get_faddr)