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

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

Version: ~ [ linux-6.3-rc3 ] ~ [ linux-6.2.7 ] ~ [ linux-6.1.20 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.103 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.175 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.237 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.278 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.310 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ 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 #ifndef _CRIS_PAGE_H
  2 #define _CRIS_PAGE_H
  3 
  4 #include <linux/config.h>
  5 #include <asm/mmu.h>
  6 
  7 /* PAGE_SHIFT determines the page size */
  8 #define PAGE_SHIFT      13
  9 #define PAGE_SIZE       (1UL << PAGE_SHIFT)
 10 #define PAGE_MASK       (~(PAGE_SIZE-1))
 11 
 12 #ifdef __KERNEL__
 13 
 14 #define clear_page(page)        memset((void *)(page), 0, PAGE_SIZE)
 15 #define copy_page(to,from)      memcpy((void *)(to), (void *)(from), PAGE_SIZE)
 16 
 17 #define clear_user_page(page, vaddr)    clear_page(page)
 18 #define copy_user_page(to, from, vaddr) copy_page(to, from)
 19 
 20 #define STRICT_MM_TYPECHECKS
 21 
 22 #ifdef STRICT_MM_TYPECHECKS
 23 /*
 24  * These are used to make use of C type-checking..
 25  */
 26 typedef struct { unsigned long pte; } pte_t;
 27 typedef struct { unsigned long pmd; } pmd_t;
 28 typedef struct { unsigned long pgd; } pgd_t;
 29 typedef struct { unsigned long pgprot; } pgprot_t;
 30 
 31 #define pte_val(x)      ((x).pte)
 32 #define pmd_val(x)      ((x).pmd)
 33 #define pgd_val(x)      ((x).pgd)
 34 #define pgprot_val(x)   ((x).pgprot)
 35 
 36 #define __pte(x)        ((pte_t) { (x) } )
 37 #define __pmd(x)        ((pmd_t) { (x) } )
 38 #define __pgd(x)        ((pgd_t) { (x) } )
 39 #define __pgprot(x)     ((pgprot_t) { (x) } )
 40 
 41 #else
 42 /*
 43  * .. while these make it easier on the compiler
 44  */
 45 typedef unsigned long pte_t;
 46 typedef unsigned long pmd_t;
 47 typedef unsigned long pgd_t;
 48 typedef unsigned long pgprot_t;
 49 
 50 #define pte_val(x)      (x)
 51 #define pmd_val(x)      (x)
 52 #define pgd_val(x)      (x)
 53 #define pgprot_val(x)   (x)
 54 
 55 #define __pte(x)        (x)
 56 #define __pmd(x)        (x)
 57 #define __pgd(x)        (x)
 58 #define __pgprot(x)     (x)
 59 
 60 #endif
 61 
 62 /* to align the pointer to the (next) page boundary */
 63 #define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
 64 
 65 /* This handles the memory map.. */
 66 
 67 #ifdef CONFIG_CRIS_LOW_MAP
 68 #define PAGE_OFFSET             KSEG_6   /* kseg_6 is mapped to physical ram */
 69 #else
 70 #define PAGE_OFFSET             KSEG_C   /* kseg_c is mapped to physical ram */
 71 #endif
 72 
 73 #ifndef __ASSEMBLY__
 74 
 75 #define BUG() do { \
 76   printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
 77 } while (0)
 78 
 79 #define PAGE_BUG(page) do { \
 80          BUG(); \
 81 } while (0)
 82 
 83 /* Pure 2^n version of get_order */
 84 static __inline__ int get_order(unsigned long size)
 85 {
 86         int order;
 87 
 88         size = (size-1) >> (PAGE_SHIFT-1);
 89         order = -1;
 90         do {
 91                 size >>= 1;
 92                 order++;
 93         } while (size);
 94         return order;
 95 }
 96 
 97 #endif /* __ASSEMBLY__ */
 98 
 99 /* macros to convert between really physical and virtual addresses
100  * by stripping a selected bit, we can convert between KSEG_x and 0x40000000 where
101  * the DRAM really resides
102  */
103 
104 #ifdef CONFIG_CRIS_LOW_MAP
105 /* we have DRAM virtually at 0x6 */
106 #define __pa(x)                 ((unsigned long)(x) & 0xdfffffff)
107 #define __va(x)                 ((void *)((unsigned long)(x) | 0x20000000))
108 #else
109 /* we have DRAM virtually at 0xc */
110 #define __pa(x)                 ((unsigned long)(x) & 0x7fffffff)
111 #define __va(x)                 ((void *)((unsigned long)(x) | 0x80000000))
112 #endif
113 
114 /* to index into the page map. our pages all start at physical addr PAGE_OFFSET so
115  * we can let the map start there. notice that we subtract PAGE_OFFSET because
116  * we start our mem_map there - in other ports they map mem_map physically and
117  * use __pa instead. in our system both the physical and virtual address of DRAM
118  * is too high to let mem_map start at 0, so we do it this way instead (similar
119  * to arm and m68k I think)
120  */ 
121 
122 #define virt_to_page(kaddr)    (mem_map + (((unsigned long)kaddr - PAGE_OFFSET) >> PAGE_SHIFT))
123 #define VALID_PAGE(page)       ((page - mem_map) < max_mapnr)
124 
125 /* from linker script */
126 
127 extern unsigned long dram_start, dram_end;
128 
129 #define VM_DATA_DEFAULT_FLAGS   (VM_READ | VM_WRITE | VM_EXEC | \
130                                  VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
131 
132 #endif /* __KERNEL__ */
133 
134 #endif /* _CRIS_PAGE_H */
135 
136 

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