2003-02-26 Stuart Menefy <stuart.menefy@st.com>
Various fixes for SuperH [SH]:
* mem.c(sys_old_mmap): mmap() parameters passed in registers
* net.c(sys_pipe), syscall.c(getrval2): pipe() results returned
in registers
* process.c (change_syscall): Fixed register which holds system
call number
* util.c (arg0_offset, arg1_offset): provide definition
* Makefile.am: Added new files in linux/sh
* linux/sh/{syscallent,errnoent,ioctlent,signalent}.h: New files
diff --git a/Makefile.am b/Makefile.am
index 1272c7c..5e5f4ae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,6 +42,8 @@
linux/s390/signalent.h linux/s390/syscallent.h \
linux/s390x/errnoent.h linux/s390x/ioctlent.h \
linux/s390x/signalent.h linux/s390x/syscallent.h \
+ linux/sh/syscallent.h linux/sh/errnoent.h \
+ linux/sh/ioctlent.h linux/sh/signalent.h \
linux/sparc/dummy2.h \
linux/sparc/errnoent.h linux/sparc/errnoent1.h \
linux/sparc/ioctlent.h linux/sparc/ioctlent1.h \
diff --git a/process.c b/process.c
index 1b69d21..aeb3377 100644
--- a/process.c
+++ b/process.c
@@ -658,7 +658,7 @@
return -1;
return 0;
#elif defined(SH)
- if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_SYSCALL), new)<0)
+ if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*(REG_REG0+3)), new)<0)
return -1;
return 0;
#else
diff --git a/util.c b/util.c
index 8343e24..a3cde44 100644
--- a/util.c
+++ b/util.c
@@ -1223,10 +1223,13 @@
# elif defined (X86_64)
# define arg0_offset ((long)(8*(current_personality ? RBX : RDI)))
# define arg1_offset ((long)(8*(current_personality ? RCX : RSI)))
+# elif defined (SH)
+# define arg0_offset (4*(REG_REG0+4))
+# define arg1_offset (4*(REG_REG0+5))
# else
# define arg0_offset 0
# define arg1_offset 4
-# if defined SH || defined ARM
+# if defined ARM
# define restore_arg0(tcp, state, val) 0
# endif
# endif