Skip to contentSkip to conversation

s390 (16/16): s390/s390x unification - part 7.

PATCH New Martin Schwidefsky 1 participant 1 message Apr 14, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390 (16/16): s390/s390x unification - part 7.

Merge s390x and s390 to one architecture.

diffstat:

 posix_types.h |   47 ++-
 processor.h   |  162 +++++++++---
 ptrace.h      |  234 +++++++++++++-----
 qdio.h        |    4 
 rwsem.h       |   81 ++++++
 sembuf.h      |    6 
 setup.h       |   24 +
 shmbuf.h      |    8 
 sigcontext.h  |   21 +
 signal.h      |    6 
 sigp.h        |   28 ++
 smp.h         |    4 
 spinlock.h    |  100 +++++++
 stat.h        |   30 ++
 statfs.h      |   13 +
 string.h      |   53 +++-
 system.h      |  102 +++++++-
 thread_info.h |   28 +-
 tlbflush.h    |   12 
 types.h       |   28 +-
 uaccess.h     |  734 +++++++++++++++++++++++++++++++---------------------------
 unistd.h      |  109 +++++++-
 22 files changed, 1331 insertions(+), 503 deletions(-)
include/asm-s390/posix_types.h +34 -13
diff -urN linux-2.5.67/include/asm-s390/posix_types.h linux-2.5.67-s390/include/asm-s390/posix_types.h
@@ -15,18 +15,9 @@
  * assume GCC is being used.
  */
 
-typedef unsigned short  __kernel_dev_t;
-typedef unsigned long   __kernel_ino_t;
-typedef unsigned short  __kernel_mode_t;
-typedef unsigned short  __kernel_nlink_t;
 typedef long            __kernel_off_t;
 typedef int             __kernel_pid_t;
-typedef unsigned short  __kernel_ipc_pid_t;
-typedef unsigned short  __kernel_uid_t;
-typedef unsigned short  __kernel_gid_t;
 typedef unsigned long   __kernel_size_t;
-typedef int             __kernel_ssize_t;
-typedef int             __kernel_ptrdiff_t;
 typedef long            __kernel_time_t;
 typedef long            __kernel_suseconds_t;
 typedef long            __kernel_clock_t;
@@ -36,15 +27,45 @@
 typedef char *          __kernel_caddr_t;
 typedef unsigned short	__kernel_uid16_t;
 typedef unsigned short	__kernel_gid16_t;
+
+#ifdef __GNUC__
+typedef long long       __kernel_loff_t;
+#endif
+
+#ifndef __s390x__
+
+typedef unsigned short  __kernel_dev_t;
+typedef unsigned long   __kernel_ino_t;
+typedef unsigned short  __kernel_mode_t;
+typedef unsigned short  __kernel_nlink_t;
+typedef unsigned short  __kernel_ipc_pid_t;
+typedef unsigned short  __kernel_uid_t;
+typedef unsigned short  __kernel_gid_t;
+typedef int             __kernel_ssize_t;
+typedef int             __kernel_ptrdiff_t;
 typedef unsigned int	__kernel_uid32_t;
 typedef unsigned int	__kernel_gid32_t;
-
 typedef unsigned short	__kernel_old_uid_t;
 typedef unsigned short	__kernel_old_gid_t;
 
