1 /* $Id: page.h,v 1.27 1999/07/31 00:07:25 davem Exp $ */
3 #ifndef _SPARC64_PAGE_H
4 #define _SPARC64_PAGE_H
8 /* I have my suspicions... -DaveM */
9 #define PAGE_SIZE (1UL << PAGE_SHIFT)
11 #define PAGE_SIZE (1 << PAGE_SHIFT)
14 #define PAGE_MASK (~(PAGE_SIZE-1))
21 #define BUG() __builtin_trap()
22 #define PAGE_BUG(page) BUG()
24 extern void clear_page(unsigned long page
);
25 extern void copy_page(unsigned long to
, unsigned long from
);
27 /* GROSS, defining this makes gcc pass these types as aggregates,
28 * and thus on the stack, turn this crap off... -DaveM
31 /* #define STRICT_MM_TYPECHECKS */
33 #ifdef STRICT_MM_TYPECHECKS
34 /* These are used to make use of C type-checking.. */
35 typedef struct { unsigned long pte
; } pte_t
;
36 typedef struct { unsigned long iopte
; } iopte_t
;
37 typedef struct { unsigned int pmd
; } pmd_t
;
38 typedef struct { unsigned int pgd
; } pgd_t
;
39 typedef struct { unsigned long ctxd
; } ctxd_t
;
40 typedef struct { unsigned long pgprot
; } pgprot_t
;
41 typedef struct { unsigned long iopgprot
; } iopgprot_t
;
43 #define pte_val(x) ((x).pte)
44 #define iopte_val(x) ((x).iopte)
45 #define pmd_val(x) ((unsigned long)(x).pmd)
46 #define pgd_val(x) ((unsigned long)(x).pgd)
47 #define ctxd_val(x) ((x).ctxd)
48 #define pgprot_val(x) ((x).pgprot)
49 #define iopgprot_val(x) ((x).iopgprot)
51 #define __pte(x) ((pte_t) { (x) } )
52 #define __iopte(x) ((iopte_t) { (x) } )
53 #define __pmd(x) ((pmd_t) { (x) } )
54 #define __pgd(x) ((pgd_t) { (x) } )
55 #define __ctxd(x) ((ctxd_t) { (x) } )
56 #define __pgprot(x) ((pgprot_t) { (x) } )
57 #define __iopgprot(x) ((iopgprot_t) { (x) } )
60 /* .. while these make it easier on the compiler */
61 typedef unsigned long pte_t
;
62 typedef unsigned long iopte_t
;
63 typedef unsigned int pmd_t
;
64 typedef unsigned int pgd_t
;
65 typedef unsigned long ctxd_t
;
66 typedef unsigned long pgprot_t
;
67 typedef unsigned long iopgprot_t
;
69 #define pte_val(x) (x)
70 #define iopte_val(x) (x)
71 #define pmd_val(x) ((unsigned long)(x))
72 #define pgd_val(x) ((unsigned long)(x))
73 #define ctxd_val(x) (x)
74 #define pgprot_val(x) (x)
75 #define iopgprot_val(x) (x)
78 #define __iopte(x) (x)
82 #define __pgprot(x) (x)
83 #define __iopgprot(x) (x)
85 #endif /* (STRICT_MM_TYPECHECKS) */
87 #define TASK_UNMAPPED_BASE ((current->thread.flags & SPARC_FLAG_32BIT) ? \
88 (0x0000000070000000UL) : (PAGE_OFFSET))
90 #endif /* !(__ASSEMBLY__) */
92 /* to align the pointer to the (next) page boundary */
93 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
96 /* Do prdele, look what happens to be in %g4... */
97 register unsigned long page_offset
asm("g4");
98 #define PAGE_OFFSET page_offset
100 #define PAGE_OFFSET 0xFFFFF80000000000
103 #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
104 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
105 #define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT)
109 /* The following structure is used to hold the physical
110 * memory configuration of the machine. This is filled in
111 * probe_memory() and is later used by mem_init() to set up
112 * mem_map[]. We statically allocate SPARC_PHYS_BANKS of
113 * these structs, this is arbitrary. The entry after the
114 * last valid one has num_bytes==0.
117 struct sparc_phys_banks
{
118 unsigned long base_addr
;
119 unsigned long num_bytes
;
122 #define SPARC_PHYS_BANKS 32
124 extern struct sparc_phys_banks sp_banks
[SPARC_PHYS_BANKS
];
126 #endif /* !(__ASSEMBLY__) */
128 #endif /* !(__KERNEL__) */
130 #endif /* !(_SPARC64_PAGE_H) */