2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 * Copyright IBM Corp. 2008
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
24 extern void tlbwe(unsigned int index
,
30 unsigned int next_free_index
;
33 #define PAGE_MASK (~((1<<PAGE_SHIFT)-1))
37 void map(unsigned long vaddr
, unsigned long paddr
)
39 unsigned int w0
, w1
, w2
;
41 /* We don't install exception handlers, so we can't handle TLB misses,
42 * so we can't loop around and overwrite entry 0. */
43 if (next_free_index
++ >= TLB_SIZE
)
44 panic("TLB overflow");
46 w0
= (vaddr
& PAGE_MASK
) | V
;
47 w1
= paddr
& PAGE_MASK
;
50 tlbwe(next_free_index
, 0, w0
, w1
, w2
);