/* * The following only work if pte_present() is true. * Undefined behaviour if not..
*/
/* Start and end of the vmalloc area. */ /* Make sure to map the vmalloc area above the pinned kernel memory area
of 32Mb. */ #define VMALLOC_START (CONFIG_KERNEL_START + CONFIG_LOWMEM_SIZE) #define VMALLOC_END ioremap_bot
#endif/* __ASSEMBLY__ */
/* * Macro to mark a page protection value as "uncacheable".
*/
/* * The MicroBlaze MMU is identical to the PPC-40x MMU, and uses a hash * table containing PTEs, together with a set of 16 segment registers, to * define the virtual to physical address mapping. * * We use the hash table as an extended TLB, i.e. a cache of currently * active mappings. We maintain a two-level page table tree, much * like that used by the i386, for the sake of the Linux memory * management code. Low-level assembler code in hashtable.S * (procedure hash_page) is responsible for extracting ptes from the * tree and putting them into the hash table when necessary, and * updating the accessed and modified bits in the page table tree.
*/
/* * The MicroBlaze processor has a TLB architecture identical to PPC-40x. The * instruction and data sides share a unified, 64-entry, semi-associative * TLB which is maintained totally under software control. In addition, the * instruction side has a hardware-managed, 2,4, or 8-entry, fully-associative * TLB which serves as a first level to the shared TLB. These two TLBs are * known as the UTLB and ITLB, respectively (see "mmu.h" for definitions).
*/
/* * The normal case is that PTEs are 32-bits and we have a 1-page * 1024-entry pgdir pointing to 1-page 1024-entry PTE pages. -- paulus *
*/
/* PGDIR_SHIFT determines what a top-level page table entry can map */ #define PGDIR_SHIFT (PAGE_SHIFT + PTE_SHIFT) #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1))
/* * entries per page directory level: our page-table tree is two-level, so * we don't really have any PMD directory.
*/ #define PTRS_PER_PTE (1 << PTE_SHIFT) #define PTRS_PER_PMD 1 #define PTRS_PER_PGD (1 << (32 - PGDIR_SHIFT))
/* * Bits in a linux-style PTE. These match the bits in the * (hardware-defined) PTE as closely as possible.
*/
/* There are several potential gotchas here. The hardware TLBLO * field looks like this: * * 0 1 2 3 4 ... 18 19 20 21 22 23 24 25 26 27 28 29 30 31 * RPN..................... 0 0 EX WR ZSEL....... W I M G * * Where possible we make the Linux PTE bits match up with this * * - bits 20 and 21 must be cleared, because we use 4k pages (4xx can * support down to 1k pages), this is done in the TLBMiss exception * handler. * - We use only zones 0 (for kernel pages) and 1 (for user pages) * of the 16 available. Bit 24-26 of the TLB are cleared in the TLB * miss handler. Bit 27 is PAGE_USER, thus selecting the correct * zone. * - PRESENT *must* be in the bottom two bits because swap PTEs use the top * 30 bits. Because 4xx doesn't support SMP anyway, M is irrelevant so we * borrow it for PAGE_PRESENT. Bit 30 is cleared in the TLB miss handler * before the TLB entry is loaded. * - All other bits of the PTE are loaded into TLBLO without * * modification, leaving us only the bits 20, 21, 24, 25, 26, 30 for * software PTE bits. We actually use bits 21, 24, 25, and * 30 respectively for the software bits: ACCESSED, DIRTY, RW, and * PRESENT.
*/
/* Definitions for MicroBlaze. */ #define _PAGE_GUARDED 0x001 /* G: page is guarded from prefetch */ #define _PAGE_PRESENT 0x002 /* software: PTE contains a translation */ #define _PAGE_NO_CACHE 0x004 /* I: caching is inhibited */ #define _PAGE_WRITETHRU 0x008 /* W: caching is write-through */ #define _PAGE_USER 0x010 /* matches one of the zone permission bits */ #define _PAGE_RW 0x040 /* software: Writes permitted */ #define _PAGE_DIRTY 0x080 /* software: dirty page */ #define _PAGE_HWWRITE 0x100 /* hardware: Dirty & RW, set in exception */ #define _PAGE_HWEXEC 0x200 /* hardware: EX permission */ #define _PAGE_ACCESSED 0x400 /* software: R: page referenced */ #define _PMD_PRESENT PAGE_MASK
/* We borrow bit 24 to store the exclusive marker in swap PTEs. */ #define _PAGE_SWP_EXCLUSIVE _PAGE_DIRTY
/* * Note: the _PAGE_COHERENT bit automatically gets set in the hardware * PTE if CONFIG_SMP is defined (hash_page does this); there is no need * to have it in the Linux PTE, and in fact the bit could be reused for * another purpose. -- paulus.
*/ #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED) #define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE)
/* * We consider execute permission the same as read. * Also, write permissions imply read permissions.
*/
#ifndef __ASSEMBLY__ /* * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc..
*/ externunsignedlong empty_zero_page[1024]; #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
/* * Atomic PTE updates. * * pte_update clears and sets bit atomically, and returns * the old pte value. * The ((unsigned long)(p+1) - 4) hack is to get to the least-significant * 32 bits of the PTE regardless of whether PTEs are 32 or 64 bits.
*/ staticinlineunsignedlong pte_update(pte_t *p, unsignedlong clr, unsignedlong set)
{ unsignedlong flags, old, tmp;
/* Values for nocacheflag and cmode */ /* These are not used by the APUS kernel_map, but prevents * compilation errors.
*/ #define IOMAP_FULL_CACHING 0 #define IOMAP_NOCACHE_SER 1 #define IOMAP_NOCACHE_NONSER 2 #define IOMAP_NO_COPYBACK 3
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.