From 8651d7a69315735db866e7bf6a9539e10a6b1f9f Mon Sep 17 00:00:00 2001 From: Sven Oehme Date: Wed, 11 Aug 2004 16:45:35 +0000 Subject: [PATCH] s390x-20040811 zLinux on S390x (64 bit S390) --- acinclude.m4 | 3 + config.guess | 2 + src/afs/LINUX/osi_module.c | 37 ++++--- src/afs/afs.h | 2 +- src/afs/afs_call.c | 2 + src/afs/afs_pioctl.c | 2 + src/bozo/bos.c | 3 +- src/cf/osconf.m4 | 21 +++- src/config/afs_sysnames.h | 3 + src/config/make_libafs_tree.pl | 2 +- src/config/param.s390x_linux24.h | 169 ++++++++++++++++++++++++++++++ src/des/crypt.c | 2 +- src/kauth/admin_tools.c | 2 +- src/kauth/authclient.c | 2 +- src/libafs/MakefileProto.LINUX.in | 6 ++ src/lwp/Makefile.in | 8 +- src/lwp/lwp.c | 5 + src/lwp/process.s | 87 --------------- src/lwp/process.s390.s | 98 +++++++++++++++++ src/lwp/process.s390x.s | 98 +++++++++++++++++ 20 files changed, 442 insertions(+), 112 deletions(-) create mode 100644 src/config/param.s390x_linux24.h create mode 100644 src/lwp/process.s390.s create mode 100644 src/lwp/process.s390x.s diff --git a/acinclude.m4 b/acinclude.m4 index 0f7b78a86..0aa601a1b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -591,6 +591,9 @@ else s390-*-linux*) AFS_SYSNAME="s390_linuxXX" ;; + s390x-*-linux*) + AFS_SYSNAME="s390x_linuxXX" + ;; sparc-*-linux*) AFS_SYSNAME="sparc_linuxXX" ;; diff --git a/config.guess b/config.guess index 265ea69c4..18d6514da 100755 --- a/config.guess +++ b/config.guess @@ -856,6 +856,8 @@ EOF EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy + elif test "${UNAME_MACHINE}" = "s390x"; then + echo s390x-ibm-linux && exit 0 elif test "${UNAME_MACHINE}" = "s390"; then echo s390-ibm-linux && exit 0 elif test "${UNAME_MACHINE}" = "x86_64"; then diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index f864a0c18..dba52d595 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -47,18 +47,25 @@ asmlinkage int (*sys_settimeofdayp) (struct timeval * tv, #endif asmlinkage long (*sys_setgroupsp) (int gidsetsize, gid_t * grouplist); #ifdef EXPORTED_SYS_CALL_TABLE -#ifdef AFS_SPARC64_LINUX20_ENV -extern unsigned int sys_call_table[]; /* changed to uint because SPARC64 has syscaltable of 32bit items */ +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) +extern unsigned int sys_call_table[]; /* changed to uint because SPARC64 and S390X have syscalltable of 32bit items */ #else extern void *sys_call_table[]; /* safer for other linuces */ #endif #else /* EXPORTED_SYS_CALL_TABLE */ -#ifdef AFS_SPARC64_LINUX20_ENV -static unsigned int *sys_call_table; /* changed to uint because SPARC64 has syscaltable of 32bit items */ +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) +static unsigned int *sys_call_table; /* changed to uint because SPARC64 and S390X have syscalltable of 32bit items */ #else static void **sys_call_table; /* safer for other linuces */ #endif #endif + +#if defined(AFS_S390X_LINUX24_ENV) +#define _S(x) ((x)<<1) +#else +#define _S(x) x +#endif + extern struct file_system_type afs_fs_type; static long get_page_offset(void); @@ -76,7 +83,7 @@ unsigned long afs_linux_page_offset = 0; /* contains the PAGE_OFFSET value */ /* Since sys_ni_syscall is not exported, I need to cache it in order to restore * it. */ -#ifdef AFS_SPARC64_LINUX20_ENV +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) static unsigned int afs_ni_syscall = 0; #else static void *afs_ni_syscall = 0; @@ -208,7 +215,7 @@ asmlinkage int (*sys_setgroups32p) (int gidsetsize, __kernel_gid32_t * grouplist); #endif /* AFS_LINUX24_ENV */ -#ifdef AFS_SPARC64_LINUX20_ENV +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) #define POINTER2SYSCALL (unsigned int)(unsigned long) #define SYSCALL2POINTER (void *)(long) #else @@ -365,7 +372,7 @@ init_module(void) printf("Failed to find address of sys_call_table\n"); } else { printf("Found sys_call_table at %x\n", sys_call_table); -#ifdef AFS_SPARC64_LINUX20_ENV +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) error cant support this yet.; #endif /* AFS_SPARC64_LINUX20_ENV */ #endif /* EXPORTED_SYS_CALL_TABLE */ @@ -435,7 +442,7 @@ init_module(void) /* Initialize pointers to kernel syscalls. */ #if !defined(AFS_LINUX24_ENV) - sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday]; + sys_settimeofdayp = SYSCALL2POINTER sys_call_table[_S(__NR_settimeofday)]; #endif /* AFS_IA64_LINUX20_ENV */ /* setup AFS entry point. */ @@ -443,7 +450,7 @@ init_module(void) #if defined(AFS_IA64_LINUX20_ENV) SYSCALL2POINTER sys_call_table[__NR_afs_syscall - 1024] #else - SYSCALL2POINTER sys_call_table[__NR_afs_syscall] + SYSCALL2POINTER sys_call_table[_S(__NR_afs_syscall)] #endif == afs_syscall) { printf("AFS syscall entry point already in use!\n"); @@ -454,8 +461,8 @@ init_module(void) sys_call_table[__NR_afs_syscall - 1024] = POINTER2SYSCALL((struct fptr *)afs_syscall_stub)->ip; #else /* AFS_IA64_LINUX20_ENV */ - afs_ni_syscall = sys_call_table[__NR_afs_syscall]; - sys_call_table[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall; + afs_ni_syscall = sys_call_table[_S(__NR_afs_syscall)]; + sys_call_table[_S(__NR_afs_syscall)] = POINTER2SYSCALL afs_syscall; #ifdef AFS_SPARC64_LINUX20_ENV afs_ni_syscall32 = sys_call_table32[__NR_afs_syscall]; sys_call_table32[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall32; @@ -486,8 +493,8 @@ init_module(void) sys_call_table[__NR_setgroups - 1024] = POINTER2SYSCALL((struct fptr *)afs_xsetgroups_stub)->ip; #else /* AFS_IA64_LINUX20_ENV */ - sys_setgroupsp = SYSCALL2POINTER sys_call_table[__NR_setgroups]; - sys_call_table[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups; + sys_setgroupsp = SYSCALL2POINTER sys_call_table[_S(__NR_setgroups)]; + sys_call_table[_S(__NR_setgroups)] = POINTER2SYSCALL afs_xsetgroups; #ifdef AFS_SPARC64_LINUX20_ENV sys32_setgroupsp = SYSCALL2POINTER sys_call_table32[__NR_setgroups]; sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs32_xsetgroups; @@ -548,8 +555,8 @@ cleanup_module(void) POINTER2SYSCALL((struct fptr *)sys_setgroupsp)->ip; sys_call_table[__NR_afs_syscall - 1024] = afs_ni_syscall; #else /* AFS_IA64_LINUX20_ENV */ - sys_call_table[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp; - sys_call_table[__NR_afs_syscall] = afs_ni_syscall; + sys_call_table[_S(__NR_setgroups)] = POINTER2SYSCALL sys_setgroupsp; + sys_call_table[_S(__NR_afs_syscall)] = afs_ni_syscall; # ifdef AFS_SPARC64_LINUX20_ENV sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys32_setgroupsp; sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32; diff --git a/src/afs/afs.h b/src/afs/afs.h index 49f2c408d..11e4843e5 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -900,7 +900,7 @@ struct afs_fheader { */ #define afs_inode_t ino64_t #else -#if defined(AFS_LINUX_64BIT_KERNEL) +#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_S390X_LINUX24_ENV) #define afs_inode_t long #else #if defined(AFS_AIX51_ENV) || defined(AFS_HPUX1123_ENV) diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 2d5e67424..6b1eeeb1c 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -1148,6 +1148,8 @@ copyin_iparam(caddr_t cmarg, struct iparam *dst) if (current->thread.flags & THREAD_IA32) #elif defined(AFS_PPC64_LINUX20_ENV) if (current->thread.flags & PPC_FLAG_32BIT) +#elif defined(AFS_S390X_LINUX20_ENV) + if (current->thread.flags & S390_FLAG_31BIT) #else #error Not done for this linux version #endif diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 8f4b939fe..8ab51ac02 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -269,6 +269,8 @@ copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst) if (current->thread.flags & THREAD_IA32) #elif defined(AFS_PPC64_LINUX20_ENV) if (current->thread.flags & PPC_FLAG_32BIT) +#elif defined(AFS_S390X_LINUX20_ENV) + if (current->thread.flags & S390_FLAG_31BIT) #else #error Not done for this linux type #endif diff --git a/src/bozo/bos.c b/src/bozo/bos.c index 7d3c837ce..d5ced10e3 100644 --- a/src/bozo/bos.c +++ b/src/bozo/bos.c @@ -145,7 +145,8 @@ DateOf(atime) { static char tbuffer[30]; register char *tp; - tp = ctime((time_t *) & atime); + time_t t = (time_t) atime; + tp = ctime(&t); if (tp) { strcpy(tbuffer, tp); tbuffer[24] = 0; /* get rid of new line */ diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4 index 8d6373181..ac12969fb 100644 --- a/src/cf/osconf.m4 +++ b/src/cf/osconf.m4 @@ -439,7 +439,7 @@ case $AFS_SYSNAME in s390_linux22) CC="gcc" CCOBJ="gcc" - LD="gcc" + LD="ld" KERN_OPTMZ=-O2 LEX="flex -l" MT_CC="$CC" @@ -456,7 +456,7 @@ case $AFS_SYSNAME in s390_linux24) CC="gcc" CCOBJ="gcc" - LD="gcc" + LD="ld" KERN_OPTMZ=-O2 LEX="flex -l" MT_CC="$CC" @@ -470,6 +470,23 @@ case $AFS_SYSNAME in SHLIB_LINKER="${MT_CC} -shared" ;; + s390x_linux24) + CC="gcc" + CCOBJ="gcc" + LD="ld" + KERN_OPTMZ=-O2 + LEX="flex -l" + MT_CC="$CC" + MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_LIBS="-lpthread" + PAM_CFLAGS="-O -Dlinux -DLINUX_PAM -fPIC" + SHLIB_LDFLAGS="-shared -Xlinker -x" + TXLIBS="-lncurses" + XCFLAGS="-O -g -D_LARGEFILE64_SOURCE -D__s390x__" + YACC="bison -y" + SHLIB_LINKER="${MT_CC} -shared" + ;; + sgi_62) PINSTALL_LIBS=-lmld AFSD_LIBS="/usr/lib/libdwarf.a /usr/lib/libelf.a" diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index e6ae7ebd1..db042c3b1 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -150,6 +150,9 @@ #define SYS_NAME_ID_s390_linux2 1900 #define SYS_NAME_ID_s390_linux22 1901 #define SYS_NAME_ID_s390_linux24 1902 +#define SYS_NAME_ID_s390x_linux2 1903 +#define SYS_NAME_ID_s390x_linux22 1904 +#define SYS_NAME_ID_s390x_linux24 1905 #define SYS_NAME_ID_alpha_linux_2 2000 #define SYS_NAME_ID_alpha_linux_22 2001 diff --git a/src/config/make_libafs_tree.pl b/src/config/make_libafs_tree.pl index 0e2793412..dcd08eb89 100755 --- a/src/config/make_libafs_tree.pl +++ b/src/config/make_libafs_tree.pl @@ -96,7 +96,7 @@ sub process_libafsdep $subdir =~ s|/$||gio; print "# $dir/$depname\n"; - open(COMPS, "$dir/$depname"); + open(COMPS, "$depname"); while ( defined($file = ) ) { my ($destdir, $proj_src,$obj_src); diff --git a/src/config/param.s390x_linux24.h b/src/config/param.s390x_linux24.h new file mode 100644 index 000000000..ed1942196 --- /dev/null +++ b/src/config/param.s390x_linux24.h @@ -0,0 +1,169 @@ +#ifndef UKERNEL +/* This section for kernel libafs compiles only */ + +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously s390 specific, use that + * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2" + * in the sysname is the current version of the client. This takes into + * account the perferred OS user space configuration as well as the kernel. + */ + +#define AFS_LINUX20_ENV 1 +#define AFS_LINUX22_ENV 1 +#define AFS_LINUX24_ENV 1 +#define AFS_S390_LINUX20_ENV 1 +#define AFS_S390_LINUX22_ENV 1 +#define AFS_S390_LINUX24_ENV 1 +#define AFS_S390X_LINUX20_ENV 1 +#define AFS_S390X_LINUX22_ENV 1 +#define AFS_S390X_LINUX24_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 137 +#define AFS_64BIT_ENV 1 +#define AFS_64BITPOINTER_ENV 1 +#define AFS_64BIT_CLIENT 1 +#define AFS_64BIT_KERNEL 1 +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ + +#if defined(__KERNEL__) && !defined(KDUMP_KERNEL) +#include + +#include +#ifdef CONFIG_SMP +#undef CONFIG_SMP +#endif +/* Using "AFS_SMP" to map to however many #define's are required to get + * MP to compile for Linux + */ +#ifdef AFS_SMP +#define CONFIG_SMP 1 +#ifndef CONFIG_S390_LOCAL_APIC +#define CONFIG_S390_LOCAL_APIC 1 +#endif +#ifndef __SMP__ +#define __SMP__ +#endif +#define AFS_GLOBAL_SUNLOCK +#endif +#if defined(MODULE) && defined(CONFIG_MODVERSIONS) +#define MODVERSIONS +#include +#endif +#endif /* __KERNEL__ && !DUMP_KERNEL */ + +#include + +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ + +/* Machine / Operating system information */ +#define SYS_NAME "s390x_linux24" +#define SYS_NAME_ID SYS_NAME_ID_s390x_linux24 +#define AFSBIG_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#ifdef KERNEL +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif +#endif /* KERNEL */ + +#endif /* AFS_PARAM_H */ + +#else /* !defined(UKERNEL) */ + +/* This section for user space compiles only */ + +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously s390 specific, use that + * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2" + * in the sysname is the current version of the client. This takes into + * account the perferred OS user space configuration as well as the kernel. + */ + +#define UKERNEL 1 /* user space kernel */ +#define AFS_ENV 1 +#define AFS_USR_LINUX20_ENV 1 +#define AFS_USR_LINUX22_ENV 1 +#define AFS_USR_LINUX24_ENV 1 +#define AFS_S390X_LINUX20_ENV 1 +#define AFS_S390X_LINUX22_ENV 1 +#define AFS_S390X_LINUX24_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 137 +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 +#define AFS_64BITPOINTER_ENV 1 +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#include + +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + + +/* Machine / Operating system information */ +#define SYS_NAME "s390x_linux24" +#define SYS_NAME_ID SYS_NAME_ID_s390x_linux24 +#define AFSBIG_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS 1 +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define VATTR_NULL usr_vattr_null + +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif + +#endif /* AFS_PARAM_H */ + +#endif /* !defined(UKERNEL) */ diff --git a/src/des/crypt.c b/src/des/crypt.c index 54dfa6b30..a17c2a71a 100644 --- a/src/des/crypt.c +++ b/src/des/crypt.c @@ -91,7 +91,7 @@ RCSID */ /* XXX shouldn't this be !AFS_64BIT_ENV ? */ -#if !defined(cray) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV) && !defined(AFS_PPC64_LINUX20_ENV) +#if !defined(cray) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV) && !defined(AFS_PPC64_LINUX20_ENV) & !defined(AFS_S390X_LINUX20_ENV) #define LONG_IS_32_BITS #endif diff --git a/src/kauth/admin_tools.c b/src/kauth/admin_tools.c index 3012a7fb6..4e9b4c237 100644 --- a/src/kauth/admin_tools.c +++ b/src/kauth/admin_tools.c @@ -818,7 +818,7 @@ SetPassword(struct cmd_syndesc *as, char *arock) if (as->parms[3].items) sscanf(as->parms[3].items->data, "%d", &kvno); -#ifdef AFS_S390_LINUX20_ENV +#if defined(AFS_S390_LINUX20_ENV) && !defined(AFS_S390X_LINUX20_ENV) code = ubik_Call(KAM_SetPassword, conn, 0, name, instance, kvno, 0, key); #else code = ubik_Call(KAM_SetPassword, conn, 0, name, instance, kvno, key); diff --git a/src/kauth/authclient.c b/src/kauth/authclient.c index 381184810..2a06ed6ea 100644 --- a/src/kauth/authclient.c +++ b/src/kauth/authclient.c @@ -749,7 +749,7 @@ ka_ChangePassword(char *name, char *instance, struct ubik_client * conn, /* Ubik afs_int32 code; LOCK_GLOBAL_MUTEX -#ifdef AFS_S390_LINUX20_ENV +#if defined(AFS_S390_LINUX20_ENV) && !defined(AFS_S390X_LINUX20_ENV) code = ubik_Call_New(KAM_SetPassword, conn, 0, name, instance, 0, 0, *newkey); diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in index e82875044..3527948cd 100644 --- a/src/libafs/MakefileProto.LINUX.in +++ b/src/libafs/MakefileProto.LINUX.in @@ -61,6 +61,10 @@ DEFINES = $(COMMON_DEFINES) CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char DEFINES = $(COMMON_DEFINES) -D__s390__ + +CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char +DEFINES = $(COMMON_DEFINES) -D__s390x__ + LD = ld -m elf32_sparc CCFLAGS = $(COMMON_KERN_CFLAGS) -mcpu=v8 -mno-fpu -fcall-used-g5 -fcall-used-g7 @@ -152,6 +156,8 @@ ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}: ln -fs ${LINUX_KERNEL_PATH}/include/asm-x86_64 asm ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390 asm + + ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390x asm ln -fs ${LINUX_KERNEL_PATH}/include/asm-ppc asm diff --git a/src/lwp/Makefile.in b/src/lwp/Makefile.in index 0f39cc15f..2fc009713 100644 --- a/src/lwp/Makefile.in +++ b/src/lwp/Makefile.in @@ -44,8 +44,12 @@ process.o : process.s process.i386.s process.c $(CCOBJ) ${LWP_DBG} ${LWP_OPTMZ} -c -I${TOP_INCDIR} -KPIC -G0 ${srcdir}/process.s;; \ sgi_61 | sgi_62 | sgi_63 ) \ $(CCOBJ) ${LWP_DBG} ${LWP_OPTMZ} -c ${XCFLAGS} -I${TOP_INCDIR} -KPIC -G0 ${srcdir}/process.s;; \ - s390*) \ - /lib/cpp -P -I${TOP_INCDIR} ${srcdir}/process.s >process.ss; \ + s390_*) \ + /lib/cpp -P -I${TOP_INCDIR} ${srcdir}/process.s390.s >process.ss; \ + ${AS} -ahlns process.ss -o process.o >process.lst; \ + $(RM) process.ss ;; \ + s390x_*) \ + /lib/cpp -P -I${TOP_INCDIR} ${srcdir}/process.s390x.s >process.ss; \ ${AS} -ahlns process.ss -o process.o >process.lst; \ $(RM) process.ss ;; \ *_darwin* ) \ diff --git a/src/lwp/lwp.c b/src/lwp/lwp.c index 265ed8c19..06e3e1b49 100644 --- a/src/lwp/lwp.c +++ b/src/lwp/lwp.c @@ -73,6 +73,10 @@ extern char PRE_Block; /* from preempt.c */ #define MINFRAME 128 #define STACK_ALIGN 8 #else +#ifdef __s390x__ +#define MINFRAME 160 +#define STACK_ALIGN 8 +#else #ifdef __s390__ #define MINFRAME 96 #define STACK_ALIGN 8 @@ -80,6 +84,7 @@ extern char PRE_Block; /* from preempt.c */ #define STACK_ALIGN 4 #endif #endif +#endif /* Debugging macro */ #ifdef DEBUG diff --git a/src/lwp/process.s b/src/lwp/process.s index 223f2156c..586c27235 100644 --- a/src/lwp/process.s +++ b/src/lwp/process.s @@ -167,93 +167,6 @@ PRE_Block.S: .extern PRE_Block[ua] #endif /* RIOS */ -#if defined(AFS_S390_LINUX20_ENV) - /* Linux for S/390 (31 bit) - * - * Written by Neale Ferguson - * - * additional munging by Adam Thornton - */ - .file "process.s" - - .globl savecontext - .type savecontext,%function - /* - * savecontext(f, area1, newsp) - * int (*f)(); struct savearea *area1; char *newsp; - * f - r2 - * area1 - r3 - * newsp - r4 - */ - - /* - * struct savearea { - * char *topstack; - * } - */ - -P_PRE: .long PRE_Block -P_ABORT: .long abort - -savecontext: - stm %r6,%r15,24(%r15) /* Save our registers */ - lr %r1,%r15 - ahi %r15,-96 /* Move out of harm's way */ - st %r1,0(%r15) - bras %r5,.L0 /* Get A(A(PRE_Block)) */ - .long PRE_Block - .L0: - l %r5,0(%r5) /* Get A(PRE_Block) */ - mvi 3(%r5),1 /* Set it */ - lr %r6,%r3 /* Get base of savearea */ - st %r15,0(%r3) /* Save stack pointer */ - ltr %r4,%r4 /* If new sp is 0 */ - jz .L1 /* ... don't change sp */ - lr %r15,%r4 /* Set new stack pointer */ - .L1: - br %r2 /* Call the routine */ - /* Can't get here....*/ - - bras %r5,.L2 - .long abort - .L2: - l %r5,0(%r5) - balr %r14,%r5 - - .savecontext_end: - .size savecontext,.savecontext_end-savecontext - - /* - * returnto(area2) - * struct savearea *area2; - * - * area2 - r2 - */ - .globl returnto - .type returnto,%function -returnto: - l %r15,0(%r2) /* New frame, to get correct pointer*/ - bras %r5,.L3 /* Get A(A(PRE_Block)) - */ - .long PRE_Block - .L3: - l %r5,0(%r5) /* Get A(PRE_Block) */ - /*xc 0(4,%r5),0(%r5) /* Clear it */ - mvi 3(%r5),0 /* Clear it */ - l %r15,0(%r15) - lm %r6,%r15,24(%r15) /* Restore registers */ - br %r14 /* Return */ - - /* Can't happen */ - la %r2,1234 - bras %r5,.L4 - .long abort - .L4: - l %r5,0(%r5) - basr %r14,%r5 - .returnto_end: - .size returnto,.returnto_end-returnto -#endif /* AFS_S390_LINUX20_ENV */ #ifdef mc68000 /* diff --git a/src/lwp/process.s390.s b/src/lwp/process.s390.s new file mode 100644 index 000000000..660ec1f4a --- /dev/null +++ b/src/lwp/process.s390.s @@ -0,0 +1,98 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + * + * Linux for S/390 (31 bit) + * + * Written by Neale Ferguson + * + * additional munging by Adam Thornton + */ + +#define IGNORE_STDS_H 1 +#include + + .file "process.s" + + .globl savecontext + .type savecontext,%function + /* + * savecontext(f, area1, newsp) + * int (*f)(); struct savearea *area1; char *newsp; + * f - r2 + * area1 - r3 + * newsp - r4 + */ + + /* + * struct savearea { + * char *topstack; + * } + */ + +P_PRE: .long PRE_Block +P_ABORT: .long abort + +savecontext: + stm %r6,%r15,24(%r15) /* Save our registers */ + lr %r1,%r15 + ahi %r15,-96 /* Move out of harm's way */ + st %r1,0(%r15) + bras %r5,.L0 /* Get A(A(PRE_Block)) */ + .long PRE_Block + .L0: + l %r5,0(%r5) /* Get A(PRE_Block) */ + mvi 3(%r5),1 /* Set it */ + lr %r6,%r3 /* Get base of savearea */ + st %r15,0(%r3) /* Save stack pointer */ + ltr %r4,%r4 /* If new sp is 0 */ + jz .L1 /* ... don't change sp */ + lr %r15,%r4 /* Set new stack pointer */ + .L1: + br %r2 /* Call the routine */ + /* Can't get here....*/ + + bras %r5,.L2 + .long abort + .L2: + l %r5,0(%r5) + balr %r14,%r5 + + .savecontext_end: + .size savecontext,.savecontext_end-savecontext + + /* + * returnto(area2) + * struct savearea *area2; + * + * area2 - r2 + */ + .globl returnto + .type returnto,%function +returnto: + l %r15,0(%r2) /* New frame, to get correct pointer*/ + bras %r5,.L3 /* Get A(A(PRE_Block)) + */ + .long PRE_Block + .L3: + l %r5,0(%r5) /* Get A(PRE_Block) */ + /*xc 0(4,%r5),0(%r5) /* Clear it */ + mvi 3(%r5),0 /* Clear it */ + l %r15,0(%r15) + lm %r6,%r15,24(%r15) /* Restore registers */ + br %r14 /* Return */ + + /* Can't happen */ + la %r2,1234 + bras %r5,.L4 + .long abort + .L4: + l %r5,0(%r5) + basr %r14,%r5 + .returnto_end: + .size returnto,.returnto_end-returnto + diff --git a/src/lwp/process.s390x.s b/src/lwp/process.s390x.s new file mode 100644 index 000000000..e36b7cab0 --- /dev/null +++ b/src/lwp/process.s390x.s @@ -0,0 +1,98 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + * + * Linux for S/390X (64 bit) + * by Soewono Effendi + * & Horst Birthelmer + * + * based on Linux for S/390 (31 bit) + * Written by Neale Ferguson +*/ + +#define IGNORE_STDS_H 1 +#include + + .file "process.s" + + .globl savecontext + .type savecontext,%function + /* + * savecontext(f, area1, newsp) + * int (*f)(); struct savearea *area1; char *newsp; + * f - r2 + * area1 - r3 + * newsp - r4 + */ + + /* + * struct savearea { + * char *topstack; + * } + */ + +P_PRE: .long PRE_Block +P_ABORT: .long abort + +savecontext: + stmg %r6,%r15,48(%r15) /* Save our registers */ + lgr %r1,%r15 + aghi %r15,-160 + stg %r1,0(%r15) + brasl %r5,.L0 /* Get A(A(PRE_Block)) */ + .long PRE_Block + .L0: + l %r5,0(%r5) /* Get A(PRE_Block) */ + mvi 3(%r5),1 /* Set it */ + lgr %r6,%r3 /* Get base of savearea */ + stg %r15,0(%r3) /* Save stack pointer */ + ltgr %r4,%r4 /* If new sp is 0 */ + jz .L1 /* ... don't change sp */ + lgr %r15,%r4 /* Set new stack pointer */ + .L1: + br %r2 /* Call the routine */ + /* Can't get here....*/ + + brasl %r5,.L2 + .long abort + .L2: + l %r5,0(%r5) + balr %r14,%r5 + + .savecontext_end: + .size savecontext,.savecontext_end-savecontext + + /* + * returnto(area2) + * struct savearea *area2; + * + * area2 - r2 + */ + .globl returnto + .type returnto,%function +returnto: + lg %r15,0(%r2) /* New frame, to get correct pointer*/ + brasl %r5,.L3 /* Get A(A(PRE_Block)) */ + .long PRE_Block + .L3: + l %r5,0(%r5) /* Get A(PRE_Block) */ + /*xc 0(4,%r5),0(%r5) /* Clear it */ + mvi 3(%r5),0 /* Clear it */ + lg %r15,0(%r15) + lmg %r6,%r15,48(%r15) /* Restore registers */ + br %r14 /* Return */ + + /* Can't happen */ + la %r2,1234 + brasl %r5,.L4 + .long abort + .L4: + l %r5,0(%r5) + basr %r14,%r5 + .returnto_end: + .size returnto,.returnto_end-returnto + -- 2.39.5