X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=ginge.git;a=blobdiff_plain;f=loader%2Femu.c;h=8234a1462def19c9061be3705b1cd2b93d63febf;hp=6ddbb4ada0f9d9c47e0362afe40ea6fbe9ff3495;hb=6c888740e36d8ec83c68f35c5f14b8f698db7a2b;hpb=8cbb027881eadc228c7a0613b7afb6c566bf86fe;ds=sidebyside diff --git a/loader/emu.c b/loader/emu.c index 6ddbb4a..8234a14 100644 --- a/loader/emu.c +++ b/loader/emu.c @@ -916,13 +916,18 @@ static void init_linkpage(void) static void segv_sigaction(int num, siginfo_t *info, void *ctx) { + extern char _init, _end; struct ucontext *context = ctx; u32 *regs = (u32 *)&context->uc_mcontext.arm_r0; u32 *pc = (u32 *)regs[15]; + u32 self_start, self_end; struct op_context *op_ctx; int i, lp_size; - if (((regs[15] ^ (u32)&segv_sigaction) & 0xff000000) == 0 || // PC is in our segment or + self_start = (u32)&_init & ~0xfff; + self_end = (u32)&_end; + + if ((self_start <= regs[15] && regs[15] <= self_end) || // PC is in our segment or (((regs[15] ^ (u32)g_linkpage) & ~(LINKPAGE_ALLOC - 1)) == 0) || // .. in linkpage ((long)info->si_addr & 0xffe00000) != 0x7f000000) // faulting not where expected {