168 dboot_printf("copying %ld bytes from ELF offset 0x%lx "
169 "to physaddr 0x%lx (va=0x%lx)\n",
170 (ulong_t)phdr->p_filesz, (ulong_t)phdr->p_offset,
171 (ulong_t)dst, (ulong_t)phdr->p_vaddr);
172 (void) memcpy((void *)(uintptr_t)dst,
173 (void *)(uintptr_t)src, (size_t)phdr->p_filesz);
174
175 next_addr = dst + phdr->p_filesz;
176 }
177
178
179 /*
180 * Next look for bss
181 */
182 for (i = 0; i < eh->e_shnum; i++) {
183 shdr = (Elf64_Shdr *)(sechdrs + eh->e_shentsize * i);
184
185 /* zero out bss */
186 if (shdr->sh_type == SHT_NOBITS) {
187 if (prom_debug)
188 dboot_printf("zeroing BSS %ld bytes from "
189 "physaddr 0x%" PRIx64
190 " (end=0x%" PRIx64 ")\n",
191 (ulong_t)shdr->sh_size,
192 next_addr,
193 next_addr + shdr->sh_size);
194 (void) memset((void *)(uintptr_t)next_addr, 0,
195 shdr->sh_size);
196 break;
197 }
198 }
199
200 /*
201 * Ignore the intepreter (or should we die if there is one??)
202 */
203 return (0);
204 }
|
168 dboot_printf("copying %ld bytes from ELF offset 0x%lx "
169 "to physaddr 0x%lx (va=0x%lx)\n",
170 (ulong_t)phdr->p_filesz, (ulong_t)phdr->p_offset,
171 (ulong_t)dst, (ulong_t)phdr->p_vaddr);
172 (void) memcpy((void *)(uintptr_t)dst,
173 (void *)(uintptr_t)src, (size_t)phdr->p_filesz);
174
175 next_addr = dst + phdr->p_filesz;
176 }
177
178
179 /*
180 * Next look for bss
181 */
182 for (i = 0; i < eh->e_shnum; i++) {
183 shdr = (Elf64_Shdr *)(sechdrs + eh->e_shentsize * i);
184
185 /* zero out bss */
186 if (shdr->sh_type == SHT_NOBITS) {
187 if (prom_debug)
188 dboot_printf("zeroing BSS %lu bytes from "
189 "physaddr 0x%" PRIx64
190 " (end=0x%" PRIx64 ")\n",
191 (ulong_t)shdr->sh_size,
192 next_addr,
193 next_addr + shdr->sh_size);
194 (void) memset((void *)(uintptr_t)next_addr, 0,
195 shdr->sh_size);
196 break;
197 }
198 }
199
200 /*
201 * Ignore the intepreter (or should we die if there is one??)
202 */
203 return (0);
204 }
|