| 163 | } |
| 164 | |
| 165 | static void |
| 166 | elf_phdr(struct buffer *pinput, Elf64_Phdr *phdr, |
| 167 | int entsize, struct xdr *xdr, int bit64) |
| 168 | { |
| 169 | /* |
| 170 | * The entsize need not be sizeof(*phdr). |
| 171 | * Hence, it is easier to keep a copy of the input, |
| 172 | * as the xdr functions may not advance the input |
| 173 | * pointer the full entsize; rather than get tricky |
| 174 | * we just advance it below. |
| 175 | */ |
| 176 | struct buffer input; |
| 177 | buffer_clone(&input, pinput); |
| 178 | if (bit64){ |
| 179 | phdr->p_type = xdr->get32(&input); |
| 180 | phdr->p_flags = xdr->get32(&input); |
| 181 | phdr->p_offset = xdr->get64(&input); |
| 182 | phdr->p_vaddr = xdr->get64(&input); |
| 183 | phdr->p_paddr = xdr->get64(&input); |
| 184 | phdr->p_filesz = xdr->get64(&input); |
| 185 | phdr->p_memsz = xdr->get64(&input); |
| 186 | phdr->p_align = xdr->get64(&input); |
| 187 | } else { |
| 188 | phdr->p_type = xdr->get32(&input); |
| 189 | phdr->p_offset = xdr->get32(&input); |
| 190 | phdr->p_vaddr = xdr->get32(&input); |
| 191 | phdr->p_paddr = xdr->get32(&input); |
| 192 | phdr->p_filesz = xdr->get32(&input); |
| 193 | phdr->p_memsz = xdr->get32(&input); |
| 194 | phdr->p_flags = xdr->get32(&input); |
| 195 | phdr->p_align = xdr->get32(&input); |
| 196 | } |
| 197 | buffer_seek(pinput, entsize); |
| 198 | } |
| 199 | |
| 200 | static void |
| 201 | elf_shdr(struct buffer *pinput, Elf64_Shdr *shdr, |
no test coverage detected