Subversion Repositories HelenOS-historic

Rev

Rev 1702 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1702 Rev 1780
Line 41... Line 41...
41
#define PAGE_SIZE   FRAME_SIZE
41
#define PAGE_SIZE   FRAME_SIZE
42
 
42
 
43
#ifdef KERNEL
43
#ifdef KERNEL
44
 
44
 
45
#ifndef __ASM__
45
#ifndef __ASM__
46
#   define KA2PA(x) (((__address) (x)) - 0x80000000)
46
#   define KA2PA(x) (((uintptr_t) (x)) - 0x80000000)
47
#   define PA2KA(x) (((__address) (x)) + 0x80000000)
47
#   define PA2KA(x) (((uintptr_t) (x)) + 0x80000000)
48
#else
48
#else
49
#   define KA2PA(x) ((x) - 0x80000000)
49
#   define KA2PA(x) ((x) - 0x80000000)
50
#   define PA2KA(x) ((x) + 0x80000000)
50
#   define PA2KA(x) ((x) + 0x80000000)
51
#endif
51
#endif
52
 
52
 
Line 65... Line 65...
65
#define PTL3_INDEX_ARCH(vaddr)  (((vaddr)>>12)&0x3ff)
65
#define PTL3_INDEX_ARCH(vaddr)  (((vaddr)>>12)&0x3ff)
66
 
66
 
67
#define GET_PTL1_ADDRESS_ARCH(ptl0, i)      ((pte_t *)((((pte_t *)(ptl0))[(i)].frame_address)<<12))
67
#define GET_PTL1_ADDRESS_ARCH(ptl0, i)      ((pte_t *)((((pte_t *)(ptl0))[(i)].frame_address)<<12))
68
#define GET_PTL2_ADDRESS_ARCH(ptl1, i)      (ptl1)
68
#define GET_PTL2_ADDRESS_ARCH(ptl1, i)      (ptl1)
69
#define GET_PTL3_ADDRESS_ARCH(ptl2, i)      (ptl2)
69
#define GET_PTL3_ADDRESS_ARCH(ptl2, i)      (ptl2)
70
#define GET_FRAME_ADDRESS_ARCH(ptl3, i)     ((__address)((((pte_t *)(ptl3))[(i)].frame_address)<<12))
70
#define GET_FRAME_ADDRESS_ARCH(ptl3, i)     ((uintptr_t)((((pte_t *)(ptl3))[(i)].frame_address)<<12))
71
 
71
 
72
#define SET_PTL0_ADDRESS_ARCH(ptl0)     (write_cr3((__address) (ptl0)))
72
#define SET_PTL0_ADDRESS_ARCH(ptl0)     (write_cr3((uintptr_t) (ptl0)))
73
#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a)   (((pte_t *)(ptl0))[(i)].frame_address = (a)>>12)
73
#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a)   (((pte_t *)(ptl0))[(i)].frame_address = (a)>>12)
74
#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
74
#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
75
#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
75
#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
76
#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a)  (((pte_t *)(ptl3))[(i)].frame_address = (a)>>12)
76
#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a)  (((pte_t *)(ptl3))[(i)].frame_address = (a)>>12)
77
 
77
 
Line 83... Line 83...
83
#define SET_PTL1_FLAGS_ARCH(ptl0, i, x)     set_pt_flags((pte_t *)(ptl0), (index_t)(i), (x))
83
#define SET_PTL1_FLAGS_ARCH(ptl0, i, x)     set_pt_flags((pte_t *)(ptl0), (index_t)(i), (x))
84
#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
84
#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
85
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
85
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
86
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x)    set_pt_flags((pte_t *)(ptl3), (index_t)(i), (x))
86
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x)    set_pt_flags((pte_t *)(ptl3), (index_t)(i), (x))
87
 
87
 
88
#define PTE_VALID_ARCH(p)           (*((__u32 *) (p)) != 0)
88
#define PTE_VALID_ARCH(p)           (*((uint32_t *) (p)) != 0)
89
#define PTE_PRESENT_ARCH(p)         ((p)->present != 0)
89
#define PTE_PRESENT_ARCH(p)         ((p)->present != 0)
90
#define PTE_GET_FRAME_ARCH(p)           ((p)->frame_address<<FRAME_WIDTH)
90
#define PTE_GET_FRAME_ARCH(p)           ((p)->frame_address<<FRAME_WIDTH)
91
#define PTE_WRITABLE_ARCH(p)            ((p)->writeable != 0)
91
#define PTE_WRITABLE_ARCH(p)            ((p)->writeable != 0)
92
#define PTE_EXECUTABLE_ARCH(p)          1
92
#define PTE_EXECUTABLE_ARCH(p)          1
93
 
93