Subversion Repositories HelenOS-historic

Rev

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

Rev 1048 Rev 1070
Line 163... Line 163...
163
        if ((entry->p_offset % entry->p_align) != (entry->p_vaddr % entry->p_align)) {
163
        if ((entry->p_offset % entry->p_align) != (entry->p_vaddr % entry->p_align)) {
164
            return EE_INVALID;
164
            return EE_INVALID;
165
        }
165
        }
166
    }
166
    }
167
 
167
 
168
    /*
-
 
169
     * Check if the segment doesn't interfere with kernel address space.
-
 
170
     */
-
 
171
    if (entry->p_vaddr + ALIGN_UP(entry->p_memsz, PAGE_SIZE) >= USER_ADDRESS_SPACE_END)
-
 
172
        return EE_MEMORY;
-
 
173
   
-
 
174
    if (entry->p_flags & PF_X)
168
    if (entry->p_flags & PF_X)
175
        flags |= AS_AREA_EXEC;
169
        flags |= AS_AREA_EXEC;
176
    if (entry->p_flags & PF_W)
170
    if (entry->p_flags & PF_W)
177
        flags |= AS_AREA_WRITE;
171
        flags |= AS_AREA_WRITE;
178
    if (entry->p_flags & PF_R)
172
    if (entry->p_flags & PF_R)
Line 193... Line 187...
193
    } else /* Map identically original data */
187
    } else /* Map identically original data */
194
        segment = ((void *) elf) + entry->p_offset;
188
        segment = ((void *) elf) + entry->p_offset;
195
 
189
 
196
    a = as_area_create(as, flags, entry->p_memsz, entry->p_vaddr);
190
    a = as_area_create(as, flags, entry->p_memsz, entry->p_vaddr);
197
    if (!a)
191
    if (!a)
198
        return EE_IRRECOVERABLE;
192
        return EE_MEMORY;
199
   
193
   
200
    for (i = 0; i < SIZE2FRAMES(entry->p_filesz); i++) {
194
    for (i = 0; i < SIZE2FRAMES(entry->p_filesz); i++) {
201
        as_set_mapping(as, entry->p_vaddr + i*PAGE_SIZE, KA2PA(((__address) segment) + i*PAGE_SIZE));
195
        as_set_mapping(as, entry->p_vaddr + i*PAGE_SIZE, KA2PA(((__address) segment) + i*PAGE_SIZE));
202
    }
196
    }
203
   
197