Skip to content

Commit

Permalink
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
Browse files Browse the repository at this point in the history
	(DO_CALL): Add support for 6 system call parameters.
	(DECLARGS_6, ASMFMT_6): Define.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.
  • Loading branch information
Roland McGrath committed Feb 28, 2006
1 parent 88fe017 commit 8d2e6a0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2006-02-22 Martin Schwidefsky <schwidefsky@de.ibm.com>

* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
(DO_CALL): Add support for 6 system call parameters.
(DECLARGS_6, ASMFMT_6): Define.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.

2006-02-28 Roland McGrath <roland@redhat.com>

* sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Copy in i386/bits/fcntl.h.
Expand Down
19 changes: 16 additions & 3 deletions sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
Expand Down Expand Up @@ -149,19 +149,28 @@
arg 3 4 call-clobbered
arg 4 5 call-clobbered
arg 5 6 call-saved
arg 6 7 call-saved
(Of course a function with say 3 arguments does not have entries for
arguments 4 and 5.)
S390 does not need to do ANY stack operations to get its parameters
right.
For system calls with 6 parameters a stack operation is required
to load the 6th parameter to register 7. Call saved register 7 is
moved to register 0 and back to avoid an additional stack frame.
*/

#define DO_CALL(syscall, args) \
.if args > 5; \
lr %r0,%r7; \
l %r7,96(%r15); \
.endif; \
.if SYS_ify (syscall) < 256; \
svc SYS_ify (syscall); \
.else; \
lhi %r1,SYS_ify (syscall); \
svc 0; \
.endif; \
.if args > 5; \
lr %r7,%r0; \
.endif

#define ret \
Expand Down Expand Up @@ -255,13 +264,17 @@
#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
DECLARGS_4(arg1, arg2, arg3, arg4) \
register unsigned long gpr6 asm ("6") = (unsigned long)(arg5);
#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
register unsigned long gpr7 asm ("7") = (unsigned long)(arg6);

#define ASMFMT_0
#define ASMFMT_1 , "0" (gpr2)
#define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)


/* Pointer mangling support. */
Expand Down
20 changes: 17 additions & 3 deletions sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Assembler macros for 64 bit S/390.
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
Expand Down Expand Up @@ -150,19 +151,28 @@
arg 3 4 call-clobbered
arg 4 5 call-clobbered
arg 5 6 call-saved
arg 6 7 call-saved
(Of course a function with say 3 arguments does not have entries for
arguments 4 and 5.)
S390 does not need to do ANY stack operations to get its parameters
right.
For system calls with 6 parameters a stack operation is required
to load the 6th parameter to register 7. Call saved register 7 is
moved to register 0 and back to avoid an additional stack frame.
*/

#define DO_CALL(syscall, args) \
.if args > 5; \
lgr %r0,%r7; \
lg %r7,160(%r15); \
.endif; \
.if SYS_ify (syscall) < 256; \
svc SYS_ify (syscall); \
.else; \
lghi %r1,SYS_ify (syscall); \
svc 0; \
.endif; \
.if args > 5; \
lgr %r7,%r0; \
.endif

#define ret \
Expand Down Expand Up @@ -256,13 +266,17 @@
#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
DECLARGS_4(arg1, arg2, arg3, arg4) \
register unsigned long gpr6 asm ("6") = (unsigned long)(arg5);
#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
register unsigned long gpr6 asm ("7") = (unsigned long)(arg6);

#define ASMFMT_0
#define ASMFMT_1 , "0" (gpr2)
#define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)

/* Pointer mangling support. */
#if defined NOT_IN_libc && defined IS_IN_rtld
Expand Down

0 comments on commit 8d2e6a0

Please sign in to comment.