1 ###############################################################################
3 # TLB loading functions
5 # Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
6 # Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 # Modified by David Howells (dhowells@redhat.com)
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public Licence
11 # as published by the Free Software Foundation; either version
12 # 2 of the Licence, or (at your option) any later version.
14 ###############################################################################
15 #include <linux/sys.h>
16 #include <linux/linkage.h>
18 #include <asm/intctl-regs.h>
19 #include <asm/frame.inc>
21 #include <asm/pgtable.h>
23 ###############################################################################
25 # Instruction TLB Miss handler entry point
27 ###############################################################################
28 .type itlb_miss,@function
33 or EPSW_nAR,epsw # switch D0-D3 & A0-A3 to the alternate
40 #if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
51 mov (a2,d2),a2 # PTD *ptd = PGD[addr 31..22]
53 beq itlb_miss_fault # jump if doesn't point anywhere
60 mov (a2),d2 # get pte from PTD[addr 21..12]
62 beq itlb_miss_fault # jump if doesn't point to a page
63 # (might be a swap id)
64 #if ((_PAGE_ACCESSED & 0xffffff00) == 0)
65 bset _PAGE_ACCESSED,(0,a2)
66 #elif ((_PAGE_ACCESSED & 0xffff00ff) == 0)
67 bset +(_PAGE_ACCESSED >> 8),(1,a2)
69 #error "_PAGE_ACCESSED value is out of range"
71 and ~xPTEL2_UNUSED1,d2
73 mov d2,(IPTEL2) # change the TLB
80 mov _PAGE_VALID,d2 # force address error handler to be
84 .size itlb_miss, . - itlb_miss
86 ###############################################################################
88 # Data TLB Miss handler entry point
90 ###############################################################################
91 .type dtlb_miss,@function
96 or EPSW_nAR,epsw # switch D0-D3 & A0-A3 to the alternate
103 #if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
114 mov (a2,d2),a2 # PTD *ptd = PGD[addr 31..22]
116 beq dtlb_miss_fault # jump if doesn't point anywhere
118 and ~(PAGE_SIZE-1),a2
123 mov (a2),d2 # get pte from PTD[addr 21..12]
125 beq dtlb_miss_fault # jump if doesn't point to a page
126 # (might be a swap id)
127 #if ((_PAGE_ACCESSED & 0xffffff00) == 0)
128 bset _PAGE_ACCESSED,(0,a2)
129 #elif ((_PAGE_ACCESSED & 0xffff00ff) == 0)
130 bset +(_PAGE_ACCESSED >> 8),(1,a2)
132 #error "_PAGE_ACCESSED value is out of range"
134 and ~xPTEL2_UNUSED1,d2
136 mov d2,(DPTEL2) # change the TLB
137 #ifdef CONFIG_GDBSTUB
143 mov _PAGE_VALID,d2 # force address error handler to be
146 .size dtlb_miss, . - dtlb_miss
148 ###############################################################################
150 # Instruction TLB Address Error handler entry point
152 ###############################################################################
153 .type itlb_aerror,@function
158 #if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
164 add -4,sp # need to pass three params
166 # calculate the fault code
167 movhu (MMUFCR_IFC),d1
168 or 0x00010000,d1 # it's an instruction fetch
170 # determine the page address
180 call do_page_fault[],0 # do_page_fault(regs,code,addr
182 jmp ret_from_exception
183 .size itlb_aerror, . - itlb_aerror
185 ###############################################################################
187 # Data TLB Address Error handler entry point
189 ###############################################################################
190 .type dtlb_aerror,@function
195 #if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
200 add -4,sp # need to pass three params
203 # calculate the fault code
204 movhu (MMUFCR_DFC),d1
206 # determine the page address
217 call do_page_fault[],0 # do_page_fault(regs,code,addr
219 jmp ret_from_exception
220 .size dtlb_aerror, . - dtlb_aerror