[PATCH 1/4] C-SKY: fix sigcontext miss match

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/4] C-SKY: fix sigcontext miss match

Mao Han
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  <[hidden email]>
+
+ * 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  <[hidden email]>
 
  * 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

Reply | Threaded
Open this post in threaded view
|

[PATCH 2/4] C-SKY: remove user_regs definition

Mao Han
C-SKY GDB dose not use this file for ptrace and coredump.  ptrace can use
pt_regs definition from linux kernel directly.  The old definition only
got 34 regs instead of 38 regs from linux kernel, which will corrupted
the memory after ptrace PTRACE_GETREGSET call.

        * sysdeps/unix/sysv/linux/csky/sys/procfs.h: Use linux definition
        directly.
        * sysdeps/unix/sysv/linux/csky/sys/user.h: Remove user_regs
        definition.
---
 ChangeLog                                  |  7 +++++
 sysdeps/unix/sysv/linux/csky/bits/procfs.h | 19 ++++++++------
 sysdeps/unix/sysv/linux/csky/sys/user.h    | 41 ++----------------------------
 3 files changed, 20 insertions(+), 47 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dba3547..713e512 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2019-02-15  Mao Han  <[hidden email]>
 
+ * sysdeps/unix/sysv/linux/csky/sys/procfs.h: Use linux definition
+ directly.
+ * sysdeps/unix/sysv/linux/csky/sys/user.h: Remove user_regs
+ definition.
+
+2019-02-13  Mao Han  <[hidden email]>
+
  * 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
diff --git a/sysdeps/unix/sysv/linux/csky/bits/procfs.h b/sysdeps/unix/sysv/linux/csky/bits/procfs.h
index e3edf15..cf59f72 100644
--- a/sysdeps/unix/sysv/linux/csky/bits/procfs.h
+++ b/sysdeps/unix/sysv/linux/csky/bits/procfs.h
@@ -20,15 +20,18 @@
 # error "Never include <bits/procfs.h> directly; use <sys/procfs.h> instead."
 #endif
 
+#include <asm/ptrace.h>
+
 /* Type for a general-purpose register.  */
 typedef unsigned long elf_greg_t;
-
-/* And the whole bunch of them.  We could have used `struct
-   user_regs' directly in the typedef, but tradition says that
-   the register set is an array, which does have some peculiar
-   semantics, so leave it that way.  */
-#define ELF_NGREG (sizeof (struct user_regs) / sizeof (elf_greg_t))
+/* Type for a floating-point registers.  */
+typedef unsigned long elf_fpreg_t;
+
+/* In gdb/bfd elf32-csky.c, csky_elf_grok_prstatus() use fixed size of
+   elf_prstatus.  It's 148 for abiv1 and 220 for abiv2, the size is enough
+   for coredump and no need full sizeof (struct pt_regs).  */
+#define ELF_NGREG ((sizeof (struct pt_regs) / sizeof (elf_greg_t)) - 2)
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
-/* Register set for the floating-point registers.  */
-typedef struct user_fpregs elf_fpregset_t;
+#define ELF_NFPREG (sizeof (struct user_fp) / sizeof (elf_fpreg_t))
+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
diff --git a/sysdeps/unix/sysv/linux/csky/sys/user.h b/sysdeps/unix/sysv/linux/csky/sys/user.h
index 3372ece..3c0c96d 100644
--- a/sysdeps/unix/sysv/linux/csky/sys/user.h
+++ b/sysdeps/unix/sysv/linux/csky/sys/user.h
@@ -1,4 +1,5 @@
-/* ptrace register data format definitions.  C-SKY version.
+/* This file is not used by C-SKY GDB. ptrace can use pt_regs definition
+   from linux kernel directly.
    Copyright (C) 2018-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -19,42 +20,4 @@
 #ifndef _SYS_USER_H
 #define _SYS_USER_H  1
 
-struct user_fpregs {
-  unsigned long fsr; /* FPU status reg.  */
-  unsigned long fesr; /* FPU exception status reg.  */
-  unsigned long fp[32]; /* FPU general regs.  */
-};
-
-struct user_regs {
-  unsigned long int uregs[34]; /* CSKY V2 has 32 general rgister.  */
-};
-
-/* When the kernel dumps core, it starts by dumping the user struct -
-   this will be used by gdb to figure out where the data and stack segments
-   are within the file, and what virtual addresses to use.  */
-struct user{
-/* We start with the registers, to mimic the way that "memory" is returned
-   from the ptrace(3,...) function.  */
-  struct user_regs    regs;        /* The registers are actually stored.  */
-  int                 u_fpvalid;   /* True if math co-processor being used.  */
-
-/* The rest of this junk is to help gdb figure out what goes where.  */
-  unsigned long int   u_tsize;     /* Text segment size (pages).  */
-  unsigned long int   u_dsize;     /* Data segment size (pages).  */
-  unsigned long int   u_ssize;     /* Stack segment size (pages).  */
-  unsigned long       start_code;  /* Starting virtual address of text.  */
-  unsigned long       start_stack; /* Starting virtual address of stack area.
-      This is actually the bottom of the stack
-      the top of the stack is always found in
-      the esp register.  */
-  long int            signal;      /* Signal that caused the core dump.  */
-  int                 reserved;    /* No longer used.  */
-  struct user_regs *  u_ar0;       /* Used by gdb to help find the values
-      for the registers.  */
-  unsigned long       magic;       /* To uniquely identify a core file.  */
-  char                u_comm[32];  /* User command that was responsible.  */
-  struct user_fpregs  u_fp;
-  struct user_fpregs* u_fpstate;   /* Math Co-processor pointer.  */
-};
-
 #endif /* _SYS_USER_H */
--
2.7.4

Reply | Threaded
Open this post in threaded view
|

[PATCH 3/4] C-SKY: mark lr as undefined to stop unwinding

Mao Han
In reply to this post by Mao Han
Mark the lr register as undefined at the start of execution, so unwind
will stop at this frame. run-backtrace-*.sh from elfutils testsuite will
fail without this patch.

        * sysdeps/csky/abiv2/start.S: Likewise.
        * sysdeps/unix/sysv/linux/csky/abiv1/setcontext.S: Likewise.
        * sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S: Likewise.
---
 ChangeLog                                       | 6 ++++++
 sysdeps/csky/abiv2/start.S                      | 4 ++++
 sysdeps/unix/sysv/linux/csky/abiv2/clone.S      | 7 +++++--
 sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S | 2 ++
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 713e512..c95dfbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2019-02-15  Mao Han  <[hidden email]>
 
+ * sysdeps/csky/abiv2/start.S: Likewise.
+ * sysdeps/unix/sysv/linux/csky/abiv2/clone.S: Likewise.
+ * sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S: Likewise.
+
+2019-02-13  Mao Han  <[hidden email]>
+
  * sysdeps/unix/sysv/linux/csky/sys/procfs.h: Use linux definition
  directly.
  * sysdeps/unix/sysv/linux/csky/sys/user.h: Remove user_regs
diff --git a/sysdeps/csky/abiv2/start.S b/sysdeps/csky/abiv2/start.S
index 324ed69..b1e6152 100644
--- a/sysdeps/csky/abiv2/start.S
+++ b/sysdeps/csky/abiv2/start.S
@@ -46,6 +46,9 @@
  .type _start,@function;
  .align 4;
 _start:
+ cfi_startproc
+ .cfi_label .Ldummy
+ cfi_undefined (lr)
  subi sp, 8
  /* Clear the link register since this is the outermost frame.  */
  movi lr, 0
@@ -96,6 +99,7 @@ _start:
  /* Should never get here.  */
  jsri abort
 #endif /* !SHARED */
