-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sh: Abstract the number of page table levels
Keep the dimensions of the page tables in a separate header file in preparation for allowing a three level page table structure. Signed-off-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
- Loading branch information
Matt Fleming
authored and
Paul Mundt
committed
Dec 17, 2009
1 parent
2f7bb2d
commit b73c806
Showing
4 changed files
with
56 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef __ASM_SH_PGALLOC_NOPMD_H | ||
#define __ASM_SH_PGALLOC_NOPMD_H | ||
|
||
#define QUICK_PGD 0 /* We preserve special mappings over free */ | ||
|
||
static inline void pgd_ctor(void *x) | ||
{ | ||
pgd_t *pgd = x; | ||
|
||
memcpy(pgd + USER_PTRS_PER_PGD, | ||
swapper_pg_dir + USER_PTRS_PER_PGD, | ||
(PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); | ||
} | ||
|
||
static inline pgd_t *pgd_alloc(struct mm_struct *mm) | ||
{ | ||
return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor); | ||
} | ||
|
||
static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | ||
{ | ||
quicklist_free(QUICK_PGD, NULL, pgd); | ||
} | ||
|
||
static inline void __check_pgt_cache(void) | ||
{ | ||
quicklist_trim(QUICK_PGD, NULL, 25, 16); | ||
} | ||
|
||
#endif /* __ASM_SH_PGALLOC_NOPMD_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef __ASM_SH_PGTABLE_NOPMD_H | ||
#define __ASM_SH_PGTABLE_NOPMD_H | ||
|
||
#include <asm-generic/pgtable-nopmd.h> | ||
|
||
/* | ||
* traditional two-level paging structure | ||
*/ | ||
|
||
/* PTE bits */ | ||
#define PTE_MAGNITUDE 2 /* 32-bit PTEs */ | ||
|
||
#define PTE_SHIFT PAGE_SHIFT | ||
#define PTE_BITS (PTE_SHIFT - PTE_MAGNITUDE) | ||
|
||
/* PGD bits */ | ||
#define PGDIR_SHIFT (PTE_SHIFT + PTE_BITS) | ||
|
||
#define PTRS_PER_PGD (PAGE_SIZE / (1 << PTE_MAGNITUDE)) | ||
#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) | ||
|
||
#endif /* __ASM_SH_PGTABLE_NOPMD_H */ |