[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lightning] Bus error on OSX
From: |
Paolo Bonzini |
Subject: |
Re: [Lightning] Bus error on OSX |
Date: |
Mon, 28 Jun 2010 09:40:28 +0200 |
On Sun, Jun 27, 2010 at 21:20, Mathieu Suen <address@hidden> wrote:
> Hi,
>
> I tried the example from the documentation on OSX.
> But when I run it I got a "Bus error".
>
> ---
> #include <lightning.h>
> #include <stdio.h>
>
> static jit_insn codeBuffer[1024];
>
> typedef int (*pifi)(int);
>
> int main ()
> {
> pifi incr = (pifi) (jit_set_ip(codeBuffer).iptr);
> int in;
>
> jit_leaf(1); /* leaf 1 */
> in = jit_arg_i(); /* in = arg_i */
> jit_getarg_i(JIT_R0, in); /* getarg_i R0 */
> jit_addi_i(JIT_RET, JIT_R0, 1); /* addi_i RET, R0, 1 */
> jit_ret(); /* ret */
>
> jit_flush_code(codeBuffer, jit_get_ip().ptr);
>
> /* call the generated code, passing 5 as an argument */
> printf("%d + 1 = %d\n", 5, incr(5));
> return 0;
>
> }
> ---
>
> I guess I am not getting the right instruction since I have no compile error.
> So I force 32 bit compilation and it work.
>
> Is there no support for x86-64 architecture?
x86-64 definitely works under Linux. The ABI is different, so it is
possible that it has problems under Mac OS X.
Paolo