Skip to content

Commit

Permalink
Move copying of trampoline body outside of ifdef
Browse files Browse the repository at this point in the history
  • Loading branch information
hmelder committed Nov 18, 2024
1 parent 1c3b57c commit f8cfa46
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions block_to_imp.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,14 @@ static struct trampoline_set *alloc_trampolines(char *start, char *end)
headers_start[i].block = &headers_start[i+1].block;
uint8_t *block = rx_buffer_start + (i * sizeof(struct block_header));

#if defined(__ARM_ARCH_ISA_A64)
memcpy(block, start, end-start);
#if defined(__ARM_ARCH_ISA_A64)
// Fix-up the trampoline with the address to its block header.
// We reserved 8 bytes after the branch for the block header address.
// See block_trampolines.S for more information.
uintptr_t ptr = (uintptr_t)&headers_start[i];
memcpy(block, start, end-start);
memcpy(block + (end-start) -8, &ptr, 8);
#endif
#endif
}
headers_start[trampoline_header_per_page-1].block = NULL;
mprotect(rx_buffer_start, trampoline_page_size, PROT_READ | PROT_EXEC);
Expand Down

0 comments on commit f8cfa46

Please sign in to comment.