From: Richard Henderson <rth@twiddle.net>
To: libffi-discuss@sourceware.org
Cc: Ulrich.Weigand@de.ibm.com, vogt@linux.vnet.ibm.com,
krebbel@linux.vnet.ibm.com, Richard Henderson <rth@redhat.com>
Subject: [PATCH 2/4] s390: Avoid aliasing warnings
Date: Thu, 18 Dec 2014 21:33:00 -0000 [thread overview]
Message-ID: <1418938403-15836-3-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1418938403-15836-1-git-send-email-rth@twiddle.net>
From: Richard Henderson <rth@redhat.com>
---
src/s390/ffi.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/s390/ffi.c b/src/s390/ffi.c
index b0c3092..c06b79e 100644
--- a/src/s390/ffi.c
+++ b/src/s390/ffi.c
@@ -762,29 +762,28 @@ ffi_prep_closure_loc (ffi_closure *closure,
void *user_data,
void *codeloc)
{
- if (cif->abi != FFI_SYSV)
- return FFI_BAD_ABI;
-
+ static unsigned short const template[] = {
+ 0x0d10, /* basr %r1,0 */
#ifndef __s390x__
- *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */
- *(short *)&closure->tramp [2] = 0x9801; /* lm %r0,%r1,6(%r1) */
- *(short *)&closure->tramp [4] = 0x1006;
- *(short *)&closure->tramp [6] = 0x07f1; /* br %r1 */
- *(long *)&closure->tramp [8] = (long)codeloc;
- *(long *)&closure->tramp[12] = (long)&ffi_closure_SYSV;
+ 0x9801, 0x1006, /* lm %r0,%r1,6(%r1) */
#else
- *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */
- *(short *)&closure->tramp [2] = 0xeb01; /* lmg %r0,%r1,14(%r1) */
- *(short *)&closure->tramp [4] = 0x100e;
- *(short *)&closure->tramp [6] = 0x0004;
- *(short *)&closure->tramp [8] = 0x07f1; /* br %r1 */
- *(long *)&closure->tramp[16] = (long)codeloc;
- *(long *)&closure->tramp[24] = (long)&ffi_closure_SYSV;
+ 0xeb01, 0x100e, 0x0004, /* lmg %r0,%r1,14(%r1) */
#endif
+ 0x07f1 /* br %r1 */
+ };
+
+ unsigned long *tramp = (unsigned long *)&closure->tramp;
+
+ if (cif->abi != FFI_SYSV)
+ return FFI_BAD_ABI;
+
+ memcpy (tramp, template, sizeof(template));
+ tramp[2] = (unsigned long)codeloc;
+ tramp[3] = (unsigned long)&ffi_closure_SYSV;
closure->cif = cif;
- closure->user_data = user_data;
closure->fun = fun;
+ closure->user_data = user_data;
return FFI_OK;
}
--
2.1.0
next prev parent reply other threads:[~2014-12-18 21:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-18 21:33 [PATCH 0/4] s390 improvements Richard Henderson
2014-12-18 21:33 ` Richard Henderson [this message]
2014-12-18 21:33 ` [PATCH 4/4] s390: Use pc-relative insns in 31-bit mode Richard Henderson
2014-12-18 21:33 ` [PATCH 1/4] s390: Kill trailing whitespace Richard Henderson
2014-12-18 21:33 ` [PATCH 3/4] s390: Reorganize assembly Richard Henderson
2014-12-22 12:12 ` Dominik Vogt
2014-12-22 12:25 ` Dominik Vogt
2014-12-22 16:30 ` Richard Henderson
2014-12-23 9:54 ` Dominik Vogt
2014-12-19 15:07 ` [PATCH 0/4] s390 improvements Ulrich Weigand
2014-12-19 15:33 ` Richard Henderson
2014-12-19 16:15 ` Ulrich Weigand
2014-12-19 16:37 ` Richard Henderson
2014-12-19 17:08 ` Ulrich Weigand
2014-12-19 16:43 ` [PATCH 5/4] s390: Inline and tidy ffi_prep_args Richard Henderson
2014-12-22 11:34 ` [PATCH 0/4] s390 improvements Dominik Vogt
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=1418938403-15836-3-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=krebbel@linux.vnet.ibm.com \
--cc=libffi-discuss@sourceware.org \
--cc=rth@redhat.com \
--cc=vogt@linux.vnet.ibm.com \
/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).