Subversion Repositories HelenOS

Rev

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

Rev 2106 Rev 2465
Line 73... Line 73...
73
    pte_t *newpt;
73
    pte_t *newpt;
74
 
74
 
75
    ptl0 = (pte_t *) PA2KA((uintptr_t) as->genarch.page_table);
75
    ptl0 = (pte_t *) PA2KA((uintptr_t) as->genarch.page_table);
76
 
76
 
77
    if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) {
77
    if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) {
78
        newpt = (pte_t *)frame_alloc(ONE_FRAME, FRAME_KA);
78
        newpt = (pte_t *)frame_alloc(PTL1_SIZE, FRAME_KA);
79
        memsetb((uintptr_t)newpt, PAGE_SIZE, 0);
79
        memsetb((uintptr_t)newpt, FRAME_SIZE << PTL1_SIZE, 0);
80
        SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt));
80
        SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt));
81
        SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
81
        SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
82
    }
82
    }
83
 
83
 
84
    ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
84
    ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
85
 
85
 
86
    if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) {
86
    if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) {
87
        newpt = (pte_t *)frame_alloc(ONE_FRAME, FRAME_KA);
87
        newpt = (pte_t *)frame_alloc(PTL2_SIZE, FRAME_KA);
88
        memsetb((uintptr_t)newpt, PAGE_SIZE, 0);
88
        memsetb((uintptr_t)newpt, FRAME_SIZE << PTL2_SIZE, 0);
89
        SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt));
89
        SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt));
90
        SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
90
        SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
91
    }
91
    }
92
 
92
 
93
    ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
93
    ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
94
 
94
 
95
    if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) {
95
    if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) {
96
        newpt = (pte_t *)frame_alloc(ONE_FRAME, FRAME_KA);
96
        newpt = (pte_t *)frame_alloc(PTL3_SIZE, FRAME_KA);
97
        memsetb((uintptr_t)newpt, PAGE_SIZE, 0);
97
        memsetb((uintptr_t)newpt, FRAME_SIZE << PTL3_SIZE, 0);
98
        SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt));
98
        SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt));
99
        SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
99
        SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
100
    }
100
    }
101
 
101
 
102
    ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
102
    ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));