From: Ilya Leoshkevich <iii@linux.ibm.com>
To: libc-alpha@sourceware.org
Cc: stli@linux.ibm.com, Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH 03/12] S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_resolve
Date: Thu, 02 Aug 2018 07:58:00 -0000 [thread overview]
Message-ID: <20180802075735.3457-4-iii@linux.ibm.com> (raw)
In-Reply-To: <20180802075735.3457-1-iii@linux.ibm.com>
Maintainability improvement.
* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
Use symbolic offsets for stack variables.
---
sysdeps/s390/s390-64/dl-trampoline.h | 124 ++++++++++++++++++---------
1 file changed, 83 insertions(+), 41 deletions(-)
diff --git a/sysdeps/s390/s390-64/dl-trampoline.h b/sysdeps/s390/s390-64/dl-trampoline.h
index d313fd521d..0a74694fad 100644
--- a/sysdeps/s390/s390-64/dl-trampoline.h
+++ b/sysdeps/s390/s390-64/dl-trampoline.h
@@ -37,47 +37,71 @@
* v16 - v31 : call clobbered
*/
+#define CFA_OFF 160
+#define FRAME_OFF CFA_OFF + FRAME_SIZE
+#define V24_OFF -288
+#define V25_OFF -272
+#define V26_OFF -256
+#define V27_OFF -240
+#define V28_OFF -224
+#define V29_OFF -208
+#define V30_OFF -192
+#define V31_OFF -176
+#define PLT1_OFF -112
+#define PLT2_OFF -104
+#define R2_OFF -96
+#define R3_OFF -88
+#define R4_OFF -80
+#define R5_OFF -72
+#define R14_OFF -64
+#define R15_OFF -56
+#define F0_OFF -48
+#define F2_OFF -40
+#define F4_OFF -32
+#define F6_OFF -24
.globl _dl_runtime_resolve
.type _dl_runtime_resolve, @function
cfi_startproc
.align 16
_dl_runtime_resolve:
- stmg %r2,%r5,64(%r15) # save call-clobbered argument registers
- cfi_offset (r2, -96)
- cfi_offset (r3, -88)
- cfi_offset (r4, -80)
- cfi_offset (r5, -72)
- stmg %r14,%r15,96(%r15)
- cfi_offset (r14, -64)
- cfi_offset (r15, -56)
- std %f0,112(%r15)
- cfi_offset (f0, -48)
- std %f2,120(%r15)
- cfi_offset (f2, -40)
- std %f4,128(%r15)
- cfi_offset (f4, -32)
- std %f6,136(%r15)
- cfi_offset (f6, -24)
- lmg %r2,%r3,48(%r15) # load args for fixup saved by PLT
+ stmg %r2,%r5,CFA_OFF+R2_OFF(%r15) # save registers
+ cfi_offset (r2, R2_OFF)
+ cfi_offset (r3, R3_OFF)
+ cfi_offset (r4, R4_OFF)
+ cfi_offset (r5, R5_OFF)
+ stmg %r14,%r15,CFA_OFF+R14_OFF(%r15)
+ cfi_offset (r14, R14_OFF)
+ cfi_offset (r15, R15_OFF)
+ std %f0,CFA_OFF+F0_OFF(%r15)
+ cfi_offset (f0, F0_OFF)
+ std %f2,CFA_OFF+F2_OFF(%r15)
+ cfi_offset (f2, F2_OFF)
+ std %f4,CFA_OFF+F4_OFF(%r15)
+ cfi_offset (f4, F4_OFF)
+ std %f6,CFA_OFF+F6_OFF(%r15)
+ cfi_offset (f6, F6_OFF)
+ lmg %r2,%r3,CFA_OFF+PLT1_OFF(%r15) # load args saved by PLT
lgr %r0,%r15
#ifdef RESTORE_VRS
- aghi %r15,-288 # create stack frame
- cfi_adjust_cfa_offset (288)
+# define FRAME_SIZE (CFA_OFF + 128)
+ aghi %r15,-FRAME_SIZE # create stack frame
+ cfi_adjust_cfa_offset (FRAME_SIZE)
.machine push
.machine "z13"
- vstm %v24,%v31,160(%r15)# store call-clobbered vector argument registers
- cfi_offset (v24, -288)
- cfi_offset (v25, -272)
- cfi_offset (v26, -256)
- cfi_offset (v27, -240)
- cfi_offset (v28, -224)
- cfi_offset (v29, -208)
- cfi_offset (v30, -192)
- cfi_offset (v31, -176)
+ vstm %v24,%v31,FRAME_OFF+V24_OFF(%r15) # save call-clobbered vr args
+ cfi_offset (v24, V24_OFF)
+ cfi_offset (v25, V25_OFF)
+ cfi_offset (v26, V26_OFF)
+ cfi_offset (v27, V27_OFF)
+ cfi_offset (v28, V28_OFF)
+ cfi_offset (v29, V29_OFF)
+ cfi_offset (v30, V30_OFF)
+ cfi_offset (v31, V31_OFF)
.machine pop
#else
- aghi %r15,-160 # create stack frame
- cfi_adjust_cfa_offset (160)
+# define FRAME_SIZE CFA_OFF
+ aghi %r15,-FRAME_SIZE # create stack frame
+ cfi_adjust_cfa_offset (FRAME_SIZE)
#endif
stg %r0,0(%r15) # write backchain
brasl %r14,_dl_fixup # call _dl_fixup
@@ -85,22 +109,40 @@ _dl_runtime_resolve:
#ifdef RESTORE_VRS
.machine push
.machine "z13"
- vlm %v24,%v31,160(%r15)# restore vector registers
+ vlm %v24,%v31,FRAME_OFF+V24_OFF(%r15) # restore vector registers
.machine pop
- lmg %r14,%r15,384(%r15)# remove stack frame and restore registers
-#else
- lmg %r14,%r15,256(%r15)# remove stack frame and restore registers
#endif
- cfi_def_cfa_offset (160)
- ld %f0,112(%r15)
- ld %f2,120(%r15)
- ld %f4,128(%r15)
- ld %f6,136(%r15)
- lmg %r2,%r5,64(%r15)
+ lmg %r14,%r15,FRAME_OFF+R14_OFF(%r15) # restore frame and registers
+#undef FRAME_SIZE
+ cfi_def_cfa_offset (CFA_OFF)
+ ld %f0,CFA_OFF+F0_OFF(%r15)
+ ld %f2,CFA_OFF+F2_OFF(%r15)
+ ld %f4,CFA_OFF+F4_OFF(%r15)
+ ld %f6,CFA_OFF+F6_OFF(%r15)
+ lmg %r2,%r5,CFA_OFF+R2_OFF(%r15)
br %r1
cfi_endproc
.size _dl_runtime_resolve, .-_dl_runtime_resolve
-
+#undef V24_OFF
+#undef V25_OFF
+#undef V26_OFF
+#undef V27_OFF
+#undef V28_OFF
+#undef V29_OFF
+#undef V30_OFF
+#undef V31_OFF
+#undef PLT1_OFF
+#undef PLT2_OFF
+#undef R2_OFF
+#undef R3_OFF
+#undef R4_OFF
+#undef R5_OFF
+#undef R14_OFF
+#undef R15_OFF
+#undef F0_OFF
+#undef F2_OFF
+#undef F4_OFF
+#undef F6_OFF
#ifndef PROF
.globl _dl_runtime_profile
--
2.18.0
next prev parent reply other threads:[~2018-08-02 7:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
2018-08-02 7:58 ` [PATCH 02/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_profile Ilya Leoshkevich
2018-08-02 7:58 ` Ilya Leoshkevich [this message]
2018-08-02 7:58 ` [PATCH 01/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_resolve Ilya Leoshkevich
2018-08-02 7:59 ` [PATCH 09/12] S390: Test that lazy binding does not clobber R0 Ilya Leoshkevich
2018-08-02 7:59 ` [PATCH 08/12] S390: Do not clobber R0 in 64-bit _dl_runtime_profile Ilya Leoshkevich
2018-08-02 7:59 ` [PATCH 12/12] S390: Fix unwind in 32-bit _mcount Ilya Leoshkevich
2018-08-02 7:59 ` [PATCH 05/12] S390: Do not clobber R0 in 32-bit _dl_runtime_resolve Ilya Leoshkevich
2018-08-02 7:59 ` [PATCH 11/12] S390: Implement 64-bit __fentry__ Ilya Leoshkevich
2018-08-02 7:59 ` [PATCH 07/12] S390: Do not clobber R0 in 64-bit _dl_runtime_resolve Ilya Leoshkevich
2018-08-02 8:10 ` [PATCH 10/12] Move __fentry__ version definition to sysdeps/{i386,x86_64} Ilya Leoshkevich
2018-08-02 8:41 ` [PATCH 06/12] S390: Do not clobber R0 in 32-bit _dl_runtime_profile Ilya Leoshkevich
2018-08-02 9:00 ` [PATCH 04/12] S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_profile Ilya Leoshkevich
2018-08-02 9:17 ` [PATCH 00/12] S390: Implement __fentry__ Florian Weimer
2018-08-02 10:43 ` Ilya Leoshkevich
2018-08-02 18:32 ` Florian Weimer
2018-08-07 8:27 ` Stefan Liebler
2018-08-10 7:15 ` [COMMITTED] " Stefan Liebler
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=20180802075735.3457-4-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=libc-alpha@sourceware.org \
--cc=stli@linux.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).