void-packages/srcpkgs/uftrace/patches/i686.patch

45 lines
1.5 KiB
Diff

--- arch/i386/mcount-dynamic.c.orig
+++ arch/i386/mcount-dynamic.c
@@ -22,11 +22,11 @@
size_t trampoline_size = 16;
/* find unused 16-byte at the end of the code segment */
- mdi->trampoline = ALIGN(mdi->addr + mdi->size, PAGE_SIZE) - trampoline_size;
+ mdi->trampoline = ALIGN(mdi->text_addr + mdi->text_size, PAGE_SIZE) - trampoline_size;
- if (unlikely(mdi->trampoline < mdi->addr + mdi->size)) {
+ if (unlikely(mdi->trampoline < mdi->text_addr + mdi->text_size)) {
mdi->trampoline += trampoline_size;
- mdi->size += PAGE_SIZE;
+ mdi->text_size += PAGE_SIZE;
pr_dbg2("adding a page for fentry trampoline at %#lx\n",
mdi->trampoline);
@@ -35,7 +35,7 @@
MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
}
- if (mprotect((void *)mdi->addr, mdi->size, PROT_READ | PROT_WRITE)) {
+ if (mprotect((void *)mdi->text_addr, mdi->text_size, PROT_READ | PROT_WRITE)) {
pr_dbg("cannot setup trampoline due to protection: %m\n");
return -1;
}
@@ -49,7 +49,7 @@
void mcount_cleanup_trampoline(struct mcount_dynamic_info *mdi)
{
- if (mprotect((void *)mdi->addr, mdi->size, PROT_EXEC))
+ if (mprotect((void *)mdi->text_addr, mdi->text_size, PROT_EXEC))
pr_err("cannot restore trampoline due to protection");
}
@@ -58,7 +58,7 @@
static unsigned long get_target_addr(struct mcount_dynamic_info *mdi, unsigned long addr)
{
while (mdi) {
- if (mdi->addr <= addr && addr < mdi->addr + mdi->size)
+ if (mdi->text_addr <= addr && addr < mdi->text_addr + mdi->text_size)
return mdi->trampoline - (addr + CALL_INSN_SIZE);
mdi = mdi->next;