From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yb4B9-0004wU-La for qemu-devel@nongnu.org; Thu, 26 Mar 2015 05:34:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yb4B6-00036d-UZ for qemu-devel@nongnu.org; Thu, 26 Mar 2015 05:34:19 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:64962 helo=imgpgp01.kl.imgtec.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yb4B6-00036Y-IU for qemu-devel@nongnu.org; Thu, 26 Mar 2015 05:34:16 -0400 Message-ID: <5513D296.8060709@imgtec.com> Date: Thu, 26 Mar 2015 09:34:14 +0000 From: James Hogan MIME-Version: 1.0 References: <8111192.6dZICC2BlA@lczc1207b1zdcs> <1842470.gfsf2eU3Vx@lczc1207b1zdcs> <5512F187.1080108@imgtec.com> <2216707.mRbZzWlcAX@lczc1207b1zdcs> <5513D17A.20807@imgtec.com> In-Reply-To: <5513D17A.20807@imgtec.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aXmfj3Q0j5iBDo4vi1eKdrCorILpVmNb1" Subject: Re: [Qemu-devel] Support for NetLogic XLP Processors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leon Alrae , Duarte Silva Cc: qemu-devel@nongnu.org --aXmfj3Q0j5iBDo4vi1eKdrCorILpVmNb1 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 26/03/15 09:29, Leon Alrae wrote: > Hi Duarte, >=20 > On 25/03/2015 23:54, Duarte Silva wrote: >> On Wednesday 25 March 2015 17:33:59 Leon Alrae wrote: >>> On 25/03/2015 15:38, Duarte Silva wrote: >>>> On Wednesday 25 March 2015 14:54:41 Leon Alrae wrote: >>>>> On 25/03/2015 14:44, Leon Alrae wrote: >>>>>> Hi Duarte, >>>>>> >>>>>> On 25/03/2015 14:20, Duarte Silva wrote: >>>>>>> On Wednesday 25 March 2015 13:13:14 James Hogan wrote: >>>>>>>> Hi Duarte, >>>>>>>> >>>>>>>> On 22/03/15 11:13, Duarte Silva wrote: >>>>>>>>> Hi guys, >>>>>>>>> >>>>>>>>> I have been struggling to get some binaries compiled for NetLog= ic XLP >>>>>>>>> processor to run under QEMU. I have tried a bunch of things (mo= st >>>>>>>>> going >>>>>>>>> back and forth) and always get the following error message: >>>>>>>>> >>>>>>>>> qemu: uncaught target signal 4 (Illegal instruction) - core dum= ped >>>>>>>>> Illegal instruction >>>>>>>>> >>>>>>>>> I tried to debug it using GDB but to no avail. Does anybody hav= e >>>>>>>>> ideas? >>>>>>>>> I'm >>>>>>>>> running QEMU 2.2.1. >>>>>>>> >>>>>>>> It sounds like the program had an instruction that QEMU doesn't >>>>>>>> recognise, or doesn't think should be allowed on the current CPU= which >>>>>>>> you've set with -cpu. You might be able to find out what that >>>>>>>> >>>>>>>> instruction is by putting this on your qemu command line: >>>>>>>> -singlestep -d in_asm >>>>>>> >>>>>>> Hi James, >>>>>>> >>>>>>> thanks for the help :) I have tried with all the CPU's available.= None >>>>>>> of >>>>>>> them worked, so I just leave it as undefined. It seems the offend= ing >>>>>>> instruction is "udi4". >>>>>>> >>>>>>> (...) >>>>>>> IN: >>>>>>> 0x765d1fa4: udi4 a0,v0,zero,0x0 >>>>>> >>>>>> According to this line you are trying to use MIPS32 CPU whereas I >>>>>> presume you would like MIPS64R2? Please try 5KEf CPU for example w= hich >>>>>> is available in qemu-mips64 and qemu-mips64el QEMU binaries for bi= g and >>>>>> little endian respectively. >>>>> >>>>> I just noticed the QEMU version you are using and it doesn't contai= n >>>>> 5KEf and 5KEc CPUs. Please try MIPS64R2-generic. >>>>> >>>>> Leon >>>> >>>> Hi Leon, >>>> >>>> have a look at the "binary-info.txt" file in the first e-Mail. It do= es use >>>> the ELF magic for 32 bits ELF, not the 64 bits, that's why I get the= >>>> following: >>>> >>>> # chroot rootfs/ /usr/local/bin/qemu-mips64 -cpu MIPS64R2-generic /b= in/sh >>>> /bin/sh: Invalid ELF image for this architecture >>>> >>>> Is there a way to force the execution of the binary even if the flag= >>>> doesn't match? >>>> >>>> Also, if you have a look at the flags you get: noreorder, cpic, 32bi= tmode, >>>> unknown CPU, o32, mips64r2. So, is it 64 bits or 32 bits ELF file? >>> >>> I see, this mips64r2 binary has o32 ABI. It indeed would work in >>> qemu-mips provided there are no mips64r2-specific instructions. I thi= nk >>> I jumped a bit too quickly to the conclusion. >>> >>> QEMU's mips/disas doesn't help much in this case as it just indicates= >>> User Defined Instruction. Presumably this instruction is specific to >>> this processor and is missing in QEMU. Are you able to get disassembl= y >>> of your program and look up what is under 0x765d1fa4 address which >>> caused the illegal instruction? >> >> Hi Leon, >> >> using IDA with a remote debug session to QEMU I got the following dis= assembly=20 >> (kept surrounding instructions to give some context). To IDA, this cus= tom=20 >> instruction is also unknown. >> >> MEMORY:765D1F90 sw $v1, 4($v0) >> MEMORY:765D1F94 addu $a0, $a1 >> MEMORY:765D1F98 sw $a0, 0($v0) >> MEMORY:765D1F9C >> MEMORY:765D1F9C loc_765D1F9C: >> MEMORY:765D1F9C addiu $a0, $s1, 0x51B0 >> MEMORY:765D1FA0 move $v0, $zero >> MEMORY:765D1FA0 # ----------------------- >> MEMORY:765D1FA4 .byte 0x70 # p >> MEMORY:765D1FA5 .byte 0x82 # =C3=A9 >> MEMORY:765D1FA6 .byte 0 >> MEMORY:765D1FA7 .byte 0x14 >> MEMORY:765D1FA8 # ----------------------- >> MEMORY:765D1FA8 slti $v0, 2 >> MEMORY:765D1FAC beqz $v0, loc_765D204C >> MEMORY:765D1FB0 nop >> MEMORY:765D1FB4 lw $ra, 0x24($sp) >> MEMORY:765D1FB8 >> MEMORY:765D1FB8 loc_765D1FB8: >> MEMORY:765D1FB8 move $v0, $s0 >> MEMORY:765D1FBC lw $s1, 0x20($sp) >> MEMORY:765D1FC0 lw $s0, 0x1C($sp) >=20 > According to binutils this is SWAPW which belongs to XLR: > {"swapw", "t,b", 0x70000014, 0xfc00ffff, > MOD_1|RD_2|LM|SM, 0, XLR, 0, 0 }, >=20 > I'm afraid you won't be able to run binaries built for NetLogic XLP > until someone implements these instructions in QEMU. Thanks Leon, you just beat me to it with that :-) For reference, you can disassemble xlp specific code with objdump using "-m mips:xlp": $ cat test.S =2Etext =2Eword 0x70820014 $ mips-linux-gnu-gcc -o test.o -c test.S $ mips-linux-gnu-objdump -d test.o -m mips:xlp test.o: file format elf32-tradbigmips Disassembly of section .text: 00000000 <.text>: 0: 70820014 swapw v0,a0 ... Cheers James --aXmfj3Q0j5iBDo4vi1eKdrCorILpVmNb1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVE9KWAAoJEGwLaZPeOHZ6vREQAJ5YMgZuAyVUNeqLSinFmvNY mxVbzLGwAz6mP+ALim64mqEWS9awvHtmk5aHbxjGUuCU0IzHyrC2XME71LwzBeU4 1okpBGY6kLFBVrhHH4s2p+nDNdCjc+KyQoWB0T/2m2lXA9GfFzuS0GFcbSvH5wBG gnIvJBzGU/lzeodvYRFdcbfRFiOSguqJVcZz72fM4UXgr+AJYO5ISOVAixz1ZN32 LMhekItJoK8xRm+ufedhpPmwlzG9FG1IlduU+mmd+uln0fPkrCTV8kmp2lRzwNXq EYBM4DEscPCTVg2DjndpRxbYGgthpTWxQXfy7d7A4aUbXcSpi1QZKqqjNnRfZIzU eUG7Zj/JlgQAHc4Jon2R6CgzHfa6atAuLFjN614AZ+xy8MocKmEKAcFOliHtts85 pGlck/RFDRkTDlbBt9bHA28VjlPT49TOSPtZeUmGFUJ3V6FGFqE4fvWmlYnqgDwF oQ3Zz+ma7m3Eb8VrU+1BEDhHdhcVVEy5adIEWHpT3AXY6IekJiXl7ukjdWwA5cQ+ kt7CKETGWNJYFrTAjxsEZR63lK1KboU253/C133F5inBISw2FkaT+KEo+bKhRMlm KA68WX6IU6XEc2I05vaiA9ZifXT1nwz7PXyjEHiwqIUoTDeNqX+uuWa7nACuNwHg D6JsYDX1vn2c8aDTAdGD =j2zC -----END PGP SIGNATURE----- --aXmfj3Q0j5iBDo4vi1eKdrCorILpVmNb1--