-#ifdef __GNUC__
-typedef long long       __kernel_loff_t;
-#endif
+#else /* __s390x__ */
+
+typedef unsigned int    __kernel_dev_t;
+typedef unsigned int    __kernel_ino_t;
+typedef unsigned int    __kernel_mode_t;
+typedef unsigned int    __kernel_nlink_t;
+typedef int             __kernel_ipc_pid_t;
+typedef unsigned int    __kernel_uid_t;
+typedef unsigned int    __kernel_gid_t;
+typedef long            __kernel_ssize_t;
+typedef long            __kernel_ptrdiff_t;
+typedef unsigned long   __kernel_sigset_t;      /* at least 32 bits */
+typedef __kernel_uid_t __kernel_old_uid_t;
+typedef __kernel_gid_t __kernel_old_gid_t;
+typedef __kernel_uid_t __kernel_uid32_t;
+typedef __kernel_gid_t __kernel_gid32_t;
+
+#endif /* __s390x__ */
 
 typedef struct {
 #if defined(__KERNEL__) || defined(__USE_ALL)
include/asm-s390/processor.h +126 -36

242 lines not on this page · raw message

include/asm-s390/ptrace.h +172 -62

364 lines not on this page · raw message

include/asm-s390/qdio.h +2 -2
diff -urN linux-2.5.67/include/asm-s390/qdio.h linux-2.5.67-s390/include/asm-s390/qdio.h
@@ -20,9 +20,9 @@
 
 #define QDIO_NAME "qdio "
 
-#ifndef CONFIG_ARCH_S390X
+#ifndef __s390x__
 #define QDIO_32_BIT
-#endif /* CONFIG_ARCH_S390X */
+#endif /* __s390x__ */
 
 /**** CONSTANTS, that are relied on without using these symbols *****/
 #define QDIO_MAX_QUEUES_PER_IRQ 32 /* used in width of unsigned int */
include/asm-s390/rwsem.h +81 -0

191 lines not on this page · raw message

include/asm-s390/sembuf.h +5 -1
diff -urN linux-2.5.67/include/asm-s390/sembuf.h linux-2.5.67-s390/include/asm-s390/sembuf.h
@@ -7,16 +7,20 @@
  * between kernel and user space.
  *
  * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
+ * - 64-bit time_t to solve y2038 problem (for !__s390x__)
  * - 2 miscellaneous 32-bit values
  */
 
 struct semid64_ds {
 	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
 	__kernel_time_t	sem_otime;		/* last semop time */
+#ifndef __s390x__
 	unsigned long	__unused1;
+#endif /* ! __s390x__ */
 	__kernel_time_t	sem_ctime;		/* last change time */
+#ifndef __s390x__
 	unsigned long	__unused2;
+#endif /* ! __s390x__ */
 	unsigned long	sem_nsems;		/* no. of semaphores in array */
 	unsigned long	__unused3;
 	unsigned long	__unused4;
include/asm-s390/setup.h +22 -2
diff -urN linux-2.5.67/include/asm-s390/setup.h linux-2.5.67-s390/include/asm-s390/setup.h
@@ -15,9 +15,15 @@
 
 #ifndef __ASSEMBLY__
 
+#ifndef __s390x__
 #define IPL_DEVICE        (*(unsigned long *)  (0x10404))
 #define INITRD_START      (*(unsigned long *)  (0x1040C))
 #define INITRD_SIZE       (*(unsigned long *)  (0x10414))
+#else /* __s390x__ */
+#define IPL_DEVICE        (*(unsigned long *)  (0x10400))
+#define INITRD_START      (*(unsigned long *)  (0x10408))
+#define INITRD_SIZE       (*(unsigned long *)  (0x10410))
+#endif /* __s390x__ */
 #define COMMAND_LINE      ((char *)            (0x10480))
 
 /*
@@ -26,10 +32,18 @@
 extern unsigned long machine_flags;
 
 #define MACHINE_IS_VM		(machine_flags & 1)
-#define MACHINE_HAS_IEEE	(machine_flags & 2)
 #define MACHINE_IS_P390		(machine_flags & 4)
-#define MACHINE_HAS_CSP		(machine_flags & 8)
 #define MACHINE_HAS_MVPG	(machine_flags & 16)
+#define MACHINE_HAS_DIAG44	(machine_flags & 32)
+
+#ifndef __s390x__
+#define MACHINE_HAS_IEEE	(machine_flags & 2)
+#define MACHINE_HAS_CSP		(machine_flags & 8)
+#else /* __s390x__ */
+#define MACHINE_HAS_IEEE	(1)
+#define MACHINE_HAS_CSP		(1)
+#endif /* __s390x__ */
+
 
 #define MACHINE_HAS_SCLP	(!MACHINE_IS_P390)
 
@@ -50,9 +64,15 @@
 
 #else 
 
+#ifndef __s390x__
 #define IPL_DEVICE        0x10404
 #define INITRD_START      0x1040C
 #define INITRD_SIZE       0x10414
+#else /* __s390x__ */
+#define IPL_DEVICE        0x10400
+#define INITRD_START      0x10408
+#define INITRD_SIZE       0x10410
+#endif /* __s390x__ */
 #define COMMAND_LINE      0x10480
 
 #endif
include/asm-s390/shmbuf.h +7 -1
diff -urN linux-2.5.67/include/asm-s390/shmbuf.h linux-2.5.67-s390/include/asm-s390/shmbuf.h
@@ -7,7 +7,7 @@
  * between kernel and user space.
  *
  * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
+ * - 64-bit time_t to solve y2038 problem (for !__s390x__)
  * - 2 miscellaneous 32-bit values
  */
 
@@ -15,11 +15,17 @@
 	struct ipc64_perm	shm_perm;	/* operation perms */
 	size_t			shm_segsz;	/* size of segment (bytes) */
 	__kernel_time_t		shm_atime;	/* last attach time */
+#ifndef __s390x__
 	unsigned long		__unused1;
+#endif /* ! __s390x__ */
 	__kernel_time_t		shm_dtime;	/* last detach time */
+#ifndef __s390x__
 	unsigned long		__unused2;
+#endif /* ! __s390x__ */
 	__kernel_time_t		shm_ctime;	/* last change time */
+#ifndef __s390x__
 	unsigned long		__unused3;
+#endif /* ! __s390x__ */
 	__kernel_pid_t		shm_cpid;	/* pid of creator */
 	__kernel_pid_t		shm_lpid;	/* pid of last operator */
 	unsigned long		shm_nattch;	/* no. of current attaches */
include/asm-s390/sigcontext.h +16 -5
diff -urN linux-2.5.67/include/asm-s390/sigcontext.h linux-2.5.67-s390/include/asm-s390/sigcontext.h
@@ -12,13 +12,24 @@
 #define __NUM_FPRS 16
 #define __NUM_ACRS 16
 
-/*
-  Has to be at least _NSIG_WORDS from asm/signal.h
- */
-#define _SIGCONTEXT_NSIG      64
-#define _SIGCONTEXT_NSIG_BPW  32
+#ifndef __s390x__
+
+/* Has to be at least _NSIG_WORDS from asm/signal.h */
+#define _SIGCONTEXT_NSIG	64
+#define _SIGCONTEXT_NSIG_BPW	32
 /* Size of stack frame allocated when calling signal handler. */
 #define __SIGNAL_FRAMESIZE	96
+
+#else /* __s390x__ */
+
+/* Has to be at least _NSIG_WORDS from asm/signal.h */
+#define _SIGCONTEXT_NSIG	64
+#define _SIGCONTEXT_NSIG_BPW	64 
+/* Size of stack frame allocated when calling signal handler. */
+#define __SIGNAL_FRAMESIZE	160
+
+#endif /* __s390x__ */
+
 #define _SIGCONTEXT_NSIG_WORDS	(_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW)
 #define _SIGMASK_COPY_SIZE	(sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS)
 
include/asm-s390/signal.h +6 -0
diff -urN linux-2.5.67/include/asm-s390/signal.h linux-2.5.67-s390/include/asm-s390/signal.h
@@ -171,9 +171,15 @@
           __sighandler_t _sa_handler;
           void (*_sa_sigaction)(int, struct siginfo *, void *);
         } _u;
+#ifndef __s390x__ /* lovely */
         sigset_t sa_mask;
         unsigned long sa_flags;
         void (*sa_restorer)(void);
+#else  /* __s390x__ */
+        unsigned long sa_flags;
+        void (*sa_restorer)(void);
+	sigset_t sa_mask;
+#endif /* __s390x__ */
 };
 
 #define sa_handler      _u._sa_handler
