~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/asm-generic/page.h

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef __ASM_GENERIC_PAGE_H
  2 #define __ASM_GENERIC_PAGE_H
  3 /*
  4  * Generic page.h implementation, for NOMMU architectures.
  5  * This provides the dummy definitions for the memory management.
  6  */
  7 
  8 #ifdef CONFIG_MMU
  9 #error need to prove a real asm/page.h
 10 #endif
 11 
 12 
 13 /* PAGE_SHIFT determines the page size */
 14 
 15 #define PAGE_SHIFT      12
 16 #ifdef __ASSEMBLY__
 17 #define PAGE_SIZE       (1 << PAGE_SHIFT)
 18 #else
 19 #define PAGE_SIZE       (1UL << PAGE_SHIFT)
 20 #endif
 21 #define PAGE_MASK       (~(PAGE_SIZE-1))
 22 
 23 #include <asm/setup.h>
 24 
 25 #ifndef __ASSEMBLY__
 26 
 27 #define get_user_page(vaddr)            __get_free_page(GFP_KERNEL)
 28 #define free_user_page(page, addr)      free_page(addr)
 29 
 30 #define clear_page(page)        memset((page), 0, PAGE_SIZE)
 31 #define copy_page(to,from)      memcpy((to), (from), PAGE_SIZE)
 32 
 33 #define clear_user_page(page, vaddr, pg)        clear_page(page)
 34 #define copy_user_page(to, from, vaddr, pg)     copy_page(to, from)
 35 
 36 /*
 37  * These are used to make use of C type-checking..
 38  */
 39 typedef struct {
 40         unsigned long pte;
 41 } pte_t;
 42 typedef struct {
 43         unsigned long pmd[16];
 44 } pmd_t;
 45 typedef struct {
 46         unsigned long pgd;
 47 } pgd_t;
 48 typedef struct {
 49         unsigned long pgprot;
 50 } pgprot_t;
 51 typedef struct page *pgtable_t;
 52 
 53 #define pte_val(x)      ((x).pte)
 54 #define pmd_val(x)      ((&x)->pmd[0])
 55 #define pgd_val(x)      ((x).pgd)
 56 #define pgprot_val(x)   ((x).pgprot)
 57 
 58 #define __pte(x)        ((pte_t) { (x) } )
 59 #define __pmd(x)        ((pmd_t) { (x) } )
 60 #define __pgd(x)        ((pgd_t) { (x) } )
 61 #define __pgprot(x)     ((pgprot_t) { (x) } )
 62 
 63 extern unsigned long memory_start;
 64 extern unsigned long memory_end;
 65 
 66 #endif /* !__ASSEMBLY__ */
 67 
 68 #ifdef CONFIG_KERNEL_RAM_BASE_ADDRESS
 69 #define PAGE_OFFSET             (CONFIG_KERNEL_RAM_BASE_ADDRESS)
 70 #else
 71 #define PAGE_OFFSET             (0)
 72 #endif
 73 
 74 #ifndef ARCH_PFN_OFFSET
 75 #define ARCH_PFN_OFFSET         (PAGE_OFFSET >> PAGE_SHIFT)
 76 #endif
 77 
 78 #ifndef __ASSEMBLY__
 79 
 80 #define __va(x) ((void *)((unsigned long) (x)))
 81 #define __pa(x) ((unsigned long) (x))
 82 
 83 #define virt_to_pfn(kaddr)      (__pa(kaddr) >> PAGE_SHIFT)
 84 #define pfn_to_virt(pfn)        __va((pfn) << PAGE_SHIFT)
 85 
 86 #define virt_to_page(addr)      pfn_to_page(virt_to_pfn(addr))
 87 #define page_to_virt(page)      pfn_to_virt(page_to_pfn(page))
 88 
 89 #ifndef page_to_phys
 90 #define page_to_phys(page)      ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
 91 #endif
 92 
 93 #define pfn_valid(pfn)          ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
 94 
 95 #define virt_addr_valid(kaddr)  (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
 96                                 ((void *)(kaddr) < (void *)memory_end))
 97 
 98 #endif /* __ASSEMBLY__ */
 99 
100 #include <asm-generic/memory_model.h>
101 #include <asm-generic/getorder.h>
102 
103 #endif /* __ASM_GENERIC_PAGE_H */
104 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp