OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-x86_64/] [page.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#ifndef _X86_64_PAGE_H
2
#define _X86_64_PAGE_H
3
 
4
#include <linux/stringify.h>
5
 
6
/* PAGE_SHIFT determines the page size */
7
#define PAGE_SHIFT      12
8
#ifdef __ASSEMBLY__
9
#define PAGE_SIZE       (0x1 << PAGE_SHIFT)
10
#else
11
#define PAGE_SIZE       (1UL << PAGE_SHIFT)
12
#endif
13
#define PAGE_MASK       (~(PAGE_SIZE-1))
14
 
15
#define __PHYSICAL_MASK         0x0000ffffffffffffUL
16
#define PHYSICAL_PAGE_MASK      0x0000fffffffff000UL
17
 
18
#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
19
#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
20
 
21
#define LARGE_PFN       (LARGE_PAGE_SIZE / PAGE_SIZE)
22
 
23
#define KERNEL_TEXT_SIZE  (40UL*1024*1024)
24
#define KERNEL_TEXT_START 0xffffffff80000000UL 
25
 
26
/* Changing the next two defines should be enough to increase the kernel stack */
27
/* We still hope 8K is enough, but ... */
28
/* Currently it is actually ~6k. This would change when task_struct moves into
29
   an own slab. */
30
#define THREAD_ORDER    1
31
#define THREAD_SIZE    (2*PAGE_SIZE)
32
 
33
#define INIT_TASK_SIZE THREAD_SIZE
34
#define CURRENT_MASK (~(THREAD_SIZE-1))
35
 
36
#ifdef __KERNEL__
37
#ifndef __ASSEMBLY__
38
 
39
void clear_page(void *);
40
void copy_page(void *, void *);
41
 
42
#define clear_user_page(page, vaddr)    clear_page(page)
43
#define copy_user_page(to, from, vaddr) copy_page(to, from)
44
 
45
/*
46
 * These are used to make use of C type-checking..
47
 */
48
typedef struct { unsigned long pte; } pte_t;
49
typedef struct { unsigned long pmd; } pmd_t;
50
typedef struct { unsigned long pgd; } pgd_t;
51
typedef struct { unsigned long pml4; } pml4_t;
52
#define PTE_MASK        PHYSICAL_PAGE_MASK
53
 
54
typedef struct { unsigned long pgprot; } pgprot_t;
55
 
56
#define pte_val(x)      ((x).pte)
57
#define pmd_val(x)      ((x).pmd)
58
#define pgd_val(x)      ((x).pgd)
59
#define pml4_val(x)     ((x).pml4)
60
#define pgprot_val(x)   ((x).pgprot)
61
 
62
#define __pte(x) ((pte_t) { (x) } )
63
#define __pmd(x) ((pmd_t) { (x) } )
64
#define __pgd(x) ((pgd_t) { (x) } )
65
#define __pml4(x) ((pml4_t) { (x) } )
66
#define __pgprot(x)     ((pgprot_t) { (x) } )
67
 
68
extern unsigned long vm_stack_flags, vm_stack_flags32;
69
extern unsigned long vm_data_default_flags, vm_data_default_flags32;
70
extern unsigned long vm_force_exec32;
71
 
72
#endif /* !__ASSEMBLY__ */
73
 
74
/* to align the pointer to the (next) page boundary */
75
#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
76
 
77
/* See Documentation/X86_64/mm.txt for a description of the layout. */
78
#define __START_KERNEL          0xffffffff80100000
79
#define __START_KERNEL_map      0xffffffff80000000
80
#define __PAGE_OFFSET           0x0000010000000000
81
 
82
#ifndef __ASSEMBLY__
83
 
84
#include <linux/config.h>
85
 
86
/*
87
 * Tell the user there is some problem.  The exception handler decodes this frame.
88
 */
89
struct bug_frame {
90
       unsigned char ud2[2];
91
       char *filename;    /* should use 32bit offset instead, but the assembler doesn't like it */
92
       unsigned short line;
93
} __attribute__((packed));
94
#define BUG() asm volatile("ud2 ; .quad %P1 ; .short %P0" :: "i"(__LINE__), \
95
                "i" (__stringify(KBUILD_BASENAME)))
96
#define HEADER_BUG() asm volatile("ud2 ; .quad %P1 ; .short %P0" :: "i"(__LINE__), \
97
                "i" (__stringify(__FILE__)))
98
#define PAGE_BUG(page) BUG()
99
 
100
/* Pure 2^n version of get_order */
101
extern __inline__ int get_order(unsigned long size)
102
{
103
        int order;
104
 
105
        size = (size-1) >> (PAGE_SHIFT-1);
106
        order = -1;
107
        do {
108
                size >>= 1;
109
                order++;
110
        } while (size);
111
        return order;
112
}
113
 
114
#endif /* __ASSEMBLY__ */
115
 
116
#define PAGE_OFFSET             ((unsigned long)__PAGE_OFFSET)
117
 
118
/* Note: __pa(&symbol_visible_to_c) should be always replaced with __pa_symbol.
119
   Otherwise you risk miscompilation. */
120
#define __pa(x)                 (((unsigned long)(x)>=__START_KERNEL_map)?(unsigned long)(x) - (unsigned long)__START_KERNEL_map:(unsigned long)(x) - PAGE_OFFSET)
121
/* __pa_symbol should use for C visible symbols, but only for them.
122
   This seems to be the official gcc blessed way to do such arithmetic. */
123
#define __pa_symbol(x)          \
124
        ({unsigned long v;  \
125
          asm("" : "=r" (v) : "0" (x)); \
126
         v - __START_KERNEL_map; })
127
#define __pa_maybe_symbol(x)            \
128
        ({unsigned long v;  \
129
          asm("" : "=r" (v) : "0" (x)); \
130
          __pa(v); })
131
 
132
#define __va(x)                 ((void *)((unsigned long)(x)+PAGE_OFFSET))
133
#ifndef CONFIG_DISCONTIGMEM
134
#define virt_to_page(kaddr)     (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
135
#define pfn_to_page(pfn)        (mem_map + (pfn)) 
136
#define page_to_pfn(page)   ((page) - mem_map)
137
#define page_to_phys(page)      (((page) - mem_map) << PAGE_SHIFT)
138
#define VALID_PAGE(page)        (((page) - mem_map) < max_mapnr)
139
#endif
140
 
141
#define phys_to_pfn(phys)       ((phys) >> PAGE_SHIFT)
142
 
143
#define __VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
144
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
145
#define __VM_STACK_FLAGS        (VM_GROWSDOWN | VM_READ | VM_WRITE | VM_EXEC | \
146
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
147
 
148
#define VM_DATA_DEFAULT_FLAGS \
149
        ((current->thread.flags & THREAD_IA32) ? vm_data_default_flags32 : \
150
          vm_data_default_flags)
151
#define VM_STACK_FLAGS  vm_stack_flags
152
 
153
#endif /* __KERNEL__ */
154
 
155
#endif /* _X86_64_PAGE_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.