From: Andrew Bennett <Andrew.Bennett@imgtec.com>
To: "libffi-discuss@sourceware.org" <libffi-discuss@sourceware.org>
Subject: [PATCH] MIPS: Use correct encoding of jr for MIPS R6
Date: Fri, 28 Aug 2015 12:54:00 -0000 [thread overview]
Message-ID: <0DA23CC379F5F945ACB41CF394B9827721113423@LEMAIL01.le.imgtec.org> (raw)
Hi,
The trampoline code in the ffi_prep_closure_loc function in src/mips/ffi.c
uses the wrong encoding of the jr instruction for MIPS R6. This patch fixes
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] = 0x3c0c0000 | ((unsigned)codeloc >> 16);
/* jr $25 */
+#if __mips_isa_rev < 6
tramp[3] = 0x03200008;
+#else
+ tramp[3] = 0x03200009;
+#endif
/* ori $12,low(codeloc) */
tramp[4] = 0x358c0000 | ((unsigned)codeloc & 0xffff);
#else
@@ -726,7 +730,11 @@ ffi_prep_closure_loc (ffi_closure *closure,
/* ori $25,low(fn) */
tramp[10] = 0x37390000 | ((unsigned long)fn & 0xffff);
/* jr $25 */
+#if __mips_isa_rev < 6
tramp[11] = 0x03200008;
+#else
+ tramp[11] = 0x03200009;
+#endif
/* ori $12,low(codeloc) */
tramp[12] = 0x358c0000 | ((unsigned long)codeloc & 0xffff);
reply other threads:[~2015-08-28 12:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0DA23CC379F5F945ACB41CF394B9827721113423@LEMAIL01.le.imgtec.org \
--to=andrew.bennett@imgtec.com \
--cc=libffi-discuss@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).