include/asm-s390/sigp.h +26 -2
diff -urN linux-2.5.67/include/asm-s390/sigp.h linux-2.5.67-s390/include/asm-s390/sigp.h
@@ -72,10 +72,17 @@
 	sigp_ccode ccode;
 
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"    sr     1,1\n"        /* parameter=0 in gpr 1 */
 		"    sigp   1,%1,0(%2)\n"
 		"    ipm    %0\n"
 		"    srl    %0,28\n"
+#else /* __s390x__ */
+		"    sgr    1,1\n"        /* parameter=0 in gpr 1 */
+		"    sigp   1,%1,0(%2)\n"
+		"    ipm    %0\n"
+		"    srl    %0,28"
+#endif /* __s390x__ */
 		: "=d" (ccode)
 		: "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
 		: "cc" , "memory", "1" );
@@ -86,15 +93,23 @@
  * Signal processor with parameter
  */
 extern __inline__ sigp_ccode
-signal_processor_p(__u32 parameter,__u16 cpu_addr,sigp_order_code order_code)
+signal_processor_p(unsigned long parameter,__u16 cpu_addr,
+		   sigp_order_code order_code)
 {
 	sigp_ccode ccode;
 	
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"    lr     1,%1\n"       /* parameter in gpr 1 */
 		"    sigp   1,%2,0(%3)\n"
 		"    ipm    %0\n"
 		"    srl    %0,28\n"
+#else /* __s390x__ */
+		"    lgr    1,%1\n"       /* parameter in gpr 1 */
+		"    sigp   1,%2,0(%3)\n"
+		"    ipm    %0\n"
+		"    srl    %0,28\n"
+#endif /* __s390x__ */
 		: "=d" (ccode)
 		: "d" (parameter), "d" (__cpu_logical_map[cpu_addr]),
                   "a" (order_code)
@@ -106,18 +121,27 @@
  * Signal processor with parameter and return status
  */
 extern __inline__ sigp_ccode
-signal_processor_ps(__u32 *statusptr, __u32 parameter,
+signal_processor_ps(__u32 *statusptr, unsigned long parameter,
 		    __u16 cpu_addr, sigp_order_code order_code)
 {
 	sigp_ccode ccode;
 	
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"    sr     2,2\n"        /* clear status so it doesn't contain rubbish if not saved. */
 		"    lr     3,%2\n"       /* parameter in gpr 3 */
 		"    sigp   2,%3,0(%4)\n"
 		"    st     2,%1\n"
 		"    ipm    %0\n"
 		"    srl    %0,28\n"
+#else /* __s390x__ */
+		"    sgr    2,2\n"        /* clear status so it doesn't contain rubbish if not saved. */
+		"    lgr    3,%2\n"       /* parameter in gpr 3 */
+		"    sigp   2,%3,0(%4)\n"
+		"    stg    2,%1\n"
+		"    ipm    %0\n"
+		"    srl    %0,28\n"
+#endif /* __s390x__ */
 		: "=d" (ccode), "=m" (*statusptr)
 		: "d" (parameter), "d" (__cpu_logical_map[cpu_addr]),
                   "a" (order_code)
include/asm-s390/smp.h +4 -0
diff -urN linux-2.5.67/include/asm-s390/smp.h linux-2.5.67-s390/include/asm-s390/smp.h
@@ -52,7 +52,11 @@
 
 extern inline unsigned int num_online_cpus(void)
 {
+#ifndef __s390x__
 	return hweight32(cpu_online_map);
+#else /* __s390x__ */
+	return hweight64(cpu_online_map);
+#endif /* __s390x__ */
 }
 
 extern inline int any_online_cpu(unsigned int mask)
include/asm-s390/spinlock.h +99 -1

172 lines not on this page · raw message

include/asm-s390/stat.h +28 -2
diff -urN linux-2.5.67/include/asm-s390/stat.h linux-2.5.67-s390/include/asm-s390/stat.h
@@ -9,6 +9,7 @@
 #ifndef _S390_STAT_H
 #define _S390_STAT_H
 
+#ifndef __s390x__
 struct __old_kernel_stat {
         unsigned short st_dev;
         unsigned short st_ino;
@@ -46,8 +47,6 @@
         unsigned long  __unused5;
 };
 
-#define STAT_HAVE_NSEC 1
-
 /* This matches struct stat64 in glibc2.1, hence the absolutely
  * insane amounts of padding around dev_t's.
  */
@@ -76,4 +75,31 @@
         unsigned long long	st_ino;
 };
 
+#else /* __s390x__ */
+
+struct stat {
+        unsigned long  st_dev;
+        unsigned long  st_ino;
+        unsigned long  st_nlink;
+        unsigned int   st_mode;
+        unsigned int   st_uid;
+        unsigned int   st_gid;
+        unsigned int   __pad1;
+        unsigned long  st_rdev;
+        unsigned long  st_size;
+        unsigned long  st_atime;
+	unsigned long  st_atime_nsec;
+        unsigned long  st_mtime;
+	unsigned long  st_mtime_nsec;
+        unsigned long  st_ctime;
+	unsigned long  st_ctime_nsec;
+        unsigned long  st_blksize;
+        long           st_blocks;
+        unsigned long  __unused[3];
+};
+
+#endif /* __s390x__ */
+
+#define STAT_HAVE_NSEC 1
+
 #endif
include/asm-s390/statfs.h +13 -0
diff -urN linux-2.5.67/include/asm-s390/statfs.h linux-2.5.67-s390/include/asm-s390/statfs.h
@@ -18,6 +18,7 @@
 #endif
 
 struct statfs {
+#ifndef __s390x__
 	long f_type;
 	long f_bsize;
 	long f_blocks;
@@ -28,6 +29,18 @@
 	__kernel_fsid_t f_fsid;
 	long f_namelen;
 	long f_spare[6];
+#else /* __s390x__ */
+	int  f_type;
+	int  f_bsize;
+	long f_blocks;
+	long f_bfree;
+	long f_bavail;
+	long f_files;
+	long f_ffree;
+	__kernel_fsid_t f_fsid;
+	int  f_namelen;
+	int  f_spare[6];
+#endif /* __s390x__ */
 };
 
 #endif
include/asm-s390/string.h +43 -10

102 lines not on this page · raw message

include/asm-s390/system.h +96 -6

158 lines not on this page · raw message

include/asm-s390/thread_info.h +20 -8
diff -urN linux-2.5.67/include/asm-s390/thread_info.h linux-2.5.67-s390/include/asm-s390/thread_info.h
@@ -13,6 +13,7 @@
 
 #ifndef __ASSEMBLY__
 #include <asm/processor.h>
+#include <asm/lowcore.h>
 
 /*
  * low level task data that entry.S needs immediate access to
@@ -46,27 +47,36 @@
 #define init_thread_info	(init_thread_union.thread_info)
 #define init_stack		(init_thread_union.stack)
 
+/*
+ * Size of kernel stack for each process
+ */
+#ifndef __s390x__
+#define THREAD_ORDER 1
+#define ASYNC_ORDER  1
+#else /* __s390x__ */
+#define THREAD_ORDER 2
+#define ASYNC_ORDER  2
+#endif /* __s390x__ */
+
+#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
+#define ASYNC_SIZE  (PAGE_SIZE << ASYNC_ORDER)
+
 /* how to get the thread information struct from C */
 static inline struct thread_info *current_thread_info(void)
 {
-	return (struct thread_info *)((*(unsigned long *) 0xc40)-8192);
+	return (struct thread_info *)((*(unsigned long *) __LC_KERNEL_STACK)-THREAD_SIZE);
 }
 
 /* thread information allocation */
 #define alloc_thread_info() ((struct thread_info *) \
-	__get_free_pages(GFP_KERNEL,1))
-#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
+	__get_free_pages(GFP_KERNEL,THREAD_ORDER))
+#define free_thread_info(ti) free_pages((unsigned long) (ti),THREAD_ORDER)
 #define get_thread_info(ti) get_task_struct((ti)->task)
 #define put_thread_info(ti) put_task_struct((ti)->task)
 
 #endif
 
 /*
- * Size of kernel stack for each process
- */
-#define THREAD_SIZE (2*PAGE_SIZE)
-
-/*
  * thread information flags bit numbers
  */
 #define TIF_SYSCALL_TRACE	0	/* syscall trace active */
