Skip to contentSkip to conversation

a strange segmentation fault

Qemu-devel Heng Yin 2 participants 3 messages Dec 6, 2006

lore
Share & tools
lore

Heng Yin

author
#0 lore raw

Hi QEMU developers,

I'm running into a strange problem when I add some my own stuff in QEMU.
If I add a function call in the following position, QEMU will crash immediately after execution.

In target-i386/op.c:
void OPPROTO op_jnz_T0_label(void)

{
    helper_test(T0); //my own function
    if (T0)
        GOTO_LABEL_PARAM(1);
    FORCE_RET();
}

I define this function in target-i386/helper.c:

int helper_test(int t0)

{
    return 100+t0;
}

I try it on the two versions: 0.8.2 and 0.8.0. The problem appears no matter what kqemu option (-kernel-kqemu -no-kqmeu, or none) is used and what guest os (linux or winxp) is to launch.

I got the following message from gdb:

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1212991808 (LWP 28612)] 0x00000001 in ?? ()
(gdb) bt
#0 0x00000001 in ?? ()
#1 0x080bac6c in cpu_x86_exec (env1=0x40)

    at /home/hyin/qemu-0.8.2/cpu-exec.c:772
#2  0x08050a62 in main_loop () at /home/hyin/qemu-0.8.2/vl.c:5069
#3  0x08051fe2 in main (argc=3324, argv=0x8)
    at /home/hyin/qemu-0.8.2/vl.c:6221

(gdb)

Interestingly, if I change the function helper_test to take no arguments, the fault will be gone.

Can anybody give any hints of what may cause this fault and how to solve it?

Thanks,
Heng

#1 lore raw
Quoted 4 lines
     helper_test(T0); //my own function
     if (T0)
         GOTO_LABEL_PARAM(1);
     FORCE_RET();

ops that use GOTO_LABEL_PARM or EXIT_TB must not have a stack frame.

Paul

author
#2 lore raw

Paul,

Thank you! I didn't know it, as nobody told me. :)

Heng

Quoted 14 lines · Paul Brook
Quoted 4 lines
     helper_test(T0); //my own function
     if (T0)
         GOTO_LABEL_PARAM(1);
     FORCE_RET();

ops that use GOTO_LABEL_PARM or EXIT_TB must not have a stack frame.

Paul

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel