mirror of
https://gitlab.com/qemu-project/qemu.git
synced 2024-10-03 17:19:50 +03: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
@ -47,9 +47,14 @@ struct PPCUserRegStruct {
|
||||
} QEMU_PACKED;
|
||||
|
||||
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;
|
||||
char pad2[40];
|
||||
char pad3[40]; /* 40 == sizeof(struct elf_prstatus) -
|
||||
offsetof(struct elf_prstatus, pr_reg) -
|
||||
sizeof(struct user_pt_regs) */
|
||||
} QEMU_PACKED;
|
||||
|
||||
|
||||
@ -96,7 +101,7 @@ typedef struct NoteFuncArg {
|
||||
DumpState *state;
|
||||
} 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;
|
||||
reg_t cr;
|
||||
@ -109,6 +114,7 @@ static void ppc_write_elf_prstatus(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||
|
||||
prstatus = ¬e->contents.prstatus;
|
||||
memset(prstatus, 0, sizeof(*prstatus));
|
||||
prstatus->pid = cpu_to_dump32(s, id);
|
||||
reg = &prstatus->pr_reg;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void ppc_write_elf_fpregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||
static void ppc_write_elf_fpregset(NoteFuncArg *arg, PowerPCCPU *cpu, int id)
|
||||
{
|
||||
int i;
|
||||
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);
|
||||
}
|
||||
|
||||
static void ppc_write_elf_vmxregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||
static void ppc_write_elf_vmxregset(NoteFuncArg *arg, PowerPCCPU *cpu, int id)
|
||||
{
|
||||
int i;
|
||||
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));
|
||||
}
|
||||
|
||||
static void ppc_write_elf_vsxregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||
static void ppc_write_elf_vsxregset(NoteFuncArg *arg, PowerPCCPU *cpu, int id)
|
||||
{
|
||||
int i;
|
||||
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;
|
||||
Note *note = &arg->note;
|
||||
@ -211,7 +217,7 @@ static void ppc_write_elf_speregset(NoteFuncArg *arg, PowerPCCPU *cpu)
|
||||
|
||||
static const struct NoteFuncDescStruct {
|
||||
int contents_size;
|
||||
void (*note_contents_func)(NoteFuncArg *arg, PowerPCCPU *cpu);
|
||||
void (*note_contents_func)(NoteFuncArg *arg, PowerPCCPU *cpu, int id);
|
||||
} note_func[] = {
|
||||
{sizeof_field(Note, contents.prstatus), ppc_write_elf_prstatus},
|
||||
{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);
|
||||
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 =
|
||||
sizeof(arg.note) - sizeof(arg.note.contents) + nf->contents_size;
|
||||
|
Loading…
Reference in New Issue
Block a user