@@ -77,6 +87,7 @@
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling 
 					   TIF_NEED_RESCHED */
+#define TIF_31BIT		18	/* 32bit process */ 
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
@@ -85,6 +96,7 @@
 #define _TIF_RESTART_SVC	(1<<TIF_RESTART_SVC)
 #define _TIF_USEDFPU		(1<<TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
+#define _TIF_31BIT		(1<<TIF_31BIT)
 
 #endif /* __KERNEL__ */
 
include/asm-s390/tlbflush.h +8 -4
diff -urN linux-2.5.67/include/asm-s390/tlbflush.h linux-2.5.67-s390/include/asm-s390/tlbflush.h
@@ -28,7 +28,6 @@
 #define local_flush_tlb() \
 do {  __asm__ __volatile__("ptlb": : :"memory"); } while (0)
 
-
 #ifndef CONFIG_SMP
 
 /*
@@ -70,7 +69,13 @@
 
 static inline void global_flush_tlb(void)
 {
-	if (MACHINE_HAS_CSP) {
+#ifndef __s390x__
+	if (!MACHINE_HAS_CSP) {
+		smp_ptlb_all();
+		return;
+	}
+#endif /* __s390x__ */
+	{
 		long dummy = 0;
 		__asm__ __volatile__ (
 			"    la   4,1(%0)\n"
@@ -78,8 +83,7 @@
 			"    slr  3,3\n"
 			"    csp  2,4"
 			: : "a" (&dummy) : "cc", "2", "3", "4" );
-	} else
-		smp_ptlb_all();
+	}
 }
 
 /*
include/asm-s390/types.h +22 -6
diff -urN linux-2.5.67/include/asm-s390/types.h linux-2.5.67-s390/include/asm-s390/types.h
@@ -27,15 +27,21 @@
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
+#ifndef __s390x__
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
 typedef __signed__ long long __s64;
 typedef unsigned long long __u64;
 #endif
+#else /* __s390x__ */
+typedef __signed__ long __s64;
+typedef unsigned long __u64;
+#endif
+
 /* A address type so that arithmetic can be done on it & it can be upgraded to
    64 bit when necessary 
 */
