diff options
author | Russell King <rmk@arm.linux.org.uk> | 2016-03-14 22:29:08 +0000 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2018-03-20 14:58:05 +0000 |
commit | 7c78356e8f45ded79ceb9625e4990f61298113ba (patch) | |
tree | 5df6b4b1c1e39431892b716916711c77544d7c9e /kdump/kdump.c | |
parent | f57f0bf8975d24fe1e7c4936fdfb5c3b123ab75f (diff) |
remaining TI changesti-keystone2
Diffstat (limited to 'kdump/kdump.c')
-rw-r--r-- | kdump/kdump.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/kdump/kdump.c b/kdump/kdump.c index de46d28..e7a0252 100644 --- a/kdump/kdump.c +++ b/kdump/kdump.c @@ -74,7 +74,7 @@ static void *xmalloc(size_t size) } static void *collect_notes( - int fd, Elf64_Ehdr *ehdr, Elf64_Phdr *phdr, size_t *note_bytes) + int fd, Elf32_Ehdr *ehdr, Elf32_Phdr *phdr, size_t *note_bytes) { int i; size_t bytes, result_bytes; @@ -94,7 +94,7 @@ static void *collect_notes( /* Walk through and capture the notes */ for(i = 0; i < ehdr->e_phnum; i++) { - Elf64_Nhdr *hdr, *lhdr, *nhdr; + Elf32_Nhdr *hdr, *lhdr, *nhdr; void *pnotes; if (phdr[i].p_type != PT_NOTE) { continue; @@ -105,8 +105,8 @@ static void *collect_notes( unmap_addr(pnotes, phdr[i].p_filesz); /* Walk through the new notes and find the real length */ - hdr = (Elf64_Nhdr *)(notes + result_bytes); - lhdr = (Elf64_Nhdr *)(notes + result_bytes + phdr[i].p_filesz); + hdr = (Elf32_Nhdr *)(notes + result_bytes); + lhdr = (Elf32_Nhdr *)(notes + result_bytes + phdr[i].p_filesz); for(; hdr < lhdr; hdr = nhdr) { size_t hdr_size; /* If there is not a name this is a invalid/reserved note @@ -120,7 +120,7 @@ static void *collect_notes( ((hdr->n_namesz + 3) & ~3) + ((hdr->n_descsz + 3) & ~3); - nhdr = (Elf64_Nhdr *)(((char *)hdr) + hdr_size); + nhdr = (Elf32_Nhdr *)(((char *)hdr) + hdr_size); /* if the note does not fit in the segment stop here */ if (nhdr > lhdr) { break; @@ -134,13 +134,13 @@ static void *collect_notes( } static void *generate_new_headers( - Elf64_Ehdr *ehdr, Elf64_Phdr *phdr, size_t note_bytes, size_t *header_bytes) + Elf32_Ehdr *ehdr, Elf32_Phdr *phdr, size_t note_bytes, size_t *header_bytes) { unsigned phnum; size_t bytes; char *headers; - Elf64_Ehdr *nehdr; - Elf64_Phdr *nphdr; + Elf32_Ehdr *nehdr; + Elf32_Phdr *nphdr; unsigned long long offset; int i; /* Count the number of program headers. @@ -161,8 +161,8 @@ static void *generate_new_headers( headers = xmalloc(bytes); /* Setup pointers to the new headers */ - nehdr = (Elf64_Ehdr *)headers; - nphdr = (Elf64_Phdr *)(headers + sizeof(*nehdr)); + nehdr = (Elf32_Ehdr *)headers; + nphdr = (Elf32_Phdr *)(headers + sizeof(*nehdr)); /* Copy and adjust the Elf header */ memcpy(nehdr, ehdr, sizeof(*nehdr)); @@ -227,8 +227,8 @@ int main(int argc, char **argv) { char *start_addr_str, *end; unsigned long long start_addr; - Elf64_Ehdr *ehdr; - Elf64_Phdr *phdr; + Elf32_Ehdr *ehdr; + Elf32_Phdr *phdr; void *notes, *headers; size_t note_bytes, header_bytes; int fd; @@ -270,13 +270,13 @@ int main(int argc, char **argv) (ehdr->e_ident[EI_MAG1] != ELFMAG1) || (ehdr->e_ident[EI_MAG2] != ELFMAG2) || (ehdr->e_ident[EI_MAG3] != ELFMAG3) || - (ehdr->e_ident[EI_CLASS] != ELFCLASS64) || + (ehdr->e_ident[EI_CLASS] != ELFCLASS32) || (ehdr->e_ident[EI_DATA] != ELFDATALOCAL) || (ehdr->e_ident[EI_VERSION] != EV_CURRENT) || (ehdr->e_type != ET_CORE) || (ehdr->e_version != EV_CURRENT) || - (ehdr->e_ehsize != sizeof(Elf64_Ehdr)) || - (ehdr->e_phentsize != sizeof(Elf64_Phdr)) || + (ehdr->e_ehsize != sizeof(Elf32_Ehdr)) || + (ehdr->e_phentsize != sizeof(Elf32_Phdr)) || (ehdr->e_phnum == 0)) { fprintf(stderr, "Invalid Elf header\n"); |