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

TOMOYO Linux Cross Reference
Linux/arch/um/include/asm/page.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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 /*
  3  * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
  4  * Copyright 2003 PathScale, Inc.
  5  */
  6 
  7 #ifndef __UM_PAGE_H
  8 #define __UM_PAGE_H
  9 
 10 #include <linux/const.h>
 11 
 12 /* PAGE_SHIFT determines the page size */
 13 #define PAGE_SHIFT      CONFIG_PAGE_SHIFT
 14 #define PAGE_SIZE       (_AC(1, UL) << PAGE_SHIFT)
 15 #define PAGE_MASK       (~(PAGE_SIZE-1))
 16 
 17 #ifndef __ASSEMBLY__
 18 
 19 struct page;
 20 
 21 #include <linux/pfn.h>
 22 #include <linux/types.h>
 23 #include <asm/vm-flags.h>
 24 
 25 /*
 26  * These are used to make use of C type-checking..
 27  */
 28 
 29 #define clear_page(page)        memset((void *)(page), 0, PAGE_SIZE)
 30 #define copy_page(to,from)      memcpy((void *)(to), (void *)(from), PAGE_SIZE)
 31 
 32 #define clear_user_page(page, vaddr, pg)        clear_page(page)
 33 #define copy_user_page(to, from, vaddr, pg)     copy_page(to, from)
 34 
 35 #if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT)
 36 
 37 typedef struct { unsigned long pte; } pte_t;
 38 typedef struct { unsigned long pmd; } pmd_t;
 39 typedef struct { unsigned long pgd; } pgd_t;
 40 #define pte_val(p) ((p).pte)
 41 
 42 #define pte_get_bits(p, bits) ((p).pte & (bits))
 43 #define pte_set_bits(p, bits) ((p).pte |= (bits))
 44 #define pte_clear_bits(p, bits) ((p).pte &= ~(bits))
 45 #define pte_copy(to, from) ({ (to).pte = (from).pte; })
 46 #define pte_is_zero(p) (!((p).pte & ~_PAGE_NEWPAGE))
 47 #define pte_set_val(p, phys, prot) \
 48         ({ (p).pte = (phys) | pgprot_val(prot); })
 49 
 50 #define pmd_val(x)      ((x).pmd)
 51 #define __pmd(x) ((pmd_t) { (x) } )
 52 
 53 typedef unsigned long long phys_t;
 54 
 55 #else
 56 
 57 typedef struct { unsigned long pte; } pte_t;
 58 typedef struct { unsigned long pgd; } pgd_t;
 59 
 60 #ifdef CONFIG_3_LEVEL_PGTABLES
 61 typedef struct { unsigned long pmd; } pmd_t;
 62 #define pmd_val(x)      ((x).pmd)
 63 #define __pmd(x) ((pmd_t) { (x) } )
 64 #endif
 65 
 66 #define pte_val(x)      ((x).pte)
 67 
 68 
 69 #define pte_get_bits(p, bits) ((p).pte & (bits))
 70 #define pte_set_bits(p, bits) ((p).pte |= (bits))
 71 #define pte_clear_bits(p, bits) ((p).pte &= ~(bits))
 72 #define pte_copy(to, from) ((to).pte = (from).pte)
 73 #define pte_is_zero(p) (!((p).pte & ~_PAGE_NEWPAGE))
 74 #define pte_set_val(p, phys, prot) (p).pte = (phys | pgprot_val(prot))
 75 
 76 typedef unsigned long phys_t;
 77 
 78 #endif
 79 
 80 typedef struct { unsigned long pgprot; } pgprot_t;
 81 
 82 typedef struct page *pgtable_t;
 83 
 84 #define pgd_val(x)      ((x).pgd)
 85 #define pgprot_val(x)   ((x).pgprot)
 86 
 87 #define __pte(x) ((pte_t) { (x) } )
 88 #define __pgd(x) ((pgd_t) { (x) } )
 89 #define __pgprot(x)     ((pgprot_t) { (x) } )
 90 
 91 extern unsigned long uml_physmem;
 92 
 93 #define PAGE_OFFSET (uml_physmem)
 94 #define KERNELBASE PAGE_OFFSET
 95 
 96 #define __va_space (8*1024*1024)
 97 
 98 #include <mem.h>
 99 
100 /* Cast to unsigned long before casting to void * to avoid a warning from
101  * mmap_kmem about cutting a long long down to a void *.  Not sure that
102  * casting is the right thing, but 32-bit UML can't have 64-bit virtual
103  * addresses
104  */
105 #define __pa(virt) uml_to_phys((void *) (unsigned long) (virt))
106 #define __va(phys) uml_to_virt((unsigned long) (phys))
107 
108 #define phys_to_pfn(p) ((p) >> PAGE_SHIFT)
109 #define pfn_to_phys(pfn) PFN_PHYS(pfn)
110 
111 #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v)))
112 
113 #include <asm-generic/memory_model.h>
114 #include <asm-generic/getorder.h>
115 
116 #endif  /* __ASSEMBLY__ */
117 
118 #ifdef CONFIG_X86_32
119 #define __HAVE_ARCH_GATE_AREA 1
120 #endif
121 
122 #endif  /* __UM_PAGE_H */
123 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php