diff options
author | Chris Zankel <czankel@tensilica.com> | 2005-06-24 01:01:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:05:22 -0400 |
commit | 3f65ce4d141e435e54c20ed2379d983d362a2cb5 (patch) | |
tree | 1e86807b3f215d90d9cf57aa609f73f856515b30 /arch/xtensa/mm/pgtable.c | |
parent | 249ac17e96811acc3c6402317dd5d5c89d2cbf68 (diff) |
[PATCH] xtensa: Architecture support for Tensilica Xtensa Part 5
The attached patches provides part 5 of an architecture implementation for the
Tensilica Xtensa CPU series.
Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/xtensa/mm/pgtable.c')
-rw-r--r-- | arch/xtensa/mm/pgtable.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/arch/xtensa/mm/pgtable.c b/arch/xtensa/mm/pgtable.c new file mode 100644 index 000000000000..e5e119c820e4 --- /dev/null +++ b/arch/xtensa/mm/pgtable.c | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * arch/xtensa/mm/fault.c | ||
3 | * | ||
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. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | * | ||
10 | * Chris Zankel <chris@zankel.net> | ||
11 | */ | ||
12 | |||
13 | #if (DCACHE_SIZE > PAGE_SIZE) | ||
14 | |||
15 | pte_t* pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | ||
16 | { | ||
17 | pte_t *pte, p; | ||
18 | int color = ADDR_COLOR(address); | ||
19 | int i; | ||
20 | |||
21 | p = (pte_t*) __get_free_pages(GFP_KERNEL|__GFP_REPEAT, COLOR_ORDER); | ||
22 | |||
23 | if (likely(p)) { | ||
24 | struct page *page; | ||
25 | |||
26 | for (i = 0; i < COLOR_SIZE; i++, p++) { | ||
27 | page = virt_to_page(pte); | ||
28 | |||
29 | set_page_count(page, 1); | ||
30 | ClearPageCompound(page); | ||
31 | |||
32 | if (ADDR_COLOR(p) == color) | ||
33 | pte = p; | ||
34 | else | ||
35 | free_page(p); | ||
36 | } | ||
37 | clear_page(pte); | ||
38 | } | ||
39 | return pte; | ||
40 | } | ||
41 | |||
42 | #ifdef PROFILING | ||
43 | |||
44 | int mask; | ||
45 | int hit; | ||
46 | int flush; | ||
47 | |||
48 | #endif | ||
49 | |||
50 | struct page* pte_alloc_one(struct mm_struct *mm, unsigned long address) | ||
51 | { | ||
52 | struct page *page, p; | ||
53 | int color = ADDR_COLOR(address); | ||
54 | |||
55 | p = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER); | ||
56 | |||
57 | if (likely(p)) { | ||
58 | for (i = 0; i < PAGE_ORDER; i++) { | ||
59 | set_page_count(p, 1); | ||
60 | ClearPageCompound(p); | ||
61 | |||
62 | if (PADDR_COLOR(page_address(pg)) == color) | ||
63 | page = p; | ||
64 | else | ||
65 | free_page(p); | ||
66 | } | ||
67 | clear_highpage(page); | ||
68 | } | ||
69 | |||
70 | return page; | ||
71 | } | ||
72 | |||
73 | #endif | ||
74 | |||
75 | |||
76 | |||