Changeset 874a0e8 in mainline
- Timestamp:
- 2008-08-14T20:09:11Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cebab351
- Parents:
- 6808614
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/loader/elf_load.c
r6808614 r874a0e8 72 72 static int load_segment(elf_ld_t *elf, elf_segment_header_t *entry); 73 73 74 /** Read until the buffer is read in its entirety. */ 75 static int my_read(int fd, char *buf, size_t len) 76 { 77 int cnt = 0; 78 do { 79 buf += cnt; 80 len -= cnt; 81 cnt = read(fd, buf, len); 82 } while ((cnt > 0) && ((len - cnt) > 0)); 83 84 return cnt; 85 } 86 74 87 /** Load ELF binary from a file. 75 88 * … … 157 170 int i, rc; 158 171 159 rc = read(elf->fd, header, sizeof(elf_header_t));172 rc = my_read(elf->fd, header, sizeof(elf_header_t)); 160 173 if (rc < 0) { 161 174 printf("read error\n"); … … 224 237 + i * sizeof(elf_segment_header_t), SEEK_SET); 225 238 226 rc = read(elf->fd, &segment_hdr, sizeof(elf_segment_header_t)); 239 rc = my_read(elf->fd, &segment_hdr, 240 sizeof(elf_segment_header_t)); 227 241 if (rc < 0) { 228 242 printf("read error\n"); … … 245 259 + i * sizeof(elf_section_header_t), SEEK_SET); 246 260 247 rc = read(elf->fd, §ion_hdr, sizeof(elf_section_header_t)); 261 rc = my_read(elf->fd, §ion_hdr, 262 sizeof(elf_section_header_t)); 248 263 if (rc < 0) { 249 264 printf("read error\n"); … … 362 377 * and writeable. 363 378 */ 364 a = as_area_create((uint8_t *)base + bias, 365 mem_sz,AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);379 a = as_area_create((uint8_t *)base + bias, mem_sz, 380 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 366 381 if (a == (void *)(-1)) { 367 382 printf("memory mapping failed\n"); … … 399 414 400 415 // printf("read %d...", now); 401 rc = read(elf->fd, dp, now);416 rc = my_read(elf->fd, dp, now); 402 417 // printf("->%d\n", rc); 403 418
Note:
See TracChangeset
for help on using the changeset viewer.