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 bset _PAGE_ACCESSED,(0,a2)
65 and ~(xPTEL_UNUSED1|xPTEL_UNUSED2),d2
67 mov d2,(IPTEL) # change the TLB
74 mov _PAGE_VALID,d2 # force address error handler to be
78 .size itlb_miss, . - itlb_miss
80 ###############################################################################
82 # Data TLB Miss handler entry point
84 ###############################################################################
85 .type dtlb_miss,@function
90 or EPSW_nAR,epsw # switch D0-D3 & A0-A3 to the alternate
97 #if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
108 mov (a2,d2),a2 # PTD *ptd = PGD[addr 31..22]
110 beq dtlb_miss_fault # jump if doesn't point anywhere
112 and ~(PAGE_SIZE-1),a2
117 mov (a2),d2 # get pte from PTD[addr 21..12]
119 beq dtlb_miss_fault # jump if doesn't point to a page
120 # (might be a swap id)
121 bset _PAGE_ACCESSED,(0,a2)
122 and ~(xPTEL_UNUSED1|xPTEL_UNUSED2),d2
124 mov d2,(DPTEL) # change the TLB
125 #ifdef CONFIG_GDBSTUB
131 mov _PAGE_VALID,d2 # force address error handler to be
134 .size dtlb_miss, . - dtlb_miss
136 ###############################################################################
138 # Instruction TLB Address Error handler entry point
140 ###############################################################################
141 .type itlb_aerror,@function
146 #if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
152 add -4,sp # need to pass three params
154 # calculate the fault code
155 movhu (MMUFCR_IFC),d1
156 or 0x00010000,d1 # it's an instruction fetch
158 # determine the page address
169 call do_page_fault[],0 # do_page_fault(regs,code,addr
171 jmp ret_from_exception
172 .size itlb_aerror, . - itlb_aerror
174 ###############################################################################
176 # Data TLB Address Error handler entry point
178 ###############################################################################
179 .type dtlb_aerror,@function
184 #if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
189 add -4,sp # need to pass three params
192 # calculate the fault code
193 movhu (MMUFCR_DFC),d1
195 # determine the page address
206 call do_page_fault[],0 # do_page_fault(regs,code,addr
208 jmp ret_from_exception
209 .size dtlb_aerror, . - dtlb_aerror