Subversion Repositories HelenOS

Rev

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

Rev 2071 Rev 2089
Line 55... Line 55...
55
#define PAGE_COLOR_BITS 0           /* dummy */
55
#define PAGE_COLOR_BITS 0           /* dummy */
56
 
56
 
57
#ifdef KERNEL
57
#ifdef KERNEL
58
 
58
 
59
#ifndef __ASM__
59
#ifndef __ASM__
60
#  include <mm/page.h>
60
#   include <mm/mm.h>
61
#  include <arch/types.h>
61
#   include <arch/types.h>
62
#endif
62
#   include <arch/interrupt.h>
63
 
63
 
64
#ifndef __ASM__
-
 
65
static inline uintptr_t ka2pa(uintptr_t x)
64
static inline uintptr_t ka2pa(uintptr_t x)
66
{
65
{
67
    if (x > 0xffffffff80000000)
66
    if (x > 0xffffffff80000000)
68
        return x - 0xffffffff80000000;
67
        return x - 0xffffffff80000000;
69
    else
68
    else
70
        return x - 0xffff800000000000;
69
        return x - 0xffff800000000000;
71
}
70
}
-
 
71
 
72
# define KA2PA(x)      ka2pa((uintptr_t)x)
72
#   define KA2PA(x)      ka2pa((uintptr_t)x)
73
# define PA2KA_CODE(x)      (((uintptr_t) (x)) + 0xffffffff80000000)
73
#   define PA2KA_CODE(x)      (((uintptr_t) (x)) + 0xffffffff80000000)
74
# define PA2KA(x)      (((uintptr_t) (x)) + 0xffff800000000000)
74
#   define PA2KA(x)      (((uintptr_t) (x)) + 0xffff800000000000)
75
#else
75
#else
76
# define KA2PA(x)      ((x) - 0xffffffff80000000)
76
#   define KA2PA(x)      ((x) - 0xffffffff80000000)
77
# define PA2KA(x)      ((x) + 0xffffffff80000000)
77
#   define PA2KA(x)      ((x) + 0xffffffff80000000)
78
#endif
78
#endif
79
 
79
 
80
#define PTL0_ENTRIES_ARCH   512
80
#define PTL0_ENTRIES_ARCH   512
81
#define PTL1_ENTRIES_ARCH   512
81
#define PTL1_ENTRIES_ARCH   512
82
#define PTL2_ENTRIES_ARCH   512
82
#define PTL2_ENTRIES_ARCH   512
Line 131... Line 131...
131
#define PFERR_CODE_RSVD         (1<<3)
131
#define PFERR_CODE_RSVD         (1<<3)
132
 
132
 
133
/** When bit on this position os 1, the page fault was caused during instruction fecth. */
133
/** When bit on this position os 1, the page fault was caused during instruction fecth. */
134
#define PFERR_CODE_ID       (1<<4)
134
#define PFERR_CODE_ID       (1<<4)
135
 
135
 
136
/** Page Table Entry. */
-
 
137
struct page_specifier {
-
 
138
    unsigned present : 1;
-
 
139
    unsigned writeable : 1;
-
 
140
    unsigned uaccessible : 1;
-
 
141
    unsigned page_write_through : 1;
-
 
142
    unsigned page_cache_disable : 1;
-
 
143
    unsigned accessed : 1;
-
 
144
    unsigned dirty : 1;
-
 
145
    unsigned unused: 1;
-
 
146
    unsigned global : 1;
-
 
147
    unsigned soft_valid : 1;        /**< Valid content even if present bit is cleared. */
-
 
148
    unsigned avl : 2;
-
 
149
    unsigned addr_12_31 : 30;
-
 
150
    unsigned addr_32_51 : 21;
-
 
151
    unsigned no_execute : 1;
-
 
152
} __attribute__ ((packed));
-
 
153
 
-
 
154
static inline int get_pt_flags(pte_t *pt, index_t i)
136
static inline int get_pt_flags(pte_t *pt, index_t i)
155
{
137
{
156
    pte_t *p = &pt[i];
138
    pte_t *p = &pt[i];
157
   
139
   
158
    return (
140
    return (