+2002-10-07 Michal Ludvig <mludvig@suse.cz>
+
+ Merged s390x port by Heiko Carstens <Heiko.Carstens@de.ibm.com>
+ and bugfixes to s390 by D.J. Barrow.
+
2002-09-23 Michal Ludvig <mludvig@suse.cz>
Merged x86-64 port by Andi Kleen <ak@suse.de>
-I$(srcdir)/$(OS)
SUBDIRS = $(OSARCH)
-ALL_SUBDIRS = test linux linux/alpha linux/powerpc sunos4 svr4 freebsd/i386
+ALL_SUBDIRS = test linux linux/alpha linux/powerpc sunos4 svr4 \
+ linux/s390 linux/s390x freebsd/i386
OBJ = strace.o version.o syscall.o util.o desc.o file.o ipc.o \
io.o ioctl.o mem.o net.o process.o bjm.o \
resource.o signal.o sock.o system.o term.o time.o \
/* Define if this is a x86-64 architecture. */
#undef X86_64
+/* Define if this is a S390X architecture. */
+#undef S390X
+
/* Define if you have a SVR4 MP type procfs. I.E. /dev/xxx/ctl,
/dev/xxx/status. Also implies that you have the pr_lwp
member in prstatus. */
basic_machine=a29k-amd
os=-udi
;;
+ s390)
+ basic_machine=s390-ibm
+ ;;
+ s390x)
+ basic_machine=s390x-ibm
+ ;;
sequent)
basic_machine=i386-sequent
;;
s390)
arch=s390
;;
+s390x)
+ arch=s390x
+ ;;
hppa*|parisc*)
arch=hppa
;;
# Autoheader trick. Heh, heh.
arch_list='
-@@@syms="$syms I386 IA64 M68K SPARC MIPS ALPHA ARM POWERPC S390 HPPA SH X86_64"@@@
+@@@syms="$syms I386 IA64 M68K SPARC MIPS ALPHA ARM POWERPC S390 S390X HPPA SH X86_64"@@@
'
osarch="$opsys"
#include <linux/types.h>
#include <linux/dirent.h>
#undef dirent
+#undef dirent64
#else
#define kernel_dirent dirent
#endif
}
#endif /* HAVE_STAT64 */
-#if defined(LINUX) && !defined(IA64) && !defined(HPPA) && !defined(X86_64)
+#if defined(LINUX) && !defined(IA64) && !defined(HPPA) && !defined(X86_64) \
+ && !defined(S390) && !defined(S390X)
static void
convertoldstat(oldbuf, newbuf)
const struct __old_kernel_stat *oldbuf;
convertoldstat(&statbuf, &newstatbuf);
realprintstat(tcp, &newstatbuf);
}
-#endif /* LINUX && !IA64 */
+#endif /* LINUX && !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
#ifndef HAVE_LONG_LONG_OFF_T
int
}
#ifdef LINUX
-# if !defined(IA64) && !defined(HPPA) && !defined(X86_64)
+# if !defined(IA64) && !defined(HPPA) && !defined(X86_64) \
+ && !defined(S390) && !defined(S390X)
int
sys_oldstat(tcp)
struct tcb *tcp;
}
#ifdef LINUX
-# if !defined(IA64) && !defined(HPPA) && !defined(X86_64)
+# if !defined(IA64) && !defined(HPPA) && !defined(X86_64) \
+ && !defined(S390) && !defined(S390X)
int
sys_oldfstat(tcp)
struct tcb *tcp;
}
return 0;
}
-# endif /* !IA64 && !HPPA*/
+# endif /* !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
#endif
#ifndef HAVE_LONG_LONG_OFF_T
}
#ifdef LINUX
-# if !defined(IA64) && !defined(HPPA) && !defined(X86_64)
+# if !defined(IA64) && !defined(HPPA) && !defined(X86_64) \
+ && !defined(S390) && !defined(S390X)
int
sys_oldlstat(tcp)
struct tcb *tcp;
}
return 0;
}
-# endif /* !IA64 && !HPPA */
+# endif /* !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
#endif
/* new ones */
int sys_query_module();
int sys_poll();
+int sys_mincore();
/* architecture-specific calls */
#ifdef ALPHA
# undef SYS_sendmsg
# undef SYS_recvmsg
#endif /* IA64 */
-#ifdef POWERPC
+#if defined(POWERPC) || defined(S390) || defined(S390X)
# define SYS_socket_subcall 256
#else
# define SYS_socket_subcall 230
-#endif
+#endif /* (POWERPC || S390 || S390X) */
#define SYS_socket (SYS_socket_subcall + 1)
#define SYS_bind (SYS_socket_subcall + 2)
#define SYS_connect (SYS_socket_subcall + 3)
# undef SYS_shmget
# undef SYS_shmctl
# endif /* IA64 */
-#ifdef POWERPC
+#if defined(POWERPC) || defined(S390) || defined(S390X)
# define SYS_ipc_subcall ((SYS_socket_subcall)+(SYS_socket_nsubcalls))
#else
# define SYS_ipc_subcall 250
-#endif
+#endif /* (POWERPC || S390 || S390X) */
#define SYS_semop (SYS_ipc_subcall + 1)
#define SYS_semget (SYS_ipc_subcall + 2)
#define SYS_semctl (SYS_ipc_subcall + 3)
#elif defined(POWERPC)
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*PT_R0), new) < 0)
return -1;
-#elif defined(S390)
- long pc;
- if (upeek(tcp->pid, PT_PSWADDR,&pc)<0)
- return -1;
- if (ptrace(PTRACE_POKETEXT, tcp->pid, (char*)(pc-4), new)<0)
- return -1;
+#elif defined(S390) || defined(S390X)
+ /* s390 linux after 2.4.7 has a hook in entry.S to allow this */
+ if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GPR2), new)<0)
+ return -1;
return 0;
#elif defined(M68K)
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*PT_ORIG_D0), new)<0)
if (errno)
return -1;
}
+#elif defined(S390) || defined(S390X)
+ {
+ if(argnum <= 5)
+ ptrace(PTRACE_POKEUSER, tcp->pid,
+ (char *) (argnum==0 ? PT_ORIGGPR2 :
+ PT_GPR2 + argnum*sizeof(long)),
+ tcp->u_arg[argnum]);
+ else
+ return -E2BIG;
+ if (errno)
+ return -1;
+ }
#else
# warning Sorry, setargs not implemented for this architecture.
#endif
#endif /* !SUNOS4_KERNEL_ARCH_KLUDGE */
struct xlat struct_user_offsets[] = {
#ifdef LINUX
-#ifdef S390
+#if defined(S390) || defined(S390X)
{ PT_PSWMASK, "psw_mask" },
{ PT_PSWADDR, "psw_addr" },
{ PT_GPR0, "gpr0" },
{ PT_ACR15, "acr15" },
{ PT_ORIGGPR2, "orig_gpr2" },
{ PT_FPC, "fpc" },
+#if defined(S390)
{ PT_FPR0_HI, "fpr0.hi" },
{ PT_FPR0_LO, "fpr0.lo" },
{ PT_FPR1_HI, "fpr1.hi" },
{ PT_FPR14_LO, "fpr14.lo" },
{ PT_FPR15_HI, "fpr15.hi" },
{ PT_FPR15_LO, "fpr15.lo" },
+#endif
+#if defined(S390X)
+ { PT_FPR0, "fpr0" },
+ { PT_FPR1, "fpr1" },
+ { PT_FPR2, "fpr2" },
+ { PT_FPR3, "fpr3" },
+ { PT_FPR4, "fpr4" },
+ { PT_FPR5, "fpr5" },
+ { PT_FPR6, "fpr6" },
+ { PT_FPR7, "fpr7" },
+ { PT_FPR8, "fpr8" },
+ { PT_FPR9, "fpr9" },
+ { PT_FPR10, "fpr10" },
+ { PT_FPR11, "fpr11" },
+ { PT_FPR12, "fpr12" },
+ { PT_FPR13, "fpr13" },
+ { PT_FPR14, "fpr14" },
+ { PT_FPR15, "fpr15" },
+#endif
{ PT_CR_9, "cr9" },
{ PT_CR_10, "cr10" },
{ PT_CR_11, "cr11" },
+ { PT_IEEE_IP, "ieee_exception_ip" },
#endif
#if defined(SPARC)
/* XXX No support for these offsets yet. */
{ 4*REG_FPSCR, "4*REG_FPSCR" },
#endif /* SH */
-#if !defined(S390) && !defined(MIPS)
+#if !defined(S390) && !defined(S390X) && !defined(MIPS)
{ uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
#endif
#if defined(I386) || defined(X86_64)
{ uoff(start_code), "offsetof(struct user, start_code)" },
{ uoff(start_stack), "offsetof(struct user, start_stack)" },
{ uoff(signal), "offsetof(struct user, signal)" },
-#if !defined(S390) && !defined(MIPS) && !defined(SH)
+#if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SH)
{ uoff(reserved), "offsetof(struct user, reserved)" },
#endif
{ uoff(u_ar0), "offsetof(struct user, u_ar0)" },
-#if !defined(ARM) && !defined(MIPS) && !defined(S390)
+#if !defined(ARM) && !defined(MIPS) && !defined(S390) && !defined(S390X)
{ uoff(u_fpstate), "offsetof(struct user, u_fpstate)" },
#endif
{ uoff(magic), "offsetof(struct user, magic)" },
sys_sigreturn(tcp)
struct tcb *tcp;
{
-#ifdef S390
+#if defined(S390) || defined(S390X)
long usp;
struct sigcontext_struct sc;
tcp->u_rval = tcp->u_error = 0;
if (tcp->u_arg[0] == 0)
return 0;
- tcp->auxstr = sprintsigmask("mask now ",(sigset_t *)&tcp->u_arg[1]);
+ tcp->auxstr = sprintsigmask("mask now ",(sigset_t *)&tcp->u_arg[1],0);
return RVAL_NONE | RVAL_STR;
}
return 0;
break;
#endif /* SI_GETUDATA */
default:
- printstr(tcp, (int) si.ic_dp, si.ic_len);
+ printstr(tcp, (long) si.ic_dp, si.ic_len);
break;
}
if (exiting(tcp)) {
int nsubcalls;
enum subcall_style style;
{
- int i, addr, mask, arg;
+ long addr, mask, arg;
+ int i;
switch (style) {
case shift_style:
#elif defined(MIPS)
static long a3;
static long r2;
-#elif defined(S390)
+#elif defined(S390) || defined(S390X)
static long gpr2;
static long pc;
#elif defined(HPPA)
#endif /* !PROCFS */
#ifdef LINUX
-#if defined(S390)
- if (upeek(tcp->pid,PT_PSWADDR,&pc) < 0)
+#if defined(S390) || defined(S390X)
+ if (upeek(pid,PT_PSWADDR,&pc) < 0)
return -1;
- scno = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)(pc-4),0);
+ scno = ptrace(PTRACE_PEEKTEXT, pid, (char *)(pc-sizeof(long)),0);
if (errno)
return -1;
scno&=0xFF;
fprintf(stderr, "stray syscall exit: rax = %ld\n", rax);
return 0;
}
-#elif defined (S390)
+#elif defined (S390) || defined (S390X)
if (upeek(pid, PT_GPR2, &gpr2) < 0)
return -1;
if (gpr2 != -ENOSYS && !(tcp->flags & TCB_INSYSCALL)) {
{
int u_error = 0;
#ifdef LINUX
-#ifdef S390
+#if defined(S390) || defined(S390X)
if (gpr2 && (unsigned) -gpr2 < nerrnos) {
tcp->u_rval = -1;
u_error = -gpr2;
tcp->u_rval = gpr2;
u_error = 0;
}
-#else /* !S390 */
+#else /* !S390 && !S390X */
#ifdef I386
if (eax < 0 && -eax < nerrnos) {
tcp->u_rval = -1;
#endif /* IA64 */
#endif /* X86_64 */
#endif /* I386 */
-#endif /* S390 */
+#endif /* S390 || S390X */
#endif /* LINUX */
#ifdef SUNOS4
/* get error code from user struct */
int pid = tcp->pid;
#endif /* !USE_PROCFS */
#ifdef LINUX
-#if defined(S390)
+#if defined(S390) || defined(S390X)
{
int i;
if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
else
tcp->u_nargs = MAX_ARGS;
for (i = 0; i < tcp->u_nargs; i++) {
- if (upeek(pid,i==0 ? PT_ORIGGPR2:PT_GPR2+(i<<2), &tcp->u_arg[i]) < 0)
+ if (upeek(pid,i==0 ? PT_ORIGGPR2:PT_GPR2+i*sizeof(long), &tcp->u_arg[i]) < 0)
return -1;
}
}
if (ptrace(PTRACE_GETREGS,tcp->pid,(char *)®s,0) < 0)
return -1;
pc = regs.r_pc;
-#elif defined(S390)
+#elif defined(S390) || defined(S390X)
if(upeek(tcp->pid,PT_PSWADDR,&pc) < 0)
+ return -1;
#elif defined(HPPA)
if(upeek(tcp->pid,PT_IAOQ0,&pc) < 0)
return -1;
#define LOOP 0x1000ffff
#elif defined(S390)
#define LOOP 0xa7f40000 /* BRC 15,0 */
+#elif defined(S390X)
+#define LOOP 0xa7f4000000000000UL /* BRC 15,0 */
#elif defined(HPPA)
#define LOOP 0xe81f1ff7 /* b,l,n <loc>,r0 */
#elif defined(SH)
#elif defined (POWERPC)
if (upeek(tcp->pid, 4*PT_NIP, &tcp->baddr) < 0)
return -1;
-#elif defined(S390)
+#elif defined(S390) || defined(S390X)
if (upeek(tcp->pid,PT_PSWADDR, &tcp->baddr) < 0)
return -1;
#elif defined(HPPA)