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

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

Version: ~ [ linux-5.16-rc3 ] ~ [ linux-5.15.5 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.82 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.162 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.218 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.256 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.291 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.293 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ 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 clear_page(page)        memset((page), 0, PAGE_SIZE)
 28 #define copy_page(to,from)      memcpy((to), (from), PAGE_SIZE)
 29 
 30 #define clear_user_page(page, vaddr, pg)        clear_page(page)
 31 #define copy_user_page(to, from, vaddr, pg)     copy_page(to, from)
 32 
 33 /*
 34  * These are used to make use of C type-checking..
 35  */
 36 typedef struct {
 37         unsigned long pte;
 38 } pte_t;
 39 typedef struct {
 40         unsigned long pmd[16];
 41 } pmd_t;
 42 typedef struct {
 43         unsigned long pgd;
 44 } pgd_t;
 45 typedef struct {
 46         unsigned long pgprot;
 47 } pgprot_t;
 48 typedef struct page *pgtable_t;
 49 
 50 #define pte_val(x)      ((x).pte)
 51 #define pmd_val(x)      ((&x)->pmd[0])
 52 #define pgd_val(x)      ((x).pgd)
 53 #define pgprot_val(x)   ((x).pgprot)
 54 
 55 #define __pte(x)        ((pte_t) { (x) } )
 56 #define __pmd(x)        ((pmd_t) { (x) } )
 57 #define __pgd(x)        ((pgd_t) { (x) } )
 58 #define __pgprot(x)     ((pgprot_t) { (x) } )
 59 
 60 extern unsigned long memory_start;
 61 extern unsigned long memory_end;
 62 
 63 #endif /* !__ASSEMBLY__ */
 64 
 65 #ifdef CONFIG_KERNEL_RAM_BASE_ADDRESS
 66 #define PAGE_OFFSET             (CONFIG_KERNEL_RAM_BASE_ADDRESS)
 67 #else
 68 #define PAGE_OFFSET             (0)
 69 #endif
 70 
 71 #ifndef ARCH_PFN_OFFSET
 72 #define ARCH_PFN_OFFSET         (PAGE_OFFSET >> PAGE_SHIFT)
 73 #endif
 74 
 75 #ifndef __ASSEMBLY__
 76 
 77 #define __va(x) ((void *)((unsigned long) (x)))
 78 #define __pa(x) ((unsigned long) (x))
 79 
 80 #define virt_to_pfn(kaddr)      (__pa(kaddr) >> PAGE_SHIFT)
 81 #define pfn_to_virt(pfn)        __va((pfn) << PAGE_SHIFT)
 82 
 83 #define virt_to_page(addr)      pfn_to_page(virt_to_pfn(addr))
 84 #define page_to_virt(page)      pfn_to_virt(page_to_pfn(page))
 85 
 86 #ifndef page_to_phys
 87 #define page_to_phys(page)      ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
 88 #endif
 89 
 90 #define pfn_valid(pfn)          ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
 91 
 92 #define virt_addr_valid(kaddr)  (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
 93                                 ((void *)(kaddr) < (void *)memory_end))
 94 
 95 #endif /* __ASSEMBLY__ */
 96 
 97 #include <asm-generic/memory_model.h>
 98 #include <asm-generic/getorder.h>
 99 
100 #endif /* __ASM_GENERIC_PAGE_H */
101 

~ [ 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