This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] s390* macros


Hi,
one of my last patches (vfork) wasn't perfect. Currently libc head doesn't compile.
The reason is the use of HIDDEN_JUMPTARGET in vfork.S. It is defined by use
of JUMPTARGET but the definition of JUMPTARGET contains s390 instructions.
That doesn't go together with the HIDDEN_JUMPTARGET use in vfork. As a
consequence I redefined the PSEUDO / PSEUDO_END / JUMPTARGET macros
to get the instructions out of JUMPTARGET. The PSEUDO redefinition in
sysdep-cancel.h has changed as well with the effect that s390-32 doesn't
have to redefine PSEUDO_END in sysdep-cancel.h any more.
With this patch libc head compiles again. One testcase of make check fails
for s390-32 though. check-textrel claims that libc.so uses text relocations
but readelf -a doesn't show any. Is it possible that the testcase is broken ?

blue skies,
  Martin.

libc/ChangeLog:
2003-01-13  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/s390/s390-32/sysdep.h
	(JUMPTARGET): Move branch instructions from here
	(PSEUDO): ... to here.
	* sysdeps/s390/s390-64/sysdep.h
	(JUMPTARGET): Move branch instruction from here
	(PSEUDO): ... to here.

linuxthreads ChangeLog:
2003-01-13  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
	(PSEUDO): Code reordering. Move CENABLE and CDISABLE literals from
	PSEUDO_END to PSEUDO.
	(PSEUDO_END): Remove.
	(SINGLE_THREAD_P): Save an instruction.
	* sysdeps/unix/sysv/linux/s390/s390-32/vfork.S (__vfork): Add missing
	parameter to SINGLE_THREAD_P call.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (PSEUDO):
	Code reordering.

diff -urN libc/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h libc-s390/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
--- libc/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h	Mon Jan 13 10:33:40 2003
+++ libc-s390/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h	Mon Jan 13 14:39:04 2003
@@ -28,14 +28,6 @@
 # undef PSEUDO
 # define PSEUDO(name, syscall_name, args)				      \
 	.text;								      \
-ENTRY(name)								      \
-	SINGLE_THREAD_P(%r1)						      \
-	jne	L(pseudo_cancel);					      \
-	DO_CALL(syscall_name, args);					      \
-	lhi	%r4,-4095;						      \
-	clr	%r2,%r4;						      \
-	jnl	SYSCALL_ERROR_LABEL;					      \
-	br	%r14;							      \
 L(pseudo_cancel):							      \
 	STM_##args							      \
 	stm	%r12,%r15,48(%r15);					      \
@@ -43,29 +35,30 @@
 	ahi	%r15,-96;						      \
 	st	%r14,0(%r15);						      \
 	basr    %r13,0;							      \
-200301:	l	%r1,200302f-200301b(%r13);				      \
+0:	l	%r1,1f-0b(%r13);					      \
 	bas	%r14,0(%r1,%r13);					      \
 	lr	%r0,%r2;						      \
 	LM_##args							      \
 	DO_CALL(syscall_name, args);					      \
-	l	%r1,200303f-200301b(%r13);				      \
+	l	%r1,2f-0b(%r13);					      \
 	lr	%r12,%r2;						      \
 	lr	%r2,%r0;						      \
 	bas	%r14,0(%r1,%r13);					      \
 	lr	%r2,%r12;						      \
 	lm	%r12,%r15,48+96(%r15);					      \
+	j	L(pseudo_check);					      \
+1:	.long	CENABLE-0b;						      \
+2:	.long	CDISABLE-0b;						      \
+ENTRY(name)								      \
+	SINGLE_THREAD_P(%r1)						      \
+	jne	L(pseudo_cancel);					      \
+	DO_CALL(syscall_name, args);					      \
+L(pseudo_check):							      \
 	lhi	%r4,-4095;						      \
 	clr	%r2,%r4;						      \
 	jnl	SYSCALL_ERROR_LABEL;					      \
 L(pseudo_end):
 
-#undef PSEUDO_END
-#define PSEUDO_END(name)						      \
-  SYSCALL_ERROR_HANDLER;						      \
-200302:	.long	CENABLE-200301b;					      \
-200303:	.long	CDISABLE-200301b;					      \
-    END (name)
-
 # ifdef IS_IN_libpthread
 #  define CENABLE	__pthread_enable_asynccancel
 #  define CDISABLE	__pthread_disable_asynccancel
@@ -95,8 +88,7 @@
 # else
 #  define SINGLE_THREAD_P(reg) \
 	ear	reg,%a0;						      \
-	l	reg,MULTIPLE_THREADS_OFFSET(reg);			      \
-	ltr	reg,reg;
+	icm	reg,15,MULTIPLE_THREADS_OFFSET(reg);
 # endif
 
 #elif !defined __ASSEMBLER__
diff -urN libc/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S libc-s390/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S
--- libc/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S	Sun Jan 12 23:58:12 2003
+++ libc-s390/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S	Mon Jan 13 14:39:04 2003
@@ -27,7 +27,7 @@
    and the process ID of the new process to the old process.  */
 
 ENTRY (__vfork)
-	SINGLE_THREAD_P
+	SINGLE_THREAD_P(%r1)
 	jne	0f
 
 	/* Do vfork system call.  */
