/* * We only use two ring levels, user and kernel space.
*/
#ifdef CONFIG_MMU #define USER_RING 1 /* user ring level */ #else #define USER_RING 0 #endif #define KERNEL_RING 0 /* kernel ring level */
/* * The Xtensa architecture port of Linux has a two-level page table system, * i.e. the logical three-level Linux page table layout is folded. * Each task has the following memory page tables: * * PGD table (page directory), ie. 3rd-level page table: * One page (4 kB) of 1024 (PTRS_PER_PGD) pointers to PTE tables * (Architectures that don't have the PMD folded point to the PMD tables) * * The pointer to the PGD table for a given task can be retrieved from * the task structure (struct task_struct*) t, e.g. current(): * (t->mm ? t->mm : t->active_mm)->pgd * * PMD tables (page middle-directory), ie. 2nd-level page tables: * Absent for the Xtensa architecture (folded, PTRS_PER_PMD == 1). * * PTE tables (page table entry), ie. 1st-level page tables: * One page (4 kB) of 1024 (PTRS_PER_PTE) PTEs with a special PTE * invalid_pte_table for absent mappings. * * The individual pages are 4 kB big with special pages for the empty_zero_page.
*/
/* * Entries per page directory level: we use two-level, so * we don't really have any PMD directory physically.
*/ #define PTRS_PER_PTE 1024 #define PTRS_PER_PTE_SHIFT 10 #define PTRS_PER_PGD 1024 #define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) #define FIRST_USER_PGD_NR (FIRST_USER_ADDRESS >> PGDIR_SHIFT)
#ifdef CONFIG_MMU /* * Virtual memory area. We keep a distance to other memory regions to be * on the safe side. We also use this area for cache aliasing.
*/ #define VMALLOC_START (XCHAL_KSEG_CACHED_VADDR - 0x10000000) #define VMALLOC_END (VMALLOC_START + 0x07FEFFFF) #define TLBTEMP_BASE_1 (VMALLOC_START + 0x08000000) #define TLBTEMP_BASE_2 (TLBTEMP_BASE_1 + DCACHE_WAY_SIZE) #if 2 * DCACHE_WAY_SIZE > ICACHE_WAY_SIZE #define TLBTEMP_SIZE (2 * DCACHE_WAY_SIZE) #else #define TLBTEMP_SIZE ICACHE_WAY_SIZE #endif
/* * For the Xtensa architecture, the PTE layout is as follows: * * 31------12 11 10-9 8-6 5-4 3-2 1-0 * +-----------------------------------------+ * | | Software | HARDWARE | * | PPN | ADW | RI |Attribute| * +-----------------------------------------+ * pte_none | MBZ | 01 | 11 | 00 | * +-----------------------------------------+ * present | PPN | 0 | 00 | ADW | RI | CA | wx | * +- - - - - - - - - - - - - - - - - - - - -+ * (PAGE_NONE)| PPN | 0 | 00 | ADW | 01 | 11 | 11 | * +-----------------------------------------+ * swap | index | type | 01 | 11 | e0 | * +-----------------------------------------+ * * For T1050 hardware and earlier the layout differs for present and (PAGE_NONE) * +-----------------------------------------+ * present | PPN | 0 | 00 | ADW | RI | CA | w1 | * +-----------------------------------------+ * (PAGE_NONE)| PPN | 0 | 00 | ADW | 01 | 01 | 00 | * +-----------------------------------------+ * * Legend: * PPN Physical Page Number * ADW software: accessed (young) / dirty / writable * RI ring (0=privileged, 1=user, 2 and 3 are unused) * CA cache attribute: 00 bypass, 01 writeback, 10 writethrough * (11 is invalid and used to mark pages that are not present) * e exclusive marker in swap PTEs * w page is writable (hw) * x page is executable (hw) * index swap offset / PAGE_SIZE (bit 11-31: 21 bits -> 8 GB) * (note that the index is always non-zero) * type swap type (5 bits -> 32 types) * * Notes: * - (PROT_NONE) is a special case of 'present' but causes an exception for * any access (read, write, and execute). * - 'multihit-exception' has the highest priority of all MMU exceptions, * so the ring must be set to 'RING_USER' even for 'non-present' pages. * - on older hardware, the exectuable flag was not supported and * used as a 'valid' flag, so it needs to be always set. * - we need to keep track of certain flags in software (dirty and young) * to do this, we use write exceptions and have a separate software w-flag. * - attribute value 1101 (and 1111 on T1050 and earlier) is reserved
*/
#define _PAGE_ATTRIB_MASK 0xf
#define _PAGE_HW_EXEC (1<<0) /* hardware: page is executable */ #define _PAGE_HW_WRITE (1<<1) /* hardware: page is writable */
/* * On certain configurations of Xtensa MMUs (eg. the initial Linux config), * the MMU can't do page protection for execute, and considers that the same as * read. Also, write permissions may imply read permissions. * What follows is the closest we can get by reasonable means.. * See linux/mm/mmap.c for protection_map[] array that uses these definitions.
*/ #ifndef __ASSEMBLER__
/* * Certain architectures need to do special things when pte's * within a page table are directly modified. Thus, the following * hook is made available.
*/ staticinlinevoid update_pte(pte_t *ptep, pte_t pteval)
{
*ptep = pteval; #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK
__asm__ __volatile__ ("dhwb %0, 0" :: "a" (ptep)); #endif
/* * Encode/decode swap entries and swap PTEs. Swap PTEs are all PTEs that * are !pte_none() && !pte_present().
*/ #define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > 5)
/* Assembly macro _PGD_INDEX is the same as C pgd_index(unsigned long), * _PGD_OFFSET as C pgd_offset(struct mm_struct*, unsigned long), * _PMD_OFFSET as C pmd_offset(pgd_t*, unsigned long) * _PTE_OFFSET as C pte_offset(pmd_t*, unsigned long) * * Note: We require an additional temporary register which can be the same as * the register that holds the address. * * ((pte_t*) ((unsigned long)(pmd_val(*pmd) & PAGE_MASK)) + pte_index(addr)) *
*/ #define _PGD_INDEX(rt,rs) extui rt, rs, PGDIR_SHIFT, 32-PGDIR_SHIFT #define _PTE_INDEX(rt,rs) extui rt, rs, PAGE_SHIFT, PTRS_PER_PTE_SHIFT
#define _PGD_OFFSET(mm,adr,tmp) l32i mm, mm, MM_PGD; \
_PGD_INDEX(tmp, adr); \
addx4 mm, tmp, mm
#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG #define __HAVE_ARCH_PTEP_GET_AND_CLEAR #define __HAVE_ARCH_PTEP_SET_WRPROTECT #define __HAVE_ARCH_PTEP_MKDIRTY #define __HAVE_ARCH_PTE_SAME /* We provide our own get_unmapped_area to cope with * SHM area cache aliasing for userland.
*/ #define HAVE_ARCH_UNMAPPED_AREA
#endif/* _XTENSA_PGTABLE_H */
Messung V0.5
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.