From: Mao Han <han_mao@c-sky.com>
To: libc-alpha@sourceware.org
Cc: Mao Han <han_mao@c-sky.com>
Subject: [PATCH 1/4] C-SKY: fix sigcontext miss match
Date: Thu, 7 Mar 2019 09:34:03 +0800 [thread overview]
Message-ID: <edbba2b7bdb7bb93dd1be5e068c6af81f845da8f.1551922357.git.han_mao@c-sky.com> (raw)
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
--- 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;
--
2.7.4
next reply other threads:[~2019-03-07 2:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 1:34 Mao Han [this message]
2019-03-07 1:34 ` [PATCH 2/4] C-SKY: remove user_regs definition Mao Han
2019-03-07 1:34 ` [PATCH 3/4] C-SKY: mark lr as undefined to stop unwinding Mao Han
2019-03-07 1:34 ` [PATCH 4/4] C-SKY: add elf header definition for elfutils Mao Han
2019-03-11 2:59 ` [COMMITTED][PATCH 1/4] C-SKY: fix sigcontext miss match Mao Han
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=edbba2b7bdb7bb93dd1be5e068c6af81f845da8f.1551922357.git.han_mao@c-sky.com \
--to=han_mao@c-sky.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).