Subversion Repositories HelenOS

Rev

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

Rev 2990 Rev 2992
Line 153... Line 153...
153
        header->e_ident[EI_CLASS] != ELF_CLASS) {
153
        header->e_ident[EI_CLASS] != ELF_CLASS) {
154
        printf("incompatible data/version/class\n");
154
        printf("incompatible data/version/class\n");
155
        return EE_INCOMPATIBLE;
155
        return EE_INCOMPATIBLE;
156
    }
156
    }
157
 
157
 
158
    if (header->e_phentsize != sizeof(elf_segment_header_t))
158
    if (header->e_phentsize != sizeof(elf_segment_header_t)) {
-
 
159
        printf("e_phentsize:%d != %d\n", header->e_phentsize,
-
 
160
            sizeof(elf_segment_header_t));
159
        return EE_INCOMPATIBLE;
161
        return EE_INCOMPATIBLE;
-
 
162
    }
160
 
163
 
161
    if (header->e_shentsize != sizeof(elf_section_header_t))
164
    if (header->e_shentsize != sizeof(elf_section_header_t)) {
-
 
165
        printf("e_shentsize:%d != %d\n", header->e_shentsize,
-
 
166
            sizeof(elf_section_header_t));
162
        return EE_INCOMPATIBLE;
167
        return EE_INCOMPATIBLE;
-
 
168
    }
163
 
169
 
164
    /* Check if the object type is supported. */
170
    /* Check if the object type is supported. */
165
    if (header->e_type != ET_EXEC && header->e_type != ET_DYN) {
171
    if (header->e_type != ET_EXEC && header->e_type != ET_DYN) {
166
        printf("Object type %d is not supported\n", header->e_type);
172
        printf("Object type %d is not supported\n", header->e_type);
167
        return EE_UNSUPPORTED;
173
        return EE_UNSUPPORTED;
Line 291... Line 297...
291
            );
297
            );
292
            return EE_INVALID;
298
            return EE_INVALID;
293
        }
299
        }
294
    }
300
    }
295
 
301
 
-
 
302
    /* Final flags that will be set for the memory area */
-
 
303
 
296
    if (entry->p_flags & PF_X)
304
    if (entry->p_flags & PF_X)
297
        flags |= AS_AREA_EXEC;
305
        flags |= AS_AREA_EXEC;
298
    if (entry->p_flags & PF_W)
306
    if (entry->p_flags & PF_W)
299
        flags |= AS_AREA_WRITE;
307
        flags |= AS_AREA_WRITE;
300
    if (entry->p_flags & PF_R)
308
    if (entry->p_flags & PF_R)
301
        flags |= AS_AREA_READ;
309
        flags |= AS_AREA_READ;
302
    flags |= AS_AREA_CACHEABLE;
310
    flags |= AS_AREA_CACHEABLE;
303
 
311
 
304
    /* Final flags for the memory area */
-
 
305
    flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE;
-
 
306
 
-
 
307
    /*
312
    /*
308
     * Check if the virtual address starts on page boundary.
313
     * Check if the virtual address starts on page boundary.
309
     */
314
     */
310
    if (ALIGN_UP(entry->p_vaddr, PAGE_SIZE) != entry->p_vaddr) {
315
    if (ALIGN_UP(entry->p_vaddr, PAGE_SIZE) != entry->p_vaddr) {
311
        printf("align check 2 failed - not page-aligned\n");
316
        printf("align check 2 failed - not page-aligned\n");
Line 326... Line 331...
326
    if (a == (void *)(-1)) {
331
    if (a == (void *)(-1)) {
327
        printf("memory mapping failed\n");
332
        printf("memory mapping failed\n");
328
        return EE_MEMORY;
333
        return EE_MEMORY;
329
    }
334
    }
330
 
335
 
331
    printf("as_area_create(0x%x, 0x%x, %d) -> 0x%x\n",
336
    printf("as_area_create(0x%lx, 0x%x, %d) -> 0x%lx\n",
332
        entry->p_vaddr+bias, entry->p_memsz, flags, (unsigned)a);
337
        entry->p_vaddr+bias, entry->p_memsz, flags, (uintptr_t)a);
333
 
338
 
334
    /*
339
    /*
335
     * Load segment data
340
     * Load segment data
336
     */
341
     */
337
    printf("seek to %d\n", entry->p_offset);
342
    printf("seek to %d\n", entry->p_offset);