Subversion Repositories HelenOS-historic

Rev

Rev 534 | Rev 687 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 534 Rev 684
Line 53... Line 53...
53
 
53
 
54
#define PAGE_READ       (1<<PAGE_READ_SHIFT)
54
#define PAGE_READ       (1<<PAGE_READ_SHIFT)
55
#define PAGE_WRITE      (1<<PAGE_WRITE_SHIFT)
55
#define PAGE_WRITE      (1<<PAGE_WRITE_SHIFT)
56
#define PAGE_EXEC       (1<<PAGE_EXEC_SHIFT)
56
#define PAGE_EXEC       (1<<PAGE_EXEC_SHIFT)
57
 
57
 
58
/*
-
 
-
 
58
struct page_operations {
59
 * This is the generic 4-level page table interface.
59
    void (* mapping_insert)(__address page, __address frame, int flags, __address root);
60
 * Architectures are supposed to implement *_ARCH macros.
60
    pte_t *(* mapping_find)(__address page, __address root);
61
 */
61
};
-
 
62
typedef struct page_operations page_operations_t;
62
 
63
 
63
/*
-
 
64
 * These macros process vaddr and extract those portions
-
 
65
 * of it that function as indices to respective page tables.
-
 
66
 */
-
 
67
#define PTL0_INDEX(vaddr)       PTL0_INDEX_ARCH(vaddr)
-
 
68
#define PTL1_INDEX(vaddr)       PTL1_INDEX_ARCH(vaddr)
-
 
69
#define PTL2_INDEX(vaddr)       PTL2_INDEX_ARCH(vaddr)
-
 
70
#define PTL3_INDEX(vaddr)       PTL3_INDEX_ARCH(vaddr)
-
 
71
 
-
 
72
#define GET_PTL0_ADDRESS()      GET_PTL0_ADDRESS_ARCH()
-
 
73
#define SET_PTL0_ADDRESS(ptl0)      SET_PTL0_ADDRESS_ARCH(ptl0)
-
 
74
 
-
 
75
/*
-
 
76
 * These macros traverse the 4-level tree of page tables,
-
 
77
 * each descending by one level.
-
 
78
 */
-
 
79
#define GET_PTL1_ADDRESS(ptl0, i)   GET_PTL1_ADDRESS_ARCH(ptl0, i)
-
 
80
#define GET_PTL2_ADDRESS(ptl1, i)   GET_PTL2_ADDRESS_ARCH(ptl1, i)
-
 
81
#define GET_PTL3_ADDRESS(ptl2, i)   GET_PTL3_ADDRESS_ARCH(ptl2, i)
-
 
82
#define GET_FRAME_ADDRESS(ptl3, i)  GET_FRAME_ADDRESS_ARCH(ptl3, i)
-
 
83
 
-
 
84
/*
-
 
85
 * These macros are provided to change shape of the 4-level
-
 
86
 * tree of page tables on respective level.
64
extern page_operations_t *page_operations;
87
 */
-
 
88
#define SET_PTL1_ADDRESS(ptl0, i, a)    SET_PTL1_ADDRESS_ARCH(ptl0, i, a)
-
 
89
#define SET_PTL2_ADDRESS(ptl1, i, a)    SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
-
 
90
#define SET_PTL3_ADDRESS(ptl2, i, a)    SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
-
 
91
#define SET_FRAME_ADDRESS(ptl3, i, a)   SET_FRAME_ADDRESS_ARCH(ptl3, i, a)
-
 
92
 
-
 
93
/*
-
 
94
 * These macros are provided to query various flags within the page tables.
-
 
95
 */
-
 
96
#define GET_PTL1_FLAGS(ptl0, i)     GET_PTL1_FLAGS_ARCH(ptl0, i)
-
 
97
#define GET_PTL2_FLAGS(ptl1, i)     GET_PTL2_FLAGS_ARCH(ptl1, i)
-
 
98
#define GET_PTL3_FLAGS(ptl2, i)     GET_PTL3_FLAGS_ARCH(ptl2, i)
-
 
99
#define GET_FRAME_FLAGS(ptl3, i)    GET_FRAME_FLAGS_ARCH(ptl3, i)
-
 
100
 
-
 
101
/*
-
 
102
 * These macros are provided to set/clear various flags within the page tables.
-
 
103
 */
-
 
104
#define SET_PTL1_FLAGS(ptl0, i, x)  SET_PTL1_FLAGS_ARCH(ptl0, i, x)
-
 
105
#define SET_PTL2_FLAGS(ptl1, i, x)  SET_PTL2_FLAGS_ARCH(ptl1, i, x)
-
 
106
#define SET_PTL3_FLAGS(ptl2, i, x)  SET_PTL3_FLAGS_ARCH(ptl2, i, x)
-
 
107
#define SET_FRAME_FLAGS(ptl3, i, x) SET_FRAME_FLAGS_ARCH(ptl3, i, x)
-
 
108
 
65
 
109
extern void page_init(void);
66
extern void page_init(void);
110
extern void page_mapping_insert(__address page, __address frame, int flags, __address root);
67
extern void page_mapping_insert(__address page, __address frame, int flags, __address root);
111
extern pte_t *page_mapping_find(__address page, __address root);
68
extern pte_t *page_mapping_find(__address page, __address root);
112
extern void map_structure(__address s, size_t size);
69
extern void map_structure(__address s, size_t size);