diff -urN libc/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h libc-s390/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
--- libc/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h	Mon Jan 13 10:33:40 2003
+++ libc-s390/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h	Mon Jan 13 14:39:04 2003
@@ -28,14 +28,6 @@
 # undef PSEUDO
 # define PSEUDO(name, syscall_name, args)				      \
 	.text;								      \
-ENTRY(name)								      \
-	SINGLE_THREAD_P							      \
-	jne	L(pseudo_cancel);					      \
-	DO_CALL(syscall_name, args);					      \
-	lghi	%r4,-4095;						      \
-	clgr	%r2,%r4;						      \
-	jnl	SYSCALL_ERROR_LABEL;					      \
-	br	%r14;							      \
 L(pseudo_cancel):							      \
 	STM_##args							      \
 	stmg	%r13,%r15,104(%r15);					      \
@@ -51,6 +43,12 @@
 	brasl	%r14,CDISABLE;						      \
 	lgr	%r2,%r13;						      \
 	lmg	%r13,%r15,104+160(%r15);				      \
+	j	L(pseudo_check);					      \
+ENTRY(name)								      \
+	SINGLE_THREAD_P							      \
+	jne	L(pseudo_cancel);					      \
+	DO_CALL(syscall_name, args);					      \
+L(pseudo_check):							      \
 	lghi	%r4,-4095;						      \
 	clgr	%r2,%r4;						      \
 	jnl	SYSCALL_ERROR_LABEL;					      \
diff -urN libc/sysdeps/s390/s390-32/sysdep.h libc-s390/sysdeps/s390/s390-32/sysdep.h
--- libc/sysdeps/s390/s390-32/sysdep.h	Fri Jan 10 10:32:06 2003
+++ libc-s390/sysdeps/s390/s390-32/sysdep.h	Mon Jan 13 14:39:04 2003
@@ -82,13 +82,16 @@
 #define mcount		_mcount
 #endif
 
-#define	PSEUDO(name, syscall_name, args)				      \
-lose: SYSCALL_PIC_SETUP							      \
-  JUMPTARGET(syscall_error)						      \
-  .globl syscall_error;							      \
-  ENTRY (name)								      \
-  DO_CALL (syscall_name, args);						      \
-  jm lose
+#define	PSEUDO(name, syscall_name, args) \
+lose: SYSCALL_PIC_SETUP				\
+    basr %r1,0;					\
+0:  al %r1,1f-0b(%r1);				\
+    br %r1;					\
+1:  .long JUMPTARGET(syscall_error) - 0b;	\
+    .globl syscall_error;			\
+    ENTRY (name)				\
+    DO_CALL (syscall_name, args);		\
+    jm lose
 
 #undef	PSEUDO_END
 #define	PSEUDO_END(name)						      \
@@ -96,21 +99,13 @@
 
 #undef JUMPTARGET
 #ifdef PIC
-#define JUMPTARGET(name)  \
-    basr %r1,0            \
-0:  al   %r1,1f-0b(0,%r1) \
-    br   %r1              \
-1:  .long name##@PLT - 0b
+#define JUMPTARGET(name)	name##@PLT
 #define SYSCALL_PIC_SETUP             \
     bras  %r12,1f                     \
 0:  .long _GLOBAL_OFFSET_TABLE_-0b    \
 1:  al    %r12,0(%r12)
 #else
-#define JUMPTARGET(name)   \
-    basr  %r1,0            \
-0:  al    %r1,1f-0b(0,%r1) \
-    br    %r1              \
-1:  .long name - 0b
+#define JUMPTARGET(name)   	name
 #define SYSCALL_PIC_SETUP	/* Nothing.  */
 #endif
 
diff -urN libc/sysdeps/s390/s390-64/sysdep.h libc-s390/sysdeps/s390/s390-64/sysdep.h
--- libc/sysdeps/s390/s390-64/sysdep.h	Fri Jan 10 10:32:06 2003
+++ libc-s390/sysdeps/s390/s390-64/sysdep.h	Mon Jan 13 14:39:04 2003
@@ -80,12 +80,12 @@
 #define mcount		_mcount
 #endif
 
-#define	PSEUDO(name, syscall_name, args)				      \
-lose: SYSCALL_PIC_SETUP							      \
-  JUMPTARGET(syscall_error)						      \
-  .globl syscall_error;							      \
-  ENTRY (name)								      \
-  DO_CALL (syscall_name, args);						      \
+#define	PSEUDO(name, syscall_name, args) \
+lose: SYSCALL_PIC_SETUP			\
+  jg JUMPTARGET(syscall_error);		\
+  .globl syscall_error;			\
+  ENTRY (name)				\
+  DO_CALL (syscall_name, args);		\
   jm lose
 
 #undef	PSEUDO_END
@@ -94,13 +94,11 @@
 
 #undef JUMPTARGET
 #ifdef PIC
-#define JUMPTARGET(name)  \
-    brasl name##@PLT
+#define JUMPTARGET(name)	name##@PLT
 #define SYSCALL_PIC_SETUP \
     larl  %r12,_GLOBAL_OFFSET_TABLE_
 #else
-#define JUMPTARGET(name)  \
-    brasl name
+#define JUMPTARGET(name)	name
 #define SYSCALL_PIC_SETUP	/* Nothing.  */
 #endif
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]