[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Crash-utility] crash gcore command, version 1.3.0-rc is released



From: Wei Shu <weishu marvell com>
Subject: RE: [Crash-utility] crash gcore command, version 1.3.0-rc is released
Date: Wed, 15 Oct 2014 02:55:43 -0700

> From 623038a48cded0d2b5ad804c78b92d6b7d979cac Mon Sep 17 00:00:00 2001
> From: Lei Wen <leiwen marvell com>
> Date: Mon, 28 Jul 2014 10:12:57 +0800
> Subject: [PATCH 1/4] gcore: fix build for arm64
> 

Could you write more patch description? At least I don't know arm
things. Please explain what this patch does in more detail.

> Change-Id: Ic075720ea7a0d3523cdde616772b3d75dd90f7ae
> Signed-off-by: Lei Wen <leiwen marvell com>
> ---
>  extensions/libgcore/gcore_arm64.c    |    4 +--
>  extensions/libgcore/gcore_coredump.c |    5 ---
>  extensions/libgcore/gcore_defs.h     |   58 +++++++++++++++++++++++++++-------
>  3 files changed, 49 insertions(+), 18 deletions(-)
> 
> diff --git a/extensions/libgcore/gcore_arm64.c b/extensions/libgcore/gcore_arm64.c
> index 8ea1994..5f05dd9 100644
> --- a/extensions/libgcore/gcore_arm64.c
> +++ b/extensions/libgcore/gcore_arm64.c
> @@ -24,12 +24,12 @@ static int gpr_get(struct task_context *target,
>  		   const struct user_regset *regset,
>  		   unsigned int size, void *buf)
>  {
> -	struct user_pt_regs *regs = (struct user_pt_regs *)buf;
> +	struct user_regs_struct *regs = (struct user_regs_struct *)buf;
>  
>  	BZERO(regs, sizeof(*regs));
>  
>  	readmem(machdep->get_stacktop(target->task) - 16 - SIZE(pt_regs), KVADDR,
> -		regs, sizeof(struct user_pt_regs), "gpr_get: user_pt_regs",
> +		regs, sizeof(struct user_regs_struct), "gpr_get: user_regs_struct",
>  		gcore_verbose_error_handle());
>  
>  	return 0;
> diff --git a/extensions/libgcore/gcore_coredump.c b/extensions/libgcore/gcore_coredump.c
> index fe6b46e..19156d0 100644
> --- a/extensions/libgcore/gcore_coredump.c
> +++ b/extensions/libgcore/gcore_coredump.c
> @@ -682,12 +682,7 @@ fill_prstatus_note(struct elf_note_info *info, struct task_context *tc,
>  		   struct memelfnote *memnote)
>  {
>  	struct elf_prstatus dummy, *prstatus = (struct elf_prstatus *)memnote->data;
> -#if defined(X86) || defined(X86_64) || defined(ARM)
>  	struct user_regs_struct *regs = (struct user_regs_struct *)memnote->data;
> -#endif
> -#ifdef ARM64
> -	struct user_pt_regs *regs = (struct user_pt_regs *)memnote->data;
> -#endif
>  	ulong pending_signal_sig0, blocked_sig0, real_parent, group_leader,
>  		signal, cutime,	cstime;
>  
> diff --git a/extensions/libgcore/gcore_defs.h b/extensions/libgcore/gcore_defs.h
> index a34ff98..ba7c1bd 100644
> --- a/extensions/libgcore/gcore_defs.h
> +++ b/extensions/libgcore/gcore_defs.h
> @@ -486,10 +486,54 @@ struct user_regs_struct{
>  #define ARM_VFPREGS_SIZE ( 32 * 8 /*fpregs*/ + 4 /*fpscr*/ )
>  #endif
>  
> +#ifdef ARM64
> +struct user_fpsimd_state {
> +	__uint128_t     vregs[32];
> +	uint32_t	fpsr;
> +	uint32_t	fpcr;
> +};
> +
> +struct user_regs_struct{
> +	unsigned long x0;
> +	unsigned long x1;
> +	unsigned long x2;
> +	unsigned long x3;
> +	unsigned long x4;
> +	unsigned long x5;
> +	unsigned long x6;
> +	unsigned long x7;
> +	unsigned long x8;
> +	unsigned long x9;
> +	unsigned long x10;
> +	unsigned long x11;
> +	unsigned long x12;
> +	unsigned long x13;
> +	unsigned long x14;
> +	unsigned long x15;
> +	unsigned long x16;
> +	unsigned long x17;
> +	unsigned long x18;
> +	unsigned long x19;
> +	unsigned long x20;
> +	unsigned long x21;
> +	unsigned long x22;
> +	unsigned long x23;
> +	unsigned long x24;
> +	unsigned long x25;
> +	unsigned long x26;
> +	unsigned long x27;
> +	unsigned long x28;
> +	unsigned long x29;
> +	unsigned long x30;
> +	unsigned long x31;
> +	unsigned long pc;
> +	unsigned long cpsr;
> +};

Where does this data structure come? It looks to me that the following
is used as NT_PRSTATUS at kernel ARM64 source code and current gcore
ARM64 source by Dave:

struct user_pt_regs {
        __u64           regs[31];
        __u64           sp;
        __u64           pc;
        __u64           pstate;
};

The binary layout is identical to the above structure but member names
are slightly differnet; in particular, cpsr v.s. pstate.

I think it better to use kernel's data structure for maintainance
purpose.

> +
> +#endif
> +
>  typedef ulong elf_greg_t;
> -#if defined(X86) || defined(X86_64) || defined(ARM)
>  #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
> -#endif
>  typedef elf_greg_t elf_gregset_t[ELF_NGREG];
>  
>  #if defined(X86) || defined(ARM)
> @@ -534,14 +578,12 @@ enum pid_type
>          PIDTYPE_MAX
>  };
>  
> -#if defined(X86) || defined(X86_64) || defined(ARM)
>  struct elf_siginfo
>  {
>          int     si_signo;                       /* signal number */
>  	int     si_code;                        /* extra code */
>          int     si_errno;                       /* errno */
>  };
> -#endif
>  
>  /* Parameters used to convert the timespec values: */
>  #define NSEC_PER_USEC   1000L
> @@ -633,7 +675,6 @@ cputime_to_compat_timeval(const cputime_t cputime,
>  }
>  #endif
>  
> -#if defined(X86) || defined(X86_64) || defined(ARM)
>  struct elf_prstatus
>  {
>  	struct elf_siginfo pr_info;	/* Info associated with signal */
> @@ -651,17 +692,14 @@ struct elf_prstatus
>  	elf_gregset_t pr_reg;	/* GP registers */
>  	int pr_fpvalid;		/* True if math co-processor being used.  */
>  };
> -#endif
>  
> -#if defined(X86) || defined(X86_64) || defined(ARM)
>  typedef unsigned short __kernel_old_uid_t;
>  typedef unsigned short __kernel_old_gid_t;
> -#endif
>  
>  typedef __kernel_old_uid_t      old_uid_t;
>  typedef __kernel_old_gid_t      old_gid_t;
>  
> -#ifdef X86_64
> +#if defined(X86_64) || defined(ARM64)
>  typedef unsigned int __kernel_uid_t;
>  typedef unsigned int __kernel_gid_t;
>  #endif
> @@ -724,7 +762,6 @@ static inline ulong ffz(ulong word)
>  
>  #define ELF_PRARGSZ     (80)    /* Number of chars for args */
>  
> -#if defined(X86) || defined(X86_64) || defined(ARM)
>  struct elf_prpsinfo
>  {
>          char    pr_state;       /* numeric process state */
> @@ -739,7 +776,6 @@ struct elf_prpsinfo
>          char    pr_fname[16];   /* filename of executable */
>          char    pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
>  };
> -#endif
>  
>  #ifdef GCORE_ARCH_COMPAT
>  
> -- 
> 1.7.9.5
> 
--
Thanks.
HATAYAMA, Daisuke


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]