Subversion Repositories HelenOS

Rev

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

Rev 2071 Rev 2141
Line 106... Line 106...
106
        int pagesize_code;
106
        int pagesize_code;
107
        size_t increment;
107
        size_t increment;
108
        count_t count;
108
        count_t count;
109
    } sizemap[] = {
109
    } sizemap[] = {
110
        { PAGESIZE_8K, 0, 1 },          /* 8K */
110
        { PAGESIZE_8K, 0, 1 },              /* 8K */
111
        { PAGESIZE_8K, PAGE_SIZE, 2 },      /* 16K */
111
        { PAGESIZE_8K, MMU_PAGE_SIZE, 2 },      /* 16K */
112
        { PAGESIZE_8K, PAGE_SIZE, 4 },      /* 32K */
112
        { PAGESIZE_8K, MMU_PAGE_SIZE, 4 },      /* 32K */
113
        { PAGESIZE_64K, 0, 1},          /* 64K */
113
        { PAGESIZE_64K, 0, 1},              /* 64K */
114
        { PAGESIZE_64K, 8 * PAGE_SIZE, 2 }, /* 128K */
114
        { PAGESIZE_64K, 8 * MMU_PAGE_SIZE, 2 },     /* 128K */
115
        { PAGESIZE_64K, 8 * PAGE_SIZE, 4 }, /* 256K */
115
        { PAGESIZE_64K, 8 * MMU_PAGE_SIZE, 4 },     /* 256K */
116
        { PAGESIZE_512K, 0, 1 },        /* 512K */
116
        { PAGESIZE_512K, 0, 1 },            /* 512K */
117
        { PAGESIZE_512K, 64 * PAGE_SIZE, 2 },   /* 1M */
117
        { PAGESIZE_512K, 64 * MMU_PAGE_SIZE, 2 },   /* 1M */
118
        { PAGESIZE_512K, 64 * PAGE_SIZE, 4 },   /* 2M */
118
        { PAGESIZE_512K, 64 * MMU_PAGE_SIZE, 4 },   /* 2M */
119
        { PAGESIZE_4M, 0, 1 },          /* 4M */
119
        { PAGESIZE_4M, 0, 1 },              /* 4M */
120
        { PAGESIZE_4M, 512 * PAGE_SIZE, 2 } /* 8M */
120
        { PAGESIZE_4M, 512 * MMU_PAGE_SIZE, 2 }     /* 8M */
121
    };
121
    };
122
   
122
   
123
    ASSERT(ALIGN_UP(physaddr, PAGE_SIZE) == physaddr);
123
    ASSERT(ALIGN_UP(physaddr, MMU_PAGE_SIZE) == physaddr);
124
    ASSERT(size <= 8 * 1024 * 1024);
124
    ASSERT(size <= 8 * 1024 * 1024);
125
   
125
   
126
    if (size <= FRAME_SIZE)
126
    if (size <= MMU_FRAME_SIZE)
127
        order = 0;
127
        order = 0;
128
    else
128
    else
129
        order = (fnzb64(size - 1) + 1) - FRAME_WIDTH;
129
        order = (fnzb64(size - 1) + 1) - MMU_FRAME_WIDTH;
130
 
130
 
131
    /*
131
    /*
132
     * Use virtual addresses that are beyond the limit of physical memory.
132
     * Use virtual addresses that are beyond the limit of physical memory.
133
     * Thus, the physical address space will not be wasted by holes created
133
     * Thus, the physical address space will not be wasted by holes created
134
     * by frame_alloc().
134
     * by frame_alloc().
135
     */
135
     */
136
    ASSERT(PA2KA(last_frame));
136
    ASSERT(PA2KA(last_frame));
137
    uintptr_t virtaddr = ALIGN_UP(PA2KA(last_frame), 1 << (order + FRAME_WIDTH));
137
    uintptr_t virtaddr = ALIGN_UP(PA2KA(last_frame),
-
 
138
        1 << (order + FRAME_WIDTH));
138
    last_frame = ALIGN_UP(KA2PA(virtaddr) + size, 1 << (order + FRAME_WIDTH));
139
    last_frame = ALIGN_UP(KA2PA(virtaddr) + size,
-
 
140
        1 << (order + FRAME_WIDTH));
139
   
141
   
140
    for (i = 0; i < sizemap[order].count; i++) {
142
    for (i = 0; i < sizemap[order].count; i++) {
141
        /*
143
        /*
142
         * First, insert the mapping into DTLB.
144
         * First, insert the mapping into DTLB.
143
         */
145
         */