-typedef __u32  addr_t; 
-typedef __s32  saddr_t;
+typedef unsigned long addr_t; 
+typedef __signed__ long saddr_t;
 
 #endif /* __ASSEMBLY__ */
 
@@ -44,7 +50,11 @@
  */
 #ifdef __KERNEL__
 
+#ifndef __s390x__
 #define BITS_PER_LONG 32
+#else
+#define BITS_PER_LONG 64
+#endif
 
 #ifndef __ASSEMBLY__
 
@@ -57,11 +67,17 @@
 typedef signed int s32;
 typedef unsigned int u32;
 
+#ifndef __s390x__
 typedef signed long long s64;
 typedef unsigned long long u64;
+#else /* __s390x__ */
+typedef signed long s64;
+typedef unsigned  long u64;
+#endif /* __s390x__ */
 
 typedef u32 dma_addr_t;
 
+#ifndef __s390x__
 typedef union {
 	unsigned long long pair;
 	struct {
@@ -75,7 +91,7 @@
 #define HAVE_SECTOR_T
 #endif
 
-#endif /* __ASSEMBLY__ */
-
-#endif                                 /* __KERNEL__                       */
-#endif
+#endif /* ! __s390x__   */
+#endif /* __ASSEMBLY__  */
+#endif /* __KERNEL__    */
+#endif /* _S390_TYPES_H */
include/asm-s390/uaccess.h +404 -330

790 lines not on this page · raw message

include/asm-s390/unistd.h +97 -12

163 lines not on this page · raw message