Subversion Repositories HelenOS-historic

Rev

Rev 715 | Rev 747 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 715 Rev 746
1
/*
1
/*
2
 * Copyright (C) 2005 Jakub Jermar
2
 * Copyright (C) 2005 Jakub Jermar
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
#ifndef __ia64_PAGE_H__
29
#ifndef __ia64_PAGE_H__
30
#define __ia64_PAGE_H__
30
#define __ia64_PAGE_H__
31
 
31
 
32
#include <arch/types.h>
32
#include <arch/types.h>
33
#include <arch/mm/frame.h>
33
#include <arch/mm/frame.h>
34
 
34
 
35
#define PAGE_SIZE   FRAME_SIZE
35
#define PAGE_SIZE   FRAME_SIZE
36
#define PAGE_WIDTH  FRAME_WIDTH
36
#define PAGE_WIDTH  FRAME_WIDTH
37
 
37
 
38
#define KA2PA(x)    ((__address) (x))
38
#define KA2PA(x)    ((__address) (x))
39
#define PA2KA(x)    ((__address) (x))
39
#define PA2KA(x)    ((__address) (x))
40
 
40
 
41
#define GET_PTL0_ADDRESS_ARCH()         ((pte_t *) 0)
41
#define GET_PTL0_ADDRESS_ARCH()         ((pte_t *) 0)
42
#define SET_PTL0_ADDRESS_ARCH(ptl0)
42
#define SET_PTL0_ADDRESS_ARCH(ptl0)
43
 
43
 
44
/** Implementation of page hash table interface. */
44
/** Implementation of page hash table interface. */
-
 
45
#define HT_ENTRIES_ARCH         0
45
#define HT_HASH_ARCH(page, asid)    0
46
#define HT_HASH_ARCH(page, asid)    0
46
#define HT_COMPARE_ARCH(page, asid, t)  0
47
#define HT_COMPARE_ARCH(page, asid, t)  0
47
#define HT_SLOT_EMPTY_ARCH(t)       1
48
#define HT_SLOT_EMPTY_ARCH(t)       1
-
 
49
#define HT_INVALIDATE_SLOT_ARCH(t)
48
#define HT_GET_NEXT_ARCH(t)     0
50
#define HT_GET_NEXT_ARCH(t)     0
49
#define HT_SET_NEXT_ARCH(t, s)
51
#define HT_SET_NEXT_ARCH(t, s)
50
#define HT_SET_RECORD_ARCH(t, page, asid, frame, flags)
52
#define HT_SET_RECORD_ARCH(t, page, asid, frame, flags)
51
 
53
 
52
#define REGION_RID_MAIN 0
54
#define REGION_RID_MAIN 0
53
#define REGION_RID_FIRST_INVALID 16
55
#define REGION_RID_FIRST_INVALID 16
54
#define REGION_REGISTERS 8
56
#define REGION_REGISTERS 8
55
 
57
 
56
#define VHPT_WIDTH 16         /*64kB*/
58
#define VHPT_WIDTH 16         /*64kB*/
57
#define VHPT_SIZE (1<<VHPT_WIDTH)
59
#define VHPT_SIZE (1<<VHPT_WIDTH)
58
 
60
 
59
#define VHPT_BASE 0           /* Must be aligned to VHPT_SIZE */
61
#define VHPT_BASE 0           /* Must be aligned to VHPT_SIZE */
60
 
62
 
61
struct VHPT_tag_info
63
struct VHPT_tag_info
62
{
64
{
63
    unsigned long long tag       :63;
65
    unsigned long long tag       :63;
64
    unsigned           ti        : 1;
66
    unsigned           ti        : 1;
65
}__attribute__ ((packed));
67
}__attribute__ ((packed));
66
 
68
 
67
union VHPT_tag
69
union VHPT_tag
68
{
70
{
69
    struct VHPT_tag_info tag_info;
71
    struct VHPT_tag_info tag_info;
70
    unsigned             tag_word;
72
    unsigned             tag_word;
71
};
73
};
72
 
74
 
73
struct VHPT_entry_present
75
struct VHPT_entry_present
74
{
76
{
75
 
77
 
76
    /* Word 0 */
78
    /* Word 0 */
77
    unsigned p              : 1;
79
    unsigned p              : 1;
78
    unsigned rv0            : 1;
80
    unsigned rv0            : 1;
79
    unsigned ma             : 3;
81
    unsigned ma             : 3;
80
    unsigned a              : 1;
82
    unsigned a              : 1;
81
    unsigned d              : 1;
83
    unsigned d              : 1;
82
    unsigned pl             : 2;
84
    unsigned pl             : 2;
83
    unsigned ar             : 3;
85
    unsigned ar             : 3;
84
    unsigned long long ppn  :38;
86
    unsigned long long ppn  :38;
85
    unsigned rv1            : 2;
87
    unsigned rv1            : 2;
86
    unsigned ed             : 1;
88
    unsigned ed             : 1;
87
    unsigned ig1            :11;
89
    unsigned ig1            :11;
88
   
90
   
89
    /* Word 1 */
91
    /* Word 1 */
90
    unsigned rv2            : 2;
92
    unsigned rv2            : 2;
91
    unsigned ps             : 6;
93
    unsigned ps             : 6;
92
    unsigned key            :24;
94
    unsigned key            :24;
93
    unsigned rv3            :32;
95
    unsigned rv3            :32;
94
   
96
   
95
    /* Word 2 */
97
    /* Word 2 */
96
    union VHPT_tag tag;       /*This data is here as union because I'm not sure if anybody nead access to areas ti and tag in VHPT entry*/
98
    union VHPT_tag tag;       /*This data is here as union because I'm not sure if anybody nead access to areas ti and tag in VHPT entry*/
97
                            /* But I'm almost sure we nead access to whole word so there are both possibilities*/
99
                            /* But I'm almost sure we nead access to whole word so there are both possibilities*/
98
    /* Word 3 */                                                   
100
    /* Word 3 */                                                   
99
    unsigned long long next :64; /* This ignored field will be (in my hopes ;-) ) used as pointer in link list of entries with same hash value*/
101
    unsigned long long next :64; /* This ignored field will be (in my hopes ;-) ) used as pointer in link list of entries with same hash value*/
100
   
102
   
101
}__attribute__ ((packed));
103
}__attribute__ ((packed));
102
 
