x86: arch/x86/mm/init_32.c cleanup
[wrt350n-kernel.git] / arch / xtensa / mm / pgtable.c
blob6979927382050532a4bb7d6dc47311e01ebcd18f
1 /*
2 * arch/xtensa/mm/pgtable.c
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
10 * Chris Zankel <chris@zankel.net>
13 #if (DCACHE_SIZE > PAGE_SIZE)
15 pte_t* pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
17 pte_t *pte = NULL, *p;
18 int color = ADDR_COLOR(address);
19 int i;
21 p = (pte_t*) __get_free_pages(GFP_KERNEL|__GFP_REPEAT, COLOR_ORDER);
23 if (likely(p)) {
24 split_page(virt_to_page(p), COLOR_ORDER);
26 for (i = 0; i < COLOR_SIZE; i++) {
27 if (ADDR_COLOR(p) == color)
28 pte = p;
29 else
30 free_page(p);
31 p += PTRS_PER_PTE;
33 clear_page(pte);
35 return pte;
38 #ifdef PROFILING
40 int mask;
41 int hit;
42 int flush;
44 #endif
46 struct page* pte_alloc_one(struct mm_struct *mm, unsigned long address)
48 struct page *page = NULL, *p;
49 int color = ADDR_COLOR(address);
51 p = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER);
53 if (likely(p)) {
54 split_page(p, COLOR_ORDER);
56 for (i = 0; i < PAGE_ORDER; i++) {
57 if (PADDR_COLOR(page_address(p)) == color)
58 page = p;
59 else
60 __free_page(p);
61 p++;
63 clear_highpage(page);
66 return page;
69 #endif