diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2005-09-21 21:50:51 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-09-21 21:50:51 -0400 |
commit | 2a7e2990340a1c42321d79dc99755683ea5a1026 (patch) | |
tree | 4423f305fd52c7a28a38f00cd826d01ad60f2e97 /arch/sparc64/kernel/entry.S | |
parent | efb0372bbaf5b829ff8c39db372779928af542a7 (diff) |
[SPARC64]: Move kernel TLB miss handling into a seperate file.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/entry.S')
-rw-r--r-- | arch/sparc64/kernel/entry.S | 153 |
1 files changed, 0 insertions, 153 deletions
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S index b48349527853..45cd3bbdb7e0 100644 --- a/arch/sparc64/kernel/entry.S +++ b/arch/sparc64/kernel/entry.S | |||
@@ -30,159 +30,6 @@ | |||
30 | .text | 30 | .text |
31 | .align 32 | 31 | .align 32 |
32 | 32 | ||
33 | .globl sparc64_vpte_patchme1 | ||
34 | .globl sparc64_vpte_patchme2 | ||
35 | /* | ||
36 | * On a second level vpte miss, check whether the original fault is to the OBP | ||
37 | * range (note that this is only possible for instruction miss, data misses to | ||
38 | * obp range do not use vpte). If so, go back directly to the faulting address. | ||
39 | * This is because we want to read the tpc, otherwise we have no way of knowing | ||
40 | * the 8k aligned faulting address if we are using >8k kernel pagesize. This | ||
41 | * also ensures no vpte range addresses are dropped into tlb while obp is | ||
42 | * executing (see inherit_locked_prom_mappings() rant). | ||
43 | */ | ||
44 | sparc64_vpte_nucleus: | ||
45 | /* Note that kvmap below has verified that the address is | ||
46 | * in the range MODULES_VADDR --> VMALLOC_END already. So | ||
47 | * here we need only check if it is an OBP address or not. | ||
48 | */ | ||
49 | sethi %hi(LOW_OBP_ADDRESS), %g5 | ||
50 | cmp %g4, %g5 | ||
51 | blu,pn %xcc, sparc64_vpte_patchme1 | ||
52 | mov 0x1, %g5 | ||
53 | sllx %g5, 32, %g5 | ||
54 | cmp %g4, %g5 | ||
55 | blu,pn %xcc, obp_iaddr_patch | ||
56 | nop | ||
57 | |||
58 | /* These two instructions are patched by paginig_init(). */ | ||
59 | sparc64_vpte_patchme1: | ||
60 | sethi %hi(0), %g5 | ||
61 | sparc64_vpte_patchme2: | ||
62 | or %g5, %lo(0), %g5 | ||
63 | |||
64 | /* With kernel PGD in %g5, branch back into dtlb_backend. */ | ||
65 | ba,pt %xcc, sparc64_kpte_continue | ||
66 | andn %g1, 0x3, %g1 /* Finish PMD offset adjustment. */ | ||
67 | |||
68 | vpte_noent: | ||
69 | /* Restore previous TAG_ACCESS, %g5 is zero, and we will | ||
70 | * skip over the trap instruction so that the top level | ||
71 | * TLB miss handler will thing this %g5 value is just an | ||
72 | * invalid PTE, thus branching to full fault processing. | ||
73 | */ | ||
74 | mov TLB_SFSR, %g1 | ||
75 | stxa %g4, [%g1 + %g1] ASI_DMMU | ||
76 | done | ||
77 | |||
78 | .globl obp_iaddr_patch | ||
79 | obp_iaddr_patch: | ||
80 | /* These two instructions patched by inherit_prom_mappings(). */ | ||
81 | sethi %hi(0), %g5 | ||
82 | or %g5, %lo(0), %g5 | ||
83 | |||
84 | /* Behave as if we are at TL0. */ | ||
85 | wrpr %g0, 1, %tl | ||
86 | rdpr %tpc, %g4 /* Find original faulting iaddr */ | ||
87 | srlx %g4, 13, %g4 /* Throw out context bits */ | ||
88 | sllx %g4, 13, %g4 /* g4 has vpn + ctx0 now */ | ||
89 | |||
90 | /* Restore previous TAG_ACCESS. */ | ||
91 | mov TLB_SFSR, %g1 | ||
92 | stxa %g4, [%g1 + %g1] ASI_IMMU | ||
93 | |||
94 | /* Get PMD offset. */ | ||
95 | srlx %g4, 23, %g6 | ||
96 | and %g6, 0x7ff, %g6 | ||
97 | sllx %g6, 2, %g6 | ||
98 | |||
99 | /* Load PMD, is it valid? */ | ||
100 | lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5 | ||
101 | brz,pn %g5, longpath | ||
102 | sllx %g5, 11, %g5 | ||
103 | |||
104 | /* Get PTE offset. */ | ||
105 | srlx %g4, 13, %g6 | ||
106 | and %g6, 0x3ff, %g6 | ||
107 | sllx %g6, 3, %g6 | ||
108 | |||
109 | /* Load PTE. */ | ||
110 | ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5 | ||
111 | brgez,pn %g5, longpath | ||
112 | nop | ||
113 | |||
114 | /* TLB load and return from trap. */ | ||
115 | stxa %g5, [%g0] ASI_ITLB_DATA_IN | ||
116 | retry | ||
117 | |||
118 | .globl obp_daddr_patch | ||
119 | obp_daddr_patch: | ||
120 | /* These two instructions patched by inherit_prom_mappings(). */ | ||
121 | sethi %hi(0), %g5 | ||
122 | or %g5, %lo(0), %g5 | ||
123 | |||
124 | /* Get PMD offset. */ | ||
125 | srlx %g4, 23, %g6 | ||
126 | and %g6, 0x7ff, %g6 | ||
127 | sllx %g6, 2, %g6 | ||
128 | |||
129 | /* Load PMD, is it valid? */ | ||
130 | lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5 | ||
131 | brz,pn %g5, longpath | ||
132 | sllx %g5, 11, %g5 | ||
133 | |||
134 | /* Get PTE offset. */ | ||
135 | srlx %g4, 13, %g6 | ||
136 | and %g6, 0x3ff, %g6 | ||
137 | sllx %g6, 3, %g6 | ||
138 | |||
139 | /* Load PTE. */ | ||
140 | ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5 | ||
141 | brgez,pn %g5, longpath | ||
142 | nop | ||
143 | |||
144 | /* TLB load and return from trap. */ | ||
145 | stxa %g5, [%g0] ASI_DTLB_DATA_IN | ||
146 | retry | ||
147 | |||
148 | /* | ||
149 | * On a first level data miss, check whether this is to the OBP range (note | ||
150 | * that such accesses can be made by prom, as well as by kernel using | ||
151 | * prom_getproperty on "address"), and if so, do not use vpte access ... | ||
152 | * rather, use information saved during inherit_prom_mappings() using 8k | ||
153 | * pagesize. | ||
154 | */ | ||
155 | .align 32 | ||
156 | kvmap: | ||
157 | sethi %hi(MODULES_VADDR), %g5 | ||
158 | cmp %g4, %g5 | ||
159 | blu,pn %xcc, longpath | ||
160 | mov (VMALLOC_END >> 24), %g5 | ||
161 | sllx %g5, 24, %g5 | ||
162 | cmp %g4, %g5 | ||
163 | bgeu,pn %xcc, longpath | ||
164 | nop | ||
165 | |||
166 | kvmap_check_obp: | ||
167 | sethi %hi(LOW_OBP_ADDRESS), %g5 | ||
168 | cmp %g4, %g5 | ||
169 | blu,pn %xcc, kvmap_vmalloc_addr | ||
170 | mov 0x1, %g5 | ||
171 | sllx %g5, 32, %g5 | ||
172 | cmp %g4, %g5 | ||
173 | blu,pn %xcc, obp_daddr_patch | ||
174 | nop | ||
175 | |||
176 | kvmap_vmalloc_addr: | ||
177 | /* If we get here, a vmalloc addr was accessed, load kernel VPTE. */ | ||
178 | ldxa [%g3 + %g6] ASI_N, %g5 | ||
179 | brgez,pn %g5, longpath | ||
180 | nop | ||
181 | |||
182 | /* PTE is valid, load into TLB and return from trap. */ | ||
183 | stxa %g5, [%g0] ASI_DTLB_DATA_IN ! Reload TLB | ||
184 | retry | ||
185 | |||
186 | /* This is trivial with the new code... */ | 33 | /* This is trivial with the new code... */ |
187 | .globl do_fpdis | 34 | .globl do_fpdis |
188 | do_fpdis: | 35 | do_fpdis: |