public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: Yong Zheng <zhengyo@cn.ibm.com>
Cc: Frysk Hackers <frysk@sourceware.org>
Subject: Re: PPC64 core-file GP register formats/order
Date: Mon, 23 Oct 2006 04:15:00 -0000	[thread overview]
Message-ID: <453C41B7.2060106@redhat.com> (raw)
In-Reply-To: <1161575543.2742.26.camel@YZ_X86_64>

Yon Zheng wrote:
> On Sun, 2006-10-22 at 20:38 -0500, Phil Muldoon wrote: 
>   
>> I'm not sure what to do, but I cannot find the expectations of register 
>> order in a core file for PPC64. On other architectures the order is 
>> defined in:
>>
>> struct user_regs_struct
>> {..structure defined here...}
>>
>> in /usr/include/asm/user.h
>>
>> in x86, and on x86_64:
>>
>> asm-i386/    asm-x86_64/
>>
>> Depending on how that box is configured.
>>
>> The only contents of user.h on a PPC64 box in Toronto contains:
>>
>> #ifndef _ASM_POWERPC_USER_H
>> #define _ASM_POWERPC_USER_H
>> #endif  /* _ASM_POWERPC_USER_H */
>>
>>     
>
>
> IMO, the PRSTATUS data struct is defined by the struct elf_prstatus in
> <linux/elfcore.h>, right?(I think it's right, you know kernel dumps core
> file according <linux/elfcore.h>, so we should take the same struct as
> kernel does). Then the attribute "elf_gregset_t pr_reg" is referred in
> the struct elf_prstatus.
>   

That is how it is done at the moemt ;).
> On x86/x86_64, the "elf_gregset_t pr_reg" is defined by the struct
> "struct user_regs_struct" in <asm-i386/user.h> or <asm-x86_64/user.h>.
> We should dump out the registers according to the "struct
> user_regs_struct". This is ok, you must have done this. :-)
>
>   
Yep.
> Unfortunately in the <asm-ppc64/user.h> on PPC64, no one struct like
> "struct user_regs_struct" is defined. So this will bring us some
> troubles when dumping. 
>
>   

:(
> Let go back to read the <linux/elfcore.h>. On PPC/PPC64, the struct
> "elf_gregset_t" is defined as one unsigned long array with the size of
> 48 in <asm-ppc64/elf.h> or <asm-ppc/elf.h>. And about each member in the
> array is defined in <asm-ppc/ptrace.h> or <asm-ppc64/ptrace.h>, for
> example, the array[0] is the NO.0 general purpose register(i.e. gpr0). I
> think we should take this order to dump out the attribute "elf_gregset_t
> pr_reg" of PRSTATUS.
>
> Now the question becomes how to get the above 48 registers' value on
> PPC64. (I'm not sure how you get the similar value on X86/X86_64. We
> guess you get them by getRegisterBankBuffers() in ISA.java. :-)). If you
> get them by getRegisterBankBuffers() in ISA.java, it will more easier
> for us to get the same registerBankBuffer on PPC64.So, if the code works
> well on X86/X86_64, please check them in. And we will do some
> modifications for PPC64.
>   

I look at the struct in user.h and look for the order there, then I 
simply call the registerByName on the register order defined there. So 
on i386 the registers needed in order are:

ebx, ecx, edx, {...}

These are not the actual order reported by the register Iterator. But 
that does not matter as long as I know the order, as I can call 
getRegisterByName to mix the order up as much as needed. So all is 
needed is the register order to dump to core, and then I will define a 
map -> getRegisterByName() that will dump the order correctly.

Regards

Phil
>
>   
>> I tried to backward engineer the order with gcore and kernel on ppc64, 
>> but both of those either do not write notes, or eu-readelf cannot 
>> understand them as the output is:
>>
>> Note segment of 2060 bytes at offset 0x2b4:
>>   Owner          Data size  Type
>>   CORE                 268  PRSTATUS
>>   CORE                 128  PRPSINFO
>>
>> That is basically no note data at all (or that can be understood).
>>
>>     
>
> I do one test for kernel' core dump file on PPC64. THe tool "en-readelf" cannot 
> recogonize the PRSTATUS's detailed information, it just shows some general info like the above.
> I think this may be the bug in en-readelf on PPC64.
>
> Best regards
> Yong Zheng
>
>   

  reply	other threads:[~2006-10-23  4:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-23  1:38 Phil Muldoon
2006-10-23  3:54 ` Yong Zheng
2006-10-23  4:15   ` Phil Muldoon [this message]
2006-10-23 12:41     ` Compiling failed for ElfPrstatus.cxx file on x86-64 Yong Zheng
2006-10-23 13:14       ` Phil Muldoon
2006-10-23  6:19 ` PPC64 core-file GP register formats/order Roland McGrath
2006-10-23  8:51   ` Wu Zhou
2006-10-23  9:42     ` Roland McGrath
2006-10-23 13:53   ` Phil Muldoon

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=453C41B7.2060106@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=frysk@sourceware.org \
    --cc=zhengyo@cn.ibm.com \
    /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).