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

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

Version: ~ [ linux-6.1-rc7 ] ~ [ linux-6.0.10 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.80 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.156 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.225 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.267 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.300 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.334 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

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