+ cfi_endproc
  .size _start,.-_start
 
 
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/clone.S b/sysdeps/unix/sysv/linux/csky/abiv2/clone.S
index 3e7328a..c1352ee 100644
--- a/sysdeps/unix/sysv/linux/csky/abiv2/clone.S
+++ b/sysdeps/unix/sysv/linux/csky/abiv2/clone.S
@@ -54,7 +54,7 @@ ENTRY (__clone)
  btsti a0, 31 /* Check if return is less than zero.  */
  bt __do_syscall_error
  cmpnei a0, 0
- bf __child
+ bf __thread_start
  rts
 
 __error_arg:
@@ -81,7 +81,9 @@ __do_syscall_error:
  rts
 PSEUDO_END (__clone)
 
-__child:
+ENTRY (__thread_start)
+ .cfi_label .Ldummy
+ cfi_undefined (lr)
  ldw a0, (sp, 4) /* Restore args from new sp.  */
  ldw a1, (sp, 0) /* Restore function from new sp.  */
  addi sp, 8
@@ -90,6 +92,7 @@ __child:
  /* exit */
  lrw r7, __NR_exit
  trap 0
+END (__thread_start)
 
 libc_hidden_def (__clone)
 weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S b/sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S
index 6d3f04f..34de6e3 100644
--- a/sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S
+++ b/sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S
@@ -62,6 +62,8 @@ END (setcontext)
 weak_alias (__setcontext, setcontext)
 
 ENTRY (__startcontext)
+ .cfi_label .Ldummy
+ cfi_undefined (lr)
  mov a0, r9
  cmpnei r9, 0 /* r9 was set in makecontext.  */
  bf 1f /* null, then exit.  */
--
2.7.4

Reply | Threaded
Open this post in threaded view
|

[PATCH 4/4] C-SKY: add elf header definition for elfutils

Mao Han
In reply to this post by Mao Han
This patch adds some defines relate to machine flag and section information,
which is used by elfutils elflint check. A C-SKY typo is also fixed with
this patch.

        * elf/elf.h (EF_CSKY_ABIMASK, EF_CSKY_OTHER, EF_CSKY_PROCESSOR)
        (EF_CSKY_ABIV1, EF_CSKY_ABIV2, SHT_CSKY_ATTRIBUTES): New defines.
---
 elf/elf.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/elf/elf.h b/elf/elf.h
index 47a514a..01648bd 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -360,7 +360,7 @@ typedef struct
 #define EM_RISCV 243 /* RISC-V */
 
 #define EM_BPF 247 /* Linux BPF -- in-kernel virtual machine */
-#define EM_CSKY 252     /* C_SKY */
+#define EM_CSKY 252     /* C-SKY */
 
 #define EM_NUM 253
 
@@ -3022,7 +3022,7 @@ enum
 /* Keep this the last entry.  */
 #define R_ARM_NUM 256
 
-/* csky */
+/* C-SKY */
 #define R_CKCORE_NONE               0 /* no reloc */
 #define R_CKCORE_ADDR32             1 /* direct 32 bit (S + A) */
 #define R_CKCORE_PCRELIMM8BY4       2 /* disp ((S + A - P) >> 2) & 0xff   */
@@ -3086,6 +3086,17 @@ enum
 #define R_CKCORE_TLS_DTPOFF32       57
 #define R_CKCORE_TLS_TPOFF32        58
 
+/* C-SKY elf header definition.  */
+#define EF_CSKY_ABIMASK    0XF0000000
+#define EF_CSKY_OTHER    0X0FFF0000
+#define EF_CSKY_PROCESSOR    0X0000FFFF
+
+#define EF_CSKY_ABIV1    0X10000000
+#define EF_CSKY_ABIV2    0X20000000
+
+/* C-SKY attributes section.  */
+#define SHT_CSKY_ATTRIBUTES    (SHT_LOPROC + 1)
+
 /* IA-64 specific declarations.  */
 
 /* Processor specific flags for the Ehdr e_flags field.  */
--
2.7.4

Reply | Threaded
Open this post in threaded view
|

[COMMITTED][PATCH 1/4] C-SKY: fix sigcontext miss match

Mao Han
In reply to this post by Mao Han
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.