104
 
103
struct VHPT_entry_not_present
105
struct VHPT_entry_not_present
104
{
106
{
105
    /* Word 0 */
107
    /* Word 0 */
106
    unsigned p              : 1;
108
    unsigned p              : 1;
107
    unsigned long long ig0  :52;
109
    unsigned long long ig0  :52;
108
    unsigned ig1            :11;
110
    unsigned ig1            :11;
109
   
111
   
110
    /* Word 1 */
112
    /* Word 1 */
111
    unsigned rv2            : 2;
113
    unsigned rv2            : 2;
112
    unsigned ps             : 6;
114
    unsigned ps             : 6;
113
    unsigned long long ig2  :56;
115
    unsigned long long ig2  :56;
114
 
116
 
115
   
117
   
116
    /* Word 2 */
118
    /* Word 2 */
117
    union VHPT_tag tag;       /*This data is here as union because I'm not sure if anybody nead access to areas ti and tag in VHPT entry*/
119
    union VHPT_tag tag;       /*This data is here as union because I'm not sure if anybody nead access to areas ti and tag in VHPT entry*/
118
                            /* But I'm almost sure we nead access to whole word so there are both possibilities*/
120
                            /* But I'm almost sure we nead access to whole word so there are both possibilities*/
119
    /* Word 3 */                                                   
121
    /* Word 3 */                                                   
120
    unsigned long long next :64; /* This ignored field will be (in my hopes ;-) ) used as pointer in link list of entries with same hash value*/
122
    unsigned long long next :64; /* This ignored field will be (in my hopes ;-) ) used as pointer in link list of entries with same hash value*/
121
   
123
   
122
}__attribute__ ((packed));
124
}__attribute__ ((packed));
123
 
125
 
124
typedef union VHPT_entry
126
typedef union VHPT_entry
125
{
127
{
126
    struct VHPT_entry_present        present;
128
    struct VHPT_entry_present        present;
127
    struct VHPT_entry_not_present    not_present;
129
    struct VHPT_entry_not_present    not_present;
128
}VHPT_entry;
130
}VHPT_entry;
129
 
131
 
130
extern void page_arch_init(void);
132
extern void page_arch_init(void);
131
 
133
 
132
 
134
 
133
struct region_register_map
135
struct region_register_map
134
{
136
{
135
  unsigned ve            : 1;
137
  unsigned ve            : 1;
136
    unsigned r0            : 1;
138
    unsigned r0            : 1;
137
    unsigned ps            : 6;
139
    unsigned ps            : 6;
138
    unsigned rid           :24;
140
    unsigned rid           :24;
139
    unsigned r1            :32;
141
    unsigned r1            :32;
140
}__attribute__ ((packed));
142
}__attribute__ ((packed));
141
 
143
 
142
 
144
 
143
typedef union region_register
145
typedef union region_register
144
{
146
{
145
    struct region_register_map   map;
147
    struct region_register_map   map;
146
    unsigned long long           word;
148
    unsigned long long           word;
147
}region_register;
149
}region_register;
148
 
150
 
149
struct PTA_register_map
151
struct PTA_register_map
150
{
152
{
151
  unsigned ve            : 1;
153
  unsigned ve            : 1;
152
    unsigned r0            : 1;
154
    unsigned r0            : 1;
153
    unsigned size          : 6;
155
    unsigned size          : 6;
154
    unsigned vf            : 1;
156
    unsigned vf            : 1;
155
    unsigned r1            : 6;
157
    unsigned r1            : 6;
156
    unsigned long long base:49;
158
    unsigned long long base:49;
157
}__attribute__ ((packed));
159
}__attribute__ ((packed));
158
 
160
 
159
 
161
 
160
typedef union PTA_register
162
typedef union PTA_register
161
{
163
{
162
    struct PTA_register_map   map;
164
    struct PTA_register_map   map;
163
    unsigned long long        word;
165
    unsigned long long        word;
164
}PTA_register;
166
}PTA_register;
165
 
167
 
166
 
168
 
167
#endif
169
#endif
168
 
170