Subversion Repositories HelenOS

Rev

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

Rev 2071 Rev 2089
Line 30... Line 30...
30
 * @{
30
 * @{
31
 */
31
 */
32
/** @file
32
/** @file
33
*/
33
*/
34
 
34
 
-
 
35
#include <memstr.h>
35
#include <arch/mm/vhpt.h>
36
#include <arch/mm/vhpt.h>
36
#include <mm/frame.h>
37
#include <mm/frame.h>
37
#include <print.h>
38
#include <print.h>
38
 
39
 
39
static vhpt_entry_t* vhpt_base;
40
static vhpt_entry_t* vhpt_base;
40
 
41
 
41
uintptr_t vhpt_set_up(void)
42
uintptr_t vhpt_set_up(void)
42
{
43
{
43
    vhpt_base = frame_alloc(VHPT_WIDTH-FRAME_WIDTH,FRAME_KA | FRAME_ATOMIC);
44
    vhpt_base = frame_alloc(VHPT_WIDTH - FRAME_WIDTH, FRAME_KA | FRAME_ATOMIC);
44
    if(!vhpt_base)
45
    if (!vhpt_base)
45
        panic("Kernel configured with VHPT but no memory for table.");
46
        panic("Kernel configured with VHPT but no memory for table.");
46
    vhpt_invalidate_all();
47
    vhpt_invalidate_all();
47
    return (uintptr_t) vhpt_base;
48
    return (uintptr_t) vhpt_base;
48
}
49
}
49
 
50
 
Line 59... Line 60...
59
 
60
 
60
 
61
 
61
    vrn = va >> VRN_SHIFT;
62
    vrn = va >> VRN_SHIFT;
62
    rid = ASID2RID(asid, vrn);
63
    rid = ASID2RID(asid, vrn);
63
                                                                                                               
64
                                                                                                               
64
  rr_save.word = rr_read(vrn);
65
    rr_save.word = rr_read(vrn);
65
  rr.word = rr_save.word;
66
    rr.word = rr_save.word;
66
  rr.map.rid = rid;
67
    rr.map.rid = rid;
67
  rr_write(vrn, rr.word);
68
    rr_write(vrn, rr.word);
68
  srlz_i();
69
    srlz_i();
69
   
70
   
70
    ventry = (vhpt_entry_t *) thash(va);
71
    ventry = (vhpt_entry_t *) thash(va);
71
  tag = ttag(va);
72
    tag = ttag(va);
72
  rr_write(vrn, rr_save.word);
73
    rr_write(vrn, rr_save.word);
73
  srlz_i();
74
    srlz_i();
74
  srlz_d();
75
    srlz_d();
75
 
76
 
76
    ventry->word[0]=entry.word[0];
77
    ventry->word[0] = entry.word[0];
77
    ventry->word[1]=entry.word[1];
78
    ventry->word[1] = entry.word[1];
78
    ventry->present.tag.tag_word = tag;
79
    ventry->present.tag.tag_word = tag;
79
   
-
 
80
 
-
 
81
}
80
}
82
 
81
 
83
void vhpt_invalidate_all()
82
void vhpt_invalidate_all()
84
{
83
{
85
    memsetb((uintptr_t)vhpt_base,1<<VHPT_WIDTH,0);
84
    memsetb((uintptr_t) vhpt_base, 1 << VHPT_WIDTH, 0);
86
}
85
}
87
 
86
 
88
void vhpt_invalidate_asid(asid_t asid)
87
void vhpt_invalidate_asid(asid_t asid)
89
{
88
{
90
    vhpt_invalidate_all();
89
    vhpt_invalidate_all();