From 8d2e6a0383b6958311f021ee0b8b7eba44110f5a Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 28 Feb 2006 09:34:41 +0000 Subject: * 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. --- ChangeLog | 7 +++++++ sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 19 ++++++++++++++++--- sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 20 +++++++++++++++++--- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1d3bcb8d95..b5ea890fa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-02-22 Martin Schwidefsky + + * 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 * sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Copy in i386/bits/fcntl.h. diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index 50c3f42469..b86072bd30 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -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. @@ -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 \ @@ -255,6 +264,9 @@ #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) @@ -262,6 +274,7 @@ #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. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index aadbf74c2b..fc80c9ff86 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -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. @@ -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 \ @@ -256,6 +266,9 @@ #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) @@ -263,6 +276,7 @@ #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 -- cgit 1.4.1