Skip to content

Commit 0bde160

Browse files
committed
Make page.h includable from user code (used by unicorn)
1 parent 7117e60 commit 0bde160

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

arch/ish/include/asm/page.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
#ifndef __ASM_ISH_PAGE_H
22
#define __ASM_ISH_PAGE_H
3-
#include <linux/const.h>
43

54
#define PAGE_SHIFT 12
65
#define PAGE_SIZE (_UL(1) << PAGE_SHIFT)
76
#define PAGE_MASK (~(PAGE_SIZE-1))
87

98
#ifndef __ASSEMBLY__
109

10+
extern unsigned long ish_phys_base;
11+
extern unsigned long ish_phys_size;
12+
#define __pa(virt) ((unsigned long) (virt) - ish_phys_base)
13+
#define __va(phys) ((void *) ((unsigned long) (phys) + ish_phys_base))
14+
#define PAGE_OFFSET (ish_phys_base)
15+
16+
#ifdef __KERNEL__
17+
18+
#include <linux/const.h>
19+
1120
typedef struct {
1221
unsigned long pte;
1322
} pte_t;
@@ -31,12 +40,6 @@ typedef struct page *pgtable_t;
3140
#define pgprot_val(x) ((x).pgprot)
3241
#define __pgprot(x) ((pgprot_t) { (x) })
3342

34-
extern unsigned long ish_phys_base;
35-
extern unsigned long ish_phys_size;
36-
#define __pa(virt) ((unsigned long) (virt) - ish_phys_base)
37-
#define __va(phys) ((void *) ((unsigned long) (phys) + ish_phys_base))
38-
#define PAGE_OFFSET (ish_phys_base)
39-
4043
#define pfn_valid(pfn) ((pfn) < max_mapnr)
4144
#define phys_to_pfn(p) ((p) >> PAGE_SHIFT)
4245
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
@@ -58,4 +61,6 @@ extern unsigned long ish_phys_size;
5861

5962
#include <asm-generic/getorder.h>
6063

64+
#endif /* __KERNEL__ */
65+
6166
#endif

0 commit comments

Comments
 (0)