Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v2.6.18-rc4 168 lines 4.6 kB view raw
1/* $Id: page.h,v 1.55 2000/10/30 21:01:41 davem Exp $ 2 * page.h: Various defines and such for MMU operations on the Sparc for 3 * the Linux kernel. 4 * 5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 6 */ 7 8#ifndef _SPARC_PAGE_H 9#define _SPARC_PAGE_H 10 11#ifdef CONFIG_SUN4 12#define PAGE_SHIFT 13 13#else 14#define PAGE_SHIFT 12 15#endif 16#ifndef __ASSEMBLY__ 17/* I have my suspicions... -DaveM */ 18#define PAGE_SIZE (1UL << PAGE_SHIFT) 19#else 20#define PAGE_SIZE (1 << PAGE_SHIFT) 21#endif 22#define PAGE_MASK (~(PAGE_SIZE-1)) 23 24#ifdef __KERNEL__ 25 26#include <asm/btfixup.h> 27 28#ifndef __ASSEMBLY__ 29 30#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 31#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) 32#define clear_user_page(addr, vaddr, page) \ 33 do { clear_page(addr); \ 34 sparc_flush_page_to_ram(page); \ 35 } while (0) 36#define copy_user_page(to, from, vaddr, page) \ 37 do { copy_page(to, from); \ 38 sparc_flush_page_to_ram(page); \ 39 } while (0) 40 41/* The following structure is used to hold the physical 42 * memory configuration of the machine. This is filled in 43 * probe_memory() and is later used by mem_init() to set up 44 * mem_map[]. We statically allocate SPARC_PHYS_BANKS of 45 * these structs, this is arbitrary. The entry after the 46 * last valid one has num_bytes==0. 47 */ 48 49struct sparc_phys_banks { 50 unsigned long base_addr; 51 unsigned long num_bytes; 52}; 53 54#define SPARC_PHYS_BANKS 32 55 56extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1]; 57 58/* Cache alias structure. Entry is valid if context != -1. */ 59struct cache_palias { 60 unsigned long vaddr; 61 int context; 62}; 63 64extern struct cache_palias *sparc_aliases; 65 66/* passing structs on the Sparc slow us down tremendously... */ 67 68/* #define STRICT_MM_TYPECHECKS */ 69 70#ifdef STRICT_MM_TYPECHECKS 71/* 72 * These are used to make use of C type-checking.. 73 */ 74typedef struct { unsigned long pte; } pte_t; 75typedef struct { unsigned long iopte; } iopte_t; 76typedef struct { unsigned long pmdv[16]; } pmd_t; 77typedef struct { unsigned long pgd; } pgd_t; 78typedef struct { unsigned long ctxd; } ctxd_t; 79typedef struct { unsigned long pgprot; } pgprot_t; 80typedef struct { unsigned long iopgprot; } iopgprot_t; 81 82#define pte_val(x) ((x).pte) 83#define iopte_val(x) ((x).iopte) 84#define pmd_val(x) ((x).pmdv[0]) 85#define pgd_val(x) ((x).pgd) 86#define ctxd_val(x) ((x).ctxd) 87#define pgprot_val(x) ((x).pgprot) 88#define iopgprot_val(x) ((x).iopgprot) 89 90#define __pte(x) ((pte_t) { (x) } ) 91#define __iopte(x) ((iopte_t) { (x) } ) 92/* #define __pmd(x) ((pmd_t) { (x) } ) */ /* XXX procedure with loop */ 93#define __pgd(x) ((pgd_t) { (x) } ) 94#define __ctxd(x) ((ctxd_t) { (x) } ) 95#define __pgprot(x) ((pgprot_t) { (x) } ) 96#define __iopgprot(x) ((iopgprot_t) { (x) } ) 97 98#else 99/* 100 * .. while these make it easier on the compiler 101 */ 102typedef unsigned long pte_t; 103typedef unsigned long iopte_t; 104typedef struct { unsigned long pmdv[16]; } pmd_t; 105typedef unsigned long pgd_t; 106typedef unsigned long ctxd_t; 107typedef unsigned long pgprot_t; 108typedef unsigned long iopgprot_t; 109 110#define pte_val(x) (x) 111#define iopte_val(x) (x) 112#define pmd_val(x) ((x).pmdv[0]) 113#define pgd_val(x) (x) 114#define ctxd_val(x) (x) 115#define pgprot_val(x) (x) 116#define iopgprot_val(x) (x) 117 118#define __pte(x) (x) 119#define __iopte(x) (x) 120/* #define __pmd(x) (x) */ /* XXX later */ 121#define __pgd(x) (x) 122#define __ctxd(x) (x) 123#define __pgprot(x) (x) 124#define __iopgprot(x) (x) 125 126#endif 127 128extern unsigned long sparc_unmapped_base; 129 130BTFIXUPDEF_SETHI(sparc_unmapped_base) 131 132#define TASK_UNMAPPED_BASE BTFIXUP_SETHI(sparc_unmapped_base) 133 134#else /* !(__ASSEMBLY__) */ 135 136#define __pgprot(x) (x) 137 138#endif /* !(__ASSEMBLY__) */ 139 140/* to align the pointer to the (next) page boundary */ 141#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) 142 143#define PAGE_OFFSET 0xf0000000 144#ifndef __ASSEMBLY__ 145extern unsigned long phys_base; 146extern unsigned long pfn_base; 147#endif 148#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + phys_base) 149#define __va(x) ((void *)((unsigned long) (x) - phys_base + PAGE_OFFSET)) 150 151#define virt_to_phys __pa 152#define phys_to_virt __va 153 154#define ARCH_PFN_OFFSET (pfn_base) 155#define virt_to_page(kaddr) (mem_map + ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT))) 156 157#define pfn_valid(pfn) (((pfn) >= (pfn_base)) && (((pfn)-(pfn_base)) < max_mapnr)) 158#define virt_addr_valid(kaddr) ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT) < max_mapnr) 159 160#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 161 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 162 163#endif /* __KERNEL__ */ 164 165#include <asm-generic/memory_model.h> 166#include <asm-generic/page.h> 167 168#endif /* _SPARC_PAGE_H */