lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lightning] jit_calli requires jit_prolog


From: Paul Cercueil
Subject: [Lightning] jit_calli requires jit_prolog
Date: Mon, 18 Aug 2014 15:59:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0

Hi,

I am currently developing a simple MIPS-to-everything dynamic recompiler based on Lightning. The recompiler generates blocks of machine code that are meant to be chained: each block jumps to the following one. This is what I want to do (MIPS code):

# lightrec_emit_end_of_block:emitter.c:37
        0x77d97060      move    a0,s6
        0x77d97064      lui     t9,0x77d7
        0x77d97068      ori     t9,t9,0x2198
        0x77d9706c      jalr    t9
        0x77d97070      nop
        0x77d97074      jr      v0
        0x77d97078      nop

Basically, jump to a C function that will return the address of the next block of code (optionally compile it beforehand), then jump to the address returned.

The problem is that Lightning will segfault when generating this code, as soon as jit_calli() is executed. Apparently, jit_prolog() and jit_epilog() are required for jit_calli() to work.

However, if I add jit_prolog() and jit_epilog(), Lightning will generate some code to save/restore registers, while I don't want that. This is especially bad since the epilog will never be reached (as the code jumps to another block), so the stack pointer will decrease at each prolog but never increase.

What I would need, are either variants of jit_prolog() and jit_epilog() which don't save/restore the registers on the stack, or alternatively to have jit_calli() not require jit_prolog().

Do you have suggestions on how to fix this issue?

Thanks,

-Paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]