source: GPL/trunk/include/asm/page.h@ 689

Last change on this file since 689 was 679, checked in by David Azarewicz, 4 years ago

Merge changes from Paul's uniaud32next branch.

File size: 2.3 KB
Line 
1#ifndef _I386_PAGE_H
2#define _I386_PAGE_H
3
4/* PAGE_SHIFT determines the page size */
5#define PAGE_SHIFT 12
6#define PAGE_SIZE (1UL << PAGE_SHIFT)
7#define PAGE_MASK (~(PAGE_SIZE-1))
8
9#ifdef __KERNEL__
10#ifndef __ASSEMBLY__
11
12//#include <linux/config.h>
13
14/*
15 * On older X86 processors its not a win to use MMX here it seems.
16 * Maybe the K6-III ?
17 */
18
19#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
20#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
21
22/*
23 * These are used to make use of C type-checking..
24 */
25#if CONFIG_X86_PAE
26typedef struct { unsigned long long pte; } pte_t;
27typedef struct { unsigned long long pmd; } pmd_t;
28typedef struct { unsigned long long pgd; } pgd_t;
29#else
30typedef struct { unsigned long pte; } pte_t;
31typedef struct { unsigned long pmd; } pmd_t;
32typedef struct { unsigned long pgd; } pgd_t;
33#endif
34
35typedef struct { unsigned long pgprot; } pgprot_t;
36
37#define pte_val(x) ((x).pte)
38#define pmd_val(x) ((x).pmd)
39#define pgd_val(x) ((x).pgd)
40#define pgprot_val(x) ((x).pgprot)
41
42#define __pgprot(x) ((pgprot_t) { (x) } )
43
44#endif /* !__ASSEMBLY__ */
45
46/* to align the pointer to the (next) page boundary */
47#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
48
49/*
50 * This handles the memory map.. We could make this a config
51 * option, but too many people screw it up, and too few need
52 * it.
53 *
54 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
55 * a virtual address space of one gigabyte, which limits the
56 * amount of physical memory you can use to about 950MB.
57 *
58 * If you want more physical memory than this then see the CONFIG_BIGMEM
59 * option in the kernel configuration.
60 */
61
62#define __PAGE_OFFSET (0xC0000000)
63
64#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
65#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
66#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
67#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT)
68#define PHYSMAP_NR(addr) ((unsigned long)(addr) >> PAGE_SHIFT)
69
70#endif /* __KERNEL__ */
71#define page_to_pfn(page) (page_to_phys(page) >> PAGE_SHIFT)
72
73/* Pure 2^n version of get_order */
74static inline int get_order(unsigned long size)
75{
76 int order;
77
78 size = (size-1) >> (PAGE_SHIFT-1);
79 order = -1;
80 do {
81 size >>= 1;
82 order++;
83 } while (size);
84 return order;
85}
86
87#endif /* _I386_PAGE_H */
Note: See TracBrowser for help on using the repository browser.