Subversion Repositories HelenOS

Rev

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

Rev 3022 Rev 4055
Line 25... Line 25...
25
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
28
 */
29
 
29
 
30
/** @addtogroup ia64mm 
30
/** @addtogroup ia64mm
31
 * @{
31
 * @{
32
 */
32
 */
33
/** @file
33
/** @file
34
 */
34
 */
35
 
35
 
Line 45... Line 45...
45
#include <config.h>
45
#include <config.h>
46
#include <panic.h>
46
#include <panic.h>
47
#include <arch/asm.h>
47
#include <arch/asm.h>
48
#include <arch/barrier.h>
48
#include <arch/barrier.h>
49
#include <memstr.h>
49
#include <memstr.h>
-
 
50
#include <align.h>
50
 
51
 
51
static void set_environment(void);
52
static void set_environment(void);
52
 
53
 
53
/** Initialize ia64 virtual address translation subsystem. */
54
/** Initialize ia64 virtual address translation subsystem. */
54
void page_arch_init(void)
55
void page_arch_init(void)
Line 60... Line 61...
60
 
61
 
61
/** Initialize VHPT and region registers. */
62
/** Initialize VHPT and region registers. */
62
void set_environment(void)
63
void set_environment(void)
63
{
64
{
64
    region_register rr;
65
    region_register rr;
65
    pta_register pta;  
66
    pta_register pta;
66
    int i;
67
    int i;
67
#ifdef CONFIG_VHPT  
68
#ifdef CONFIG_VHPT
68
    uintptr_t vhpt_base;
69
    uintptr_t vhpt_base;
69
#endif
70
#endif
70
 
71
 
71
    /*
72
    /*
72
     * First set up kernel region register.
73
     * First set up kernel region register.
Line 120... Line 121...
120
 
121
 
121
/** Calculate address of collision chain from VPN and ASID.
122
/** Calculate address of collision chain from VPN and ASID.
122
 *
123
 *
123
 * Interrupts must be disabled.
124
 * Interrupts must be disabled.
124
 *
125
 *
125
 * @param page Address of virtual page including VRN bits.
126
 * @param page      Address of virtual page including VRN bits.
126
 * @param asid Address space identifier.
127
 * @param asid      Address space identifier.
127
 *
128
 *
128
 * @return VHPT entry address.
129
 * @return      VHPT entry address.
129
 */
130
 */
130
vhpt_entry_t *vhpt_hash(uintptr_t page, asid_t asid)
131
vhpt_entry_t *vhpt_hash(uintptr_t page, asid_t asid)
131
{
132
{
132
    region_register rr_save, rr;
133
    region_register rr_save, rr;
133
    index_t vrn;
134
    index_t vrn;
Line 164... Line 165...
164
 
165
 
165
/** Compare ASID and VPN against PTE.
166
/** Compare ASID and VPN against PTE.
166
 *
167
 *
167
 * Interrupts must be disabled.
168
 * Interrupts must be disabled.
168
 *
169
 *
169
 * @param page Address of virtual page including VRN bits.
170
 * @param page      Address of virtual page including VRN bits.
170
 * @param asid Address space identifier.
171
 * @param asid      Address space identifier.
171
 *
172
 *
172
 * @return True if page and asid match the page and asid of t, false otherwise.
173
 * @return      True if page and asid match the page and asid of t,
-
 
174
 *          false otherwise.
173
 */
175
 */
174
bool vhpt_compare(uintptr_t page, asid_t asid, vhpt_entry_t *v)
176
bool vhpt_compare(uintptr_t page, asid_t asid, vhpt_entry_t *v)
175
{
177
{
176
    region_register rr_save, rr;   
178
    region_register rr_save, rr;   
177
    index_t vrn;
179
    index_t vrn;
Line 208... Line 210...
208
}
210
}
209
 
211
 
210
/** Set up one VHPT entry.
212
/** Set up one VHPT entry.
211
 *
213
 *
212
 * @param v VHPT entry to be set up.
214
 * @param v VHPT entry to be set up.
213
 * @param page Virtual address of the page mapped by the entry.
215
 * @param page      Virtual address of the page mapped by the entry.
214
 * @param asid Address space identifier of the address space to which page belongs.
216
 * @param asid      Address space identifier of the address space to which
-
 
217
 *          page belongs.
215
 * @param frame Physical address of the frame to wich page is mapped.
218
 * @param frame     Physical address of the frame to wich page is mapped.
216
 * @param flags Different flags for the mapping.
219
 * @param flags     Different flags for the mapping.
217
 */
220
 */
-
 
221
void
218
void vhpt_set_record(vhpt_entry_t *v, uintptr_t page, asid_t asid, uintptr_t frame, int flags)
222
vhpt_set_record(vhpt_entry_t *v, uintptr_t page, asid_t asid, uintptr_t frame,
-
 
223
    int flags)
219
{
224
{
220
    region_register rr_save, rr;   
225
    region_register rr_save, rr;   
221
    index_t vrn;
226
    index_t vrn;
222
    rid_t rid;
227
    rid_t rid;
223
    uint64_t tag;
228
    uint64_t tag;
Line 247... Line 252...
247
    v->word[1] = 0;
252
    v->word[1] = 0;
248
    v->word[2] = 0;
253
    v->word[2] = 0;
249
    v->word[3] = 0;
254
    v->word[3] = 0;
250
   
255
   
251
    v->present.p = true;
256
    v->present.p = true;
252
    v->present.ma = (flags & PAGE_CACHEABLE) ? MA_WRITEBACK : MA_UNCACHEABLE;
257
    v->present.ma = (flags & PAGE_CACHEABLE) ?
-
 
258
        MA_WRITEBACK : MA_UNCACHEABLE;
253
    v->present.a = false;   /* not accessed */
259
    v->present.a = false;   /* not accessed */
254
    v->present.d = false;   /* not dirty */
260
    v->present.d = false;   /* not dirty */
255
    v->present.pl = (flags & PAGE_USER) ? PL_USER : PL_KERNEL;
261
    v->present.pl = (flags & PAGE_USER) ? PL_USER : PL_KERNEL;
256
    v->present.ar = (flags & PAGE_WRITE) ? AR_WRITE : AR_READ;
262
    v->present.ar = (flags & PAGE_WRITE) ? AR_WRITE : AR_READ;
257
    v->present.ar |= (flags & PAGE_EXEC) ? AR_EXECUTE : 0;
263
    v->present.ar |= (flags & PAGE_EXEC) ? AR_EXECUTE : 0;
Line 260... Line 266...
260
    v->present.ps = PAGE_WIDTH;
266
    v->present.ps = PAGE_WIDTH;
261
    v->present.key = 0;
267
    v->present.key = 0;
262
    v->present.tag.tag_word = tag;
268
    v->present.tag.tag_word = tag;
263
}
269
}
264
 
270
 
-
 
271
uintptr_t hw_map(uintptr_t physaddr, size_t size __attribute__ ((unused)))
-
 
272
{
-
 
273
    /* THIS is a dirty hack. */
-
 
274
    return (uintptr_t)((uint64_t)(PA2KA(physaddr)) + VIO_OFFSET);
-
 
275
}
-
 
276
 
265
/** @}
277
/** @}
266
 */
278
 */