[1/4] C-SKY: fix sigcontext miss match
diff mbox series

Message ID edbba2b7bdb7bb93dd1be5e068c6af81f845da8f.1551922357.git.han_mao@c-sky.com
State New
Headers show
Series
  • [1/4] C-SKY: fix sigcontext miss match
Related show

Commit Message

Mao Han March 7, 2019, 1:34 a.m. UTC
C-SKY defines SIGCONTEXT as siginfo_t *_si, struct ucontext_t * for
__profil_counter.  ucontext_t get an extra __mask field which is miss
match with the struct sigcontext from linux kernel.  The time value
from gprof report will be always zero without this patch.  This
patch also fix the registers sequence in register-dump.h.

	* sysdeps/unix/sysv/linux/csky/register-dump.h: Adjust offset change.
	* sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Remove __mask field
	in mcontext_t
---
 ChangeLog                                    |   6 ++
 sysdeps/unix/sysv/linux/csky/register-dump.h | 127 +++++++++++++--------------
 sysdeps/unix/sysv/linux/csky/sys/ucontext.h  |   1 -
 3 files changed, 68 insertions(+), 66 deletions(-)

Comments

Mao Han March 11, 2019, 2:59 a.m. UTC | #1
On Thu, Mar 07, 2019 at 09:34:03AM +0800, Mao Han wrote:
> C-SKY defines SIGCONTEXT as siginfo_t *_si, struct ucontext_t * for
> __profil_counter.  ucontext_t get an extra __mask field which is miss
> match with the struct sigcontext from linux kernel.  The time value
> from gprof report will be always zero without this patch.  This
> patch also fix the registers sequence in register-dump.h.
> 
> 	* sysdeps/unix/sysv/linux/csky/register-dump.h: Adjust offset change.
> 	* sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Remove __mask field
> 	in mcontext_t
> ---
>  ChangeLog                                    |   6 ++
>  sysdeps/unix/sysv/linux/csky/register-dump.h | 127 +++++++++++++--------------
>  sysdeps/unix/sysv/linux/csky/sys/ucontext.h  |   1 -
>  3 files changed, 68 insertions(+), 66 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 53c5d2f..dba3547 100644

Committed.  Tested on C-SKY.

Patch
diff mbox series

