mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
target/ppc/arch_dump: set prstatus pid to cpuid
Every other architecture does this, and debuggers need it to be able to identify which prstatus note corresponds to which CPU. Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Signed-off-by: Omar Sandoval <osandov@osandov.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
parent
cfb52d07f5
commit
2587a57dbb
1 changed files with 15 additions and 9 deletions
|
@ -47,9 +47,14 @@ struct PPCUserRegStruct {
|
||||||
} QEMU_PACKED;
|
} QEMU_PACKED;
|
||||||
|
|
||||||
struct PPCElfPrstatus {
|
struct PPCElfPrstatus {
|
||||||
char pad1[112];
|
char pad1[32]; /* 32 == offsetof(struct elf_prstatus, pr_pid) */
|
||||||
|
uint32_t pid;
|
||||||
|
char pad2[76]; /* 76 == offsetof(struct elf_prstatus, pr_reg) -
|
||||||
|
offsetof(struct elf_prstatus, pr_ppid) */
|
||||||
struct PPCUserRegStruct pr_reg;
|
struct PPCUserRegStruct pr_reg;
|
||||||
char pad2[40];
|
char pad3[40]; /* 40 == sizeof(struct elf_prstatus) -
|
||||||
|
offsetof(struct elf_prstatus, pr_reg) -
|
||||||
|
sizeof(struct user_pt_regs) */
|
||||||
} QEMU_PACKED;
|
} QEMU_PACKED;
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,7 +101,7 @@ typedef struct NoteFuncArg {
|
||||||
DumpState *state;
|
DumpState *state;
|
||||||
} NoteFuncArg;
|
} NoteFuncArg;
|
||||||
|
|
||||||
static void ppc_write_elf_prstatus(NoteFuncArg *arg, PowerPCCPU *cpu)
|
static void ppc_write_elf_prstatus(NoteFuncArg *arg, PowerPCCPU *cpu, int id)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
reg_t cr;
|
reg_t cr;
|
||||||
|
@ -109,6 +114,7 @@ static void ppc_write_elf_prstatus(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||||
|
|
||||||
prstatus = ¬e->contents.prstatus;
|
prstatus = ¬e->contents.prstatus;
|
||||||
memset(prstatus, 0, sizeof(*prstatus));
|
memset(prstatus, 0, sizeof(*prstatus));
|
||||||
|
prstatus->pid = cpu_to_dump32(s, id);
|
||||||
reg = &prstatus->pr_reg;
|
reg = &prstatus->pr_reg;
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
|
@ -127,7 +133,7 @@ static void ppc_write_elf_prstatus(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||||
reg->ccr = cpu_to_dump_reg(s, cr);
|
reg->ccr = cpu_to_dump_reg(s, cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ppc_write_elf_fpregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
static void ppc_write_elf_fpregset(NoteFuncArg *arg, PowerPCCPU *cpu, int id)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct PPCElfFpregset *fpregset;
|
struct PPCElfFpregset *fpregset;
|
||||||
|
@ -146,7 +152,7 @@ static void ppc_write_elf_fpregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||||
fpregset->fpscr = cpu_to_dump_reg(s, cpu->env.fpscr);
|
fpregset->fpscr = cpu_to_dump_reg(s, cpu->env.fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ppc_write_elf_vmxregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
static void ppc_write_elf_vmxregset(NoteFuncArg *arg, PowerPCCPU *cpu, int id)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct PPCElfVmxregset *vmxregset;
|
struct PPCElfVmxregset *vmxregset;
|
||||||
|
@ -178,7 +184,7 @@ static void ppc_write_elf_vmxregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||||
vmxregset->vscr.u32[3] = cpu_to_dump32(s, ppc_get_vscr(&cpu->env));
|
vmxregset->vscr.u32[3] = cpu_to_dump32(s, ppc_get_vscr(&cpu->env));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ppc_write_elf_vsxregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
static void ppc_write_elf_vsxregset(NoteFuncArg *arg, PowerPCCPU *cpu, int id)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct PPCElfVsxregset *vsxregset;
|
struct PPCElfVsxregset *vsxregset;
|
||||||
|
@ -195,7 +201,7 @@ static void ppc_write_elf_vsxregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ppc_write_elf_speregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
static void ppc_write_elf_speregset(NoteFuncArg *arg, PowerPCCPU *cpu, int id)
|
||||||
{
|
{
|
||||||
struct PPCElfSperegset *speregset;
|
struct PPCElfSperegset *speregset;
|
||||||
Note *note = &arg->note;
|
Note *note = &arg->note;
|
||||||
|
@ -211,7 +217,7 @@ static void ppc_write_elf_speregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||||
|
|
||||||
static const struct NoteFuncDescStruct {
|
static const struct NoteFuncDescStruct {
|
||||||
int contents_size;
|
int contents_size;
|
||||||
void (*note_contents_func)(NoteFuncArg *arg, PowerPCCPU *cpu);
|
void (*note_contents_func)(NoteFuncArg *arg, PowerPCCPU *cpu, int id);
|
||||||
} note_func[] = {
|
} note_func[] = {
|
||||||
{sizeof_field(Note, contents.prstatus), ppc_write_elf_prstatus},
|
{sizeof_field(Note, contents.prstatus), ppc_write_elf_prstatus},
|
||||||
{sizeof_field(Note, contents.fpregset), ppc_write_elf_fpregset},
|
{sizeof_field(Note, contents.fpregset), ppc_write_elf_fpregset},
|
||||||
|
@ -282,7 +288,7 @@ static int ppc_write_all_elf_notes(const char *note_name,
|
||||||
arg.note.hdr.n_descsz = cpu_to_dump32(s, nf->contents_size);
|
arg.note.hdr.n_descsz = cpu_to_dump32(s, nf->contents_size);
|
||||||
strncpy(arg.note.name, note_name, sizeof(arg.note.name));
|
strncpy(arg.note.name, note_name, sizeof(arg.note.name));
|
||||||
|
|
||||||
(*nf->note_contents_func)(&arg, cpu);
|
(*nf->note_contents_func)(&arg, cpu, id);
|
||||||
|
|
||||||
note_size =
|
note_size =
|
||||||
sizeof(arg.note) - sizeof(arg.note.contents) + nf->contents_size;
|
sizeof(arg.note) - sizeof(arg.note.contents) + nf->contents_size;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue