| 139 | } |
| 140 | |
| 141 | static void |
| 142 | elf_ehdr(struct buffer *input, Elf64_Ehdr *ehdr, struct xdr *xdr, int bit64) |
| 143 | { |
| 144 | ehdr->e_type = xdr->get16(input); |
| 145 | ehdr->e_machine = xdr->get16(input); |
| 146 | ehdr->e_version = xdr->get32(input); |
| 147 | if (bit64){ |
| 148 | ehdr->e_entry = xdr->get64(input); |
| 149 | ehdr->e_phoff = xdr->get64(input); |
| 150 | ehdr->e_shoff = xdr->get64(input); |
| 151 | } else { |
| 152 | ehdr->e_entry = xdr->get32(input); |
| 153 | ehdr->e_phoff = xdr->get32(input); |
| 154 | ehdr->e_shoff = xdr->get32(input); |
| 155 | } |
| 156 | ehdr->e_flags = xdr->get32(input); |
| 157 | ehdr->e_ehsize = xdr->get16(input); |
| 158 | ehdr->e_phentsize = xdr->get16(input); |
| 159 | ehdr->e_phnum = xdr->get16(input); |
| 160 | ehdr->e_shentsize = xdr->get16(input); |
| 161 | ehdr->e_shnum = xdr->get16(input); |
| 162 | ehdr->e_shstrndx = xdr->get16(input); |
| 163 | } |
| 164 | |
| 165 | static void |
| 166 | elf_phdr(struct buffer *pinput, Elf64_Phdr *phdr, |