diff --git a/ChangeLog b/ChangeLog
index 53c5d2f..dba3547 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@ 
+2019-02-15  Mao Han  <han_mao@c-sky.com>
+
+	* sysdeps/unix/sysv/linux/csky/register-dump.h: Adjust offset change.
+	* sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Remove __mask field
+	in mcontext_t
+
 2019-03-05  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* nptl/nptl-init.c (__have_futex_clock_realtime,
diff --git a/sysdeps/unix/sysv/linux/csky/register-dump.h b/sysdeps/unix/sysv/linux/csky/register-dump.h
index 003d105..9496189 100644
--- a/sysdeps/unix/sysv/linux/csky/register-dump.h
+++ b/sysdeps/unix/sysv/linux/csky/register-dump.h
@@ -76,37 +76,36 @@  register_dump (int fd, const struct ucontext_t *ctx)
   hexvalue (ctx->uc_mcontext.__gregs.__pc, regs[1], 8);
   hexvalue (ctx->uc_mcontext.__gregs.__usp, regs[2], 8);
   hexvalue (ctx->uc_mcontext.__gregs.__lr, regs[3], 8);
-  hexvalue (ctx->uc_mcontext.__mask, regs[4], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__a0, regs[5], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__a1, regs[6], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__a2, regs[7], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__a3, regs[8], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__regs[0], regs[9], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__regs[1], regs[10], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__regs[2], regs[11], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__regs[3], regs[12], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__regs[4], regs[13], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__regs[5], regs[14], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__regs[6], regs[15], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__regs[7], regs[16], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__regs[8], regs[17], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__regs[9], regs[18], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[0], regs[19], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[1], regs[20], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[2], regs[21], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[3], regs[22], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[4], regs[23], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[5], regs[24], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[6], regs[25], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[7], regs[26], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[8], regs[27], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[9], regs[28], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[10], regs[29], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[11], regs[30], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[12], regs[31], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[13], regs[32], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__exregs[14], regs[33], 8);
-  hexvalue (ctx->uc_mcontext.__gregs.__tls, regs[34], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__a0, regs[4], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__a1, regs[5], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__a2, regs[6], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__a3, regs[7], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__regs[0], regs[8], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__regs[1], regs[9], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__regs[2], regs[10], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__regs[3], regs[11], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__regs[4], regs[12], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__regs[5], regs[13], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__regs[6], regs[14], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__regs[7], regs[15], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__regs[8], regs[16], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__regs[9], regs[17], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[0], regs[18], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[1], regs[19], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[2], regs[20], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[3], regs[21], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[4], regs[22], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[5], regs[23], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[6], regs[24], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[7], regs[25], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[8], regs[26], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[9], regs[27], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[10], regs[28], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[11], regs[29], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[12], regs[30], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[13], regs[31], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__exregs[14], regs[32], 8);
+  hexvalue (ctx->uc_mcontext.__gregs.__tls, regs[33], 8);
 
   /* Generate the output.  */
   ADD_STRING ("Register dump:\n\n PSR: ");
@@ -117,72 +116,70 @@  register_dump (int fd, const struct ucontext_t *ctx)
   ADD_MEM (regs[2], 8);
   ADD_STRING ("   LR: ");
   ADD_MEM (regs[3], 8);
-  ADD_STRING ("\n MASK: ");
-  ADD_MEM (regs[4], 8);
   ADD_STRING ("\n\n A0: ");
-  ADD_MEM (regs[5], 8);
+  ADD_MEM (regs[4], 8);
   ADD_STRING ("   A1: ");
-  ADD_MEM (regs[6], 8);
+  ADD_MEM (regs[5], 8);
   ADD_STRING ("   A2: ");
-  ADD_MEM (regs[7], 8);
+  ADD_MEM (regs[6], 8);
   ADD_STRING ("   A3: ");
-  ADD_MEM (regs[8], 8);
+  ADD_MEM (regs[7], 8);
   ADD_STRING ("\n R4: ");
+  ADD_MEM (regs[8], 8);
+  ADD_STRING ("   R5: ");
   ADD_MEM (regs[9], 8);
-  ADD_STRING ("   r5: ");
+  ADD_STRING ("   R6: ");
   ADD_MEM (regs[10], 8);
-  ADD_STRING ("   r6: ");
+  ADD_STRING ("   R7: ");
   ADD_MEM (regs[11], 8);
-  ADD_STRING ("   r7: ");
-  ADD_MEM (regs[12], 8);
   ADD_STRING ("\n R8: ");
-  ADD_MEM (regs[13], 8);
+  ADD_MEM (regs[12], 8);
   ADD_STRING ("   R9: ");
-  ADD_MEM (regs[14], 8);
+  ADD_MEM (regs[13], 8);
   ADD_STRING ("   R10: ");
-  ADD_MEM (regs[15], 8);
+  ADD_MEM (regs[14], 8);
   ADD_STRING ("  R11: ");
-  ADD_MEM (regs[16], 8);
+  ADD_MEM (regs[15], 8);
   ADD_STRING ("\n R12: ");
-  ADD_MEM (regs[17], 8);
+  ADD_MEM (regs[16], 8);
   ADD_STRING ("  R13: ");
-  ADD_MEM (regs[18], 8);
+  ADD_MEM (regs[17], 8);
   ADD_STRING ("  R14: ");
-  ADD_MEM (regs[19], 8);
+  ADD_MEM (regs[2], 8);
   ADD_STRING ("  R15: ");
-  ADD_MEM (regs[20], 8);
+  ADD_MEM (regs[3], 8);
   ADD_STRING ("\n R16: ");
-  ADD_MEM (regs[21], 8);
+  ADD_MEM (regs[18], 8);
   ADD_STRING ("  R17: ");
-  ADD_MEM (regs[22], 8);
+  ADD_MEM (regs[19], 8);
   ADD_STRING ("  R18: ");
-  ADD_MEM (regs[23], 8);
+  ADD_MEM (regs[20], 8);
   ADD_STRING ("  R19: ");
-  ADD_MEM (regs[24], 8);
+  ADD_MEM (regs[21], 8);
   ADD_STRING ("\n R20: ");
-  ADD_MEM (regs[25], 8);
+  ADD_MEM (regs[22], 8);
   ADD_STRING ("  R21: ");
-  ADD_MEM (regs[26], 8);
+  ADD_MEM (regs[23], 8);
   ADD_STRING ("  R22: ");
-  ADD_MEM (regs[27], 8);
+  ADD_MEM (regs[24], 8);
   ADD_STRING ("  R23: ");
-  ADD_MEM (regs[28], 8);
+  ADD_MEM (regs[25], 8);
   ADD_STRING ("\n R24: ");
-  ADD_MEM (regs[29], 8);
+  ADD_MEM (regs[26], 8);
   ADD_STRING ("  R25: ");
-  ADD_MEM (regs[30], 8);
+  ADD_MEM (regs[27], 8);
   ADD_STRING ("  R26: ");
-  ADD_MEM (regs[31], 8);
+  ADD_MEM (regs[28], 8);
   ADD_STRING ("  R27: ");
-  ADD_MEM (regs[32], 8);
+  ADD_MEM (regs[29], 8);
   ADD_STRING ("\n R28: ");
-  ADD_MEM (regs[33], 8);
+  ADD_MEM (regs[30], 8);
   ADD_STRING ("  R29: ");
-  ADD_MEM (regs[34], 8);
+  ADD_MEM (regs[31], 8);
   ADD_STRING ("  R30: ");
+  ADD_MEM (regs[32], 8);
+  ADD_STRING ("  R31: ");
   ADD_MEM (regs[33], 8);
-  ADD_STRING ("  TP: ");
-  ADD_MEM (regs[34], 8);
 
   ADD_STRING ("\n");
 
diff --git a/sysdeps/unix/sysv/linux/csky/sys/ucontext.h b/sysdeps/unix/sysv/linux/csky/sys/ucontext.h
index b4b277a..5eac9e6 100644
--- a/sysdeps/unix/sysv/linux/csky/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/csky/sys/ucontext.h
@@ -69,7 +69,6 @@  typedef struct
 /* Context to describe whole processor state.  */
 typedef struct
   {
-    unsigned long __mask;
     gregset_t __gregs;
     fpregset_t __fpregs;
   } mcontext_t;