Subversion Repositories HelenOS

Rev

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

Rev 2787 Rev 3424
Line 101... Line 101...
101
 
101
 
102
    dst_ptl0 = (pte_t *) frame_alloc(PTL0_SIZE, FRAME_KA);
102
    dst_ptl0 = (pte_t *) frame_alloc(PTL0_SIZE, FRAME_KA);
103
    table_size = FRAME_SIZE << PTL0_SIZE;
103
    table_size = FRAME_SIZE << PTL0_SIZE;
104
 
104
 
105
    if (flags & FLAG_AS_KERNEL) {
105
    if (flags & FLAG_AS_KERNEL) {
106
        memsetb((uintptr_t) dst_ptl0, table_size, 0);
106
        memsetb(dst_ptl0, table_size, 0);
107
    } else {
107
    } else {
108
        uintptr_t src, dst;
108
        uintptr_t src, dst;
109
   
109
   
110
        /*
110
        /*
111
         * Copy the kernel address space portion to new PTL0.
111
         * Copy the kernel address space portion to new PTL0.
Line 116... Line 116...
116
        src_ptl0 = (pte_t *) PA2KA((uintptr_t) AS_KERNEL->genarch.page_table);
116
        src_ptl0 = (pte_t *) PA2KA((uintptr_t) AS_KERNEL->genarch.page_table);
117
 
117
 
118
        src = (uintptr_t) &src_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];
118
        src = (uintptr_t) &src_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];
119
        dst = (uintptr_t) &dst_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];
119
        dst = (uintptr_t) &dst_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];
120
 
120
 
121
        memsetb((uintptr_t) dst_ptl0, table_size, 0);
121
        memsetb(dst_ptl0, table_size, 0);
122
        memcpy((void *) dst, (void *) src, table_size - (src - (uintptr_t) src_ptl0));
122
        memcpy((void *) dst, (void *) src, table_size - (src - (uintptr_t) src_ptl0));
123
        mutex_unlock(&AS_KERNEL->lock);
123
        mutex_unlock(&AS_KERNEL->lock);
124
        interrupts_restore(ipl);
124
        interrupts_restore(ipl);
125
    }
125
    }
126
 
126