summaryrefslogtreecommitdiffstats
path: root/arch/sparc/mm/srmmu_access.S
blob: d0a67b2c2383c725ab4ca11dc72b03436d399da1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Assembler variants of srmmu access functions.
 * Implemented in assembler to allow run-time patching.
 * LEON uses a different ASI for MMUREGS than SUN.
 *
 * The leon_1insn_patch infrastructure is used
 * for the run-time patching.
 */

#include <linux/linkage.h>

#include <asm/asmmacro.h>
#include <asm/pgtsrmmu.h>
#include <asm/asi.h>

/* unsigned int srmmu_get_mmureg(void) */
ENTRY(srmmu_get_mmureg)
LEON_PI(lda	[%g0] ASI_LEON_MMUREGS, %o0)
SUN_PI_(lda	[%g0] ASI_M_MMUREGS, %o0)
	retl
	 nop
ENDPROC(srmmu_get_mmureg)

/* void srmmu_set_mmureg(unsigned long regval) */
ENTRY(srmmu_set_mmureg)
LEON_PI(sta	%o0, [%g0] ASI_LEON_MMUREGS)
SUN_PI_(sta	%o0, [%g0] ASI_M_MMUREGS)
	retl
	 nop
ENDPROC(srmmu_set_mmureg)

/* void srmmu_set_ctable_ptr(unsigned long paddr) */
ENTRY(srmmu_set_ctable_ptr)
	/* paddr = ((paddr >> 4) & SRMMU_CTX_PMASK); */
	srl	%o0, 4, %g1
	and	%g1, SRMMU_CTX_PMASK, %g1

	mov	SRMMU_CTXTBL_PTR, %g2
LEON_PI(sta	%g1, [%g2] ASI_LEON_MMUREGS)
SUN_PI_(sta	%g1, [%g2] ASI_M_MMUREGS)
	retl
	 nop
ENDPROC(srmmu_set_ctable_ptr)


/* void srmmu_set_context(int context) */
ENTRY(srmmu_set_context)
	mov	SRMMU_CTX_REG, %g1
LEON_PI(sta	%o0, [%g1] ASI_LEON_MMUREGS)
SUN_PI_(sta	%o0, [%g1] ASI_M_MMUREGS)
	retl
	 nop
ENDPROC(srmmu_set_context)


/* int srmmu_get_context(void) */
ENTRY(srmmu_get_context)
	mov	SRMMU_CTX_REG, %o0
LEON_PI(lda     [%o0] ASI_LEON_MMUREGS, %o0)
SUN_PI_(lda	[%o0] ASI_M_MMUREGS, %o0)
	retl
	 nop
ENDPROC(srmmu_get_context)


/* unsigned int srmmu_get_fstatus(void) */
ENTRY(srmmu_get_fstatus)
	mov	SRMMU_FAULT_STATUS, %o0
LEON_PI(lda     [%o0] ASI_LEON_MMUREGS, %o0)
SUN_PI_(lda	[%o0] ASI_M_MMUREGS, %o0)
	retl
	 nop
ENDPROC(srmmu_get_fstatus)


/* unsigned int srmmu_get_faddr(void) */
ENTRY(srmmu_get_faddr)
	mov	SRMMU_FAULT_ADDR, %o0
LEON_PI(lda     [%o0] ASI_LEON_MMUREGS, %o0)
SUN_PI_(lda	[%o0] ASI_M_MMUREGS, %o0)
	retl
	 nop
ENDPROC(srmmu_get_faddr)
OpenPOWER on IntegriCloud