From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129652 invoked by alias); 28 Aug 2015 12:54:34 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 129642 invoked by uid 89); 28 Aug 2015 12:54:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Aug 2015 12:54:32 +0000 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 4D599EB6D8C79 for ; Fri, 28 Aug 2015 13:54:27 +0100 (IST) Received: from LEMAIL01.le.imgtec.org (192.168.152.62) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 28 Aug 2015 13:54:29 +0100 Received: from LEMAIL01.le.imgtec.org ([fe80::5ae:ee16:f4b9:cda9]) by LEMAIL01.le.imgtec.org ([fe80::5ae:ee16:f4b9:cda9%17]) with mapi id 14.03.0210.002; Fri, 28 Aug 2015 13:54:29 +0100 From: Andrew Bennett To: "libffi-discuss@sourceware.org" Subject: [PATCH] MIPS: Use correct encoding of jr for MIPS R6 Date: Fri, 28 Aug 2015 12:54:00 -0000 Message-ID: <0DA23CC379F5F945ACB41CF394B9827721113423@LEMAIL01.le.imgtec.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2015/txt/msg00082.txt.bz2 Hi, The trampoline code in the ffi_prep_closure_loc function in src/mips/ffi.c= =20 uses the wrong encoding of the jr instruction for MIPS R6. This patch fixe= s=20 the issue by adding (via an #if) the MIPS R6 encoding. The ChangeLog and patch are below. Regards, Andrew * src/mips/ffi.c (ffi_prep_closure_loc): Add correct encoding of jr for MIPS R6. diff --git a/src/mips/ffi.c b/src/mips/ffi.c index 5d0dd70..8574a3a 100644 --- a/src/mips/ffi.c +++ b/src/mips/ffi.c @@ -698,7 +698,11 @@ ffi_prep_closure_loc (ffi_closure *closure, /* lui $12,high(codeloc) */ tramp[2] =3D 0x3c0c0000 | ((unsigned)codeloc >> 16); /* jr $25 */ +#if __mips_isa_rev < 6 tramp[3] =3D 0x03200008; +#else + tramp[3] =3D 0x03200009; +#endif /* ori $12,low(codeloc) */ tramp[4] =3D 0x358c0000 | ((unsigned)codeloc & 0xffff); #else @@ -726,7 +730,11 @@ ffi_prep_closure_loc (ffi_closure *closure, /* ori $25,low(fn) */ tramp[10] =3D 0x37390000 | ((unsigned long)fn & 0xffff); /* jr $25 */ +#if __mips_isa_rev < 6 tramp[11] =3D 0x03200008; +#else + tramp[11] =3D 0x03200009; +#endif /* ori $12,low(codeloc) */ tramp[12] =3D 0x358c0000 | ((unsigned long)codeloc & 0xffff);