Changeset View
Changeset View
Standalone View
Standalone View
stand/common/load_elf.c
| Show First 20 Lines • Show All 743 Lines • ▼ Show 20 Lines | #ifdef ELF_VERBOSE | ||||
| case SHT_STRTAB: /* String table */ | case SHT_STRTAB: /* String table */ | ||||
| secname = "strtab"; | secname = "strtab"; | ||||
| break; | break; | ||||
| default: | default: | ||||
| secname = "WHOA!!"; | secname = "WHOA!!"; | ||||
| break; | break; | ||||
| } | } | ||||
| #endif | #endif | ||||
| size = shdr[i].sh_size; | size = shdr[i].sh_size; | ||||
| #if defined(__powerpc__) | |||||
| #if __ELF_WORD_SIZE == 64 | |||||
| size = htobe64(size); | |||||
| #else | |||||
| size = htobe32(size); | |||||
| #endif | |||||
| #endif | |||||
jhibbits: Isn't this a NOP? htobe() on BIG_ENDIAN is a NOP. | |||||
Done Inline ActionsYes, I hadn't realized that. This part was causing the kernel to crash at boot on PPC64LE, so I supposed it should be a BE specific stuff. After some digging, it seems it was added by D12421 and D12422, when booting on POWER8 was done with kboot running in LE and the kernel running in BE. The option to compile stand and kboot in LE was later removed with D26430. As this is not the case anymore and the kernel may also be compiled in LE for PowerPC, this should be removed. luporl: Yes, I hadn't realized that. This part was causing the kernel to crash at boot on PPC64LE, so I… | |||||
| archsw.arch_copyin(&size, lastaddr, sizeof(size)); | archsw.arch_copyin(&size, lastaddr, sizeof(size)); | ||||
| lastaddr += sizeof(size); | lastaddr += sizeof(size); | ||||
| #ifdef ELF_VERBOSE | #ifdef ELF_VERBOSE | ||||
| printf("\n%s: 0x%jx@0x%jx -> 0x%jx-0x%jx", secname, | printf("\n%s: 0x%jx@0x%jx -> 0x%jx-0x%jx", secname, | ||||
| (uintmax_t)shdr[i].sh_size, (uintmax_t)shdr[i].sh_offset, | (uintmax_t)shdr[i].sh_size, (uintmax_t)shdr[i].sh_offset, | ||||
| (uintmax_t)lastaddr, | (uintmax_t)lastaddr, | ||||
| (uintmax_t)(lastaddr + shdr[i].sh_size)); | (uintmax_t)(lastaddr + shdr[i].sh_size)); | ||||
| Show All 26 Lines | #endif | ||||
| if (i == symtabindex) | if (i == symtabindex) | ||||
| symtabindex = -1; | symtabindex = -1; | ||||
| else if (i == symstrindex) | else if (i == symstrindex) | ||||
| symstrindex = -1; | symstrindex = -1; | ||||
| } | } | ||||
| esym = lastaddr; | esym = lastaddr; | ||||
| #ifndef ELF_VERBOSE | #ifndef ELF_VERBOSE | ||||
| printf("]"); | printf("]"); | ||||
| #endif | |||||
| #if defined(__powerpc__) | |||||
| /* On PowerPC we always need to provide BE data to the kernel */ | |||||
| #if __ELF_WORD_SIZE == 64 | |||||
| ssym = htobe64((uint64_t)ssym); | |||||
| esym = htobe64((uint64_t)esym); | |||||
| #else | |||||
| ssym = htobe32((uint32_t)ssym); | |||||
| esym = htobe32((uint32_t)esym); | |||||
| #endif | |||||
| #endif | #endif | ||||
| file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), &ssym); | file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), &ssym); | ||||
Done Inline ActionsSame here jhibbits: Same here | |||||
| file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), &esym); | file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), &esym); | ||||
| nosyms: | nosyms: | ||||
| printf("\n"); | printf("\n"); | ||||
| ret = lastaddr - firstaddr; | ret = lastaddr - firstaddr; | ||||
| fp->f_addr = firstaddr; | fp->f_addr = firstaddr; | ||||
| ▲ Show 20 Lines • Show All 518 Lines • Show Last 20 Lines | |||||
Isn't this a NOP? htobe() on BIG_ENDIAN is a NOP.