On 14 April 2017 at 08:31, Zhangwen (Esan) <[email protected]> wrote: > Hi, > When I run a binary with qemu-2.7.1, I found it report a error: > Program received signal SIGILL, Illegal instruction. > Then I gdb it, the scene is as follows: > (gdb) si > > Program received signal SIGILL, Illegal instruction. > _start () at ../newlib-2.2.0/libgloss/mips/crt0.S:92 > 92 nop > (gdb) disass > Dump of assembler code for function _start: > => 0x00000040 <+0>: mtc0 zero,c0_cause > 0x00000044 <+4>: nop > > The binary is compiled with newlib-2.2.0, but it works with glibc-2.20. > "mtc0" instruction can not be recognized by qemu-2.7.1 or any others? > So I have no idea what happened and could anybody explain the reason?
Are you running a single binary under qemu's user emulation, or an entire MIPS kernel in qemu's system emulation and some binary inside that, or are you running this as a bare-metal binary in system emulation? If you're just running a single binary with usermode emulation, I think this is expected -- c0_cause is a system register which can only be accessed if you're the kernel, and qemu's usermode emulation runs the guest code as a user process, so SIGILL is the correct response. thanks -- PMM
