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
34 or EPSW_nAR,epsw # switch D0-D3 & A0-A3 to the alternate
46 mov (a2,d2),a2 # PTD *ptd = PGD[addr 31..22]
48 beq itlb_miss_fault # jump if doesn't point anywhere
55 mov (a2),d2 # get pte from PTD[addr 21..12]
57 beq itlb_miss_fault # jump if doesn't point to a page
58 # (might be a swap id)
59 bset _PAGE_ACCESSED,(0,a2)
60 and ~(xPTEL_UNUSED1|xPTEL_UNUSED2),d2
62 mov d2,(IPTEL) # change the TLB
69 mov _PAGE_VALID,d2 # force address error handler to be
73 .size itlb_miss, . - itlb_miss
75 ###############################################################################
77 # Data TLB Miss handler entry point
79 ###############################################################################
80 .type dtlb_miss,@function
86 or EPSW_nAR,epsw # switch D0-D3 & A0-A3 to the alternate
98 mov (a2,d2),a2 # PTD *ptd = PGD[addr 31..22]
100 beq dtlb_miss_fault # jump if doesn't point anywhere
102 and ~(PAGE_SIZE-1),a2
107 mov (a2),d2 # get pte from PTD[addr 21..12]
109 beq dtlb_miss_fault # jump if doesn't point to a page
110 # (might be a swap id)
111 bset _PAGE_ACCESSED,(0,a2)
112 and ~(xPTEL_UNUSED1|xPTEL_UNUSED2),d2
114 mov d2,(DPTEL) # change the TLB
115 #ifdef CONFIG_GDBSTUB
121 mov _PAGE_VALID,d2 # force address error handler to be
124 .size dtlb_miss, . - dtlb_miss
126 ###############################################################################
128 # Instruction TLB Address Error handler entry point
130 ###############################################################################
131 .type itlb_aerror,@function
136 add -4,sp # need to pass three params
138 # calculate the fault code
139 movhu (MMUFCR_IFC),d1
140 or 0x00010000,d1 # it's an instruction fetch
142 # determine the page address
154 call do_page_fault[],0 # do_page_fault(regs,code,addr
156 jmp ret_from_exception
157 .size itlb_aerror, . - itlb_aerror
159 ###############################################################################
161 # Data TLB Address Error handler entry point
163 ###############################################################################
164 .type dtlb_aerror,@function
170 movhu (MMUFCR_DFC),d1 # is it the initial valid write
172 and MMUFCR_xFC_INITWR,d1
173 beq dtlb_pagefault # jump if not
175 mov (DPTEL),d1 # set the dirty bit
176 # (don't replace with BSET!)
187 add -4,sp # need to pass three params
189 # calculate the fault code
190 movhu (MMUFCR_DFC),d1
192 # determine the page address
204 call do_page_fault[],0 # do_page_fault(regs,code,addr
206 jmp ret_from_exception
207 .size dtlb_aerror, . - dtlb_aerror