MCPcopy Create free account
hub / github.com/coreboot/coreboot / elf_phdr

Function elf_phdr

util/cbfstool/elfheaders.c:165–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165static void
166elf_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
200static void
201elf_shdr(struct buffer *pinput, Elf64_Shdr *shdr,

Callers 1

phdr_readFunction · 0.85

Calls 2

buffer_cloneFunction · 0.85
buffer_seekFunction · 0.85

Tested by

no test coverage detected