From 6229c9bff7e3171a565b78f7f1a210126e041b5b Mon Sep 17 00:00:00 2001 From: Mao Han Date: Mon, 11 Mar 2019 09:45:15 +0800 Subject: C-SKY: fix sigcontext miss match 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 --- sysdeps/unix/sysv/linux/csky/register-dump.h | 127 +++++++++++++-------------- sysdeps/unix/sysv/linux/csky/sys/ucontext.h | 1 - 2 files changed, 62 insertions(+), 66 deletions(-) (limited to 'sysdeps/unix') diff --git a/sysdeps/unix/sysv/linux/csky/register-dump.h b/sysdeps/unix/sysv/linux/csky/register-dump.h index 003d10512a..949618911e 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 b4b277a51d..5eac9e6494 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; -- cgit 1.4.1