From patchwork Wed Jun 19 05:00:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 1949553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osandov-com.20230601.gappssmtp.com header.i=@osandov-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=Kcailptv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W3s0b3LLkz20XZ for ; Wed, 19 Jun 2024 15:01:35 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJnR4-00088d-FJ; Wed, 19 Jun 2024 01:00:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJnQx-00086P-0p for qemu-devel@nongnu.org; Wed, 19 Jun 2024 01:00:36 -0400 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJnQu-0002Ci-Sf for qemu-devel@nongnu.org; Wed, 19 Jun 2024 01:00:34 -0400 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-5bfa5f9bbe6so1747433eaf.3 for ; Tue, 18 Jun 2024 22:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1718773229; x=1719378029; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wxOU2UBK31A2MsvvrU8KfdPolr+I7zX14JcLUR83OuY=; b=Kcailptvuz9013OyL/yyBltry2NtRtUxPj/AYkfzMMYsLRx/UY1CrsMl0RvMPfDToX BAp866SuY+x58k9JlsqgAL8XWWURgv0yOMDA1r2Vu63u7b8ILe+8LY+Zk7E7pkVPnd54 iGAqfTJpbaHw+ooooFbcoKGOrlaZ7ok+dQEJCHt0UFJ2XCng/yE5dtGDy2jBkDwY7FRR uyRVRMCfiOC7hAJCzdqYwY0a6f3NEYjritc00xtRxyRNITrLCKE4XP1M1YpNOaPNeSo+ SXDb/b7ygf9lhnUVOHggbpvawljbiUQuPYGY1uX1ghAIM0PYqx+tzoTWDPkLWXCP8DW4 tyog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718773229; x=1719378029; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wxOU2UBK31A2MsvvrU8KfdPolr+I7zX14JcLUR83OuY=; b=X+Dl+X7YFyBM6E6WU2mT2s5M5kkgL/6VQTqlIykee3p4qcgEIXyuSVbLd7jUi7zrqb 9B9BPgZdsoiVKJ37mPK7ClVSxj04zeUQ2KcATR9RTb2DoZxHTnClkp6bH9rKf7XbgS0j 2IHsjbVNma65tl78cy8e2rfQ4GUKGU149Xs/nPS4yNbyffLXeezSB5FKJiBgodfxPtO4 Qxzp/EerXcpBfeQ0VfjgkJZTdLq+XZTdW00YURbdvm0w65FHkwWL77XwAF9vZEZHt1QD CNH8YCpTbM3JBawKFOGuCnpt4cXXTfkGVm136m2XGJRHxLFN+bmksfByNENGzi/eESAZ pb3A== X-Gm-Message-State: AOJu0YzecMyHe3YaYu3ZQb22FTNMGUDMdcXJAinfwrtyDXle77zof/go ByrG0xrWPdRPPOdyGCKS7YMqjuplcgUU9Rf3KDHaqknWIyJcDhuvCFZLsOlYCI1i4NkvdF6pvjh MKjw= X-Google-Smtp-Source: AGHT+IFnRK+olC27LLdSl+gitic7LAbd0SqQcny58N5Rx0UD++iUFr60Z1/P8h7FqL77+abhYXrbkg== X-Received: by 2002:a05:6358:5207:b0:1a2:46b:9278 with SMTP id e5c5f4694b2df-1a2046b95e6mr48914055d.19.1718773228755; Tue, 18 Jun 2024 22:00:28 -0700 (PDT) Received: from telecaster.hsd1.wa.comcast.net ([2601:602:8980:9170::2f17]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6fedcf36be7sm7457523a12.1.2024.06.18.22.00.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 22:00:28 -0700 (PDT) From: Omar Sandoval To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Thomas Huth , Nicholas Piggin , Daniel Henrique Barboza , linux-debuggers@vger.kernel.org Subject: [PATCH 1/2] target/s390x/arch_dump: use correct byte order for pid Date: Tue, 18 Jun 2024 22:00:12 -0700 Message-ID: <5929f76d536d355afd04af51bf293695a1065118.1718771802.git.osandov@osandov.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::c2b; envelope-from=osandov@osandov.com; helo=mail-oo1-xc2b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The pid field of prstatus needs to be big endian like all of the other fields. Fixes: f738f296eaae ("s390x/arch_dump: pass cpuid into notes sections") Signed-off-by: Omar Sandoval Reviewed-by: Thomas Huth --- target/s390x/arch_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/arch_dump.c b/target/s390x/arch_dump.c index 7e8a1b4fc0..029d91d93a 100644 --- a/target/s390x/arch_dump.c +++ b/target/s390x/arch_dump.c @@ -102,7 +102,7 @@ static void s390x_write_elf64_prstatus(Note *note, S390CPU *cpu, int id) regs->acrs[i] = cpu_to_be32(cpu->env.aregs[i]); regs->gprs[i] = cpu_to_be64(cpu->env.regs[i]); } - note->contents.prstatus.pid = id; + note->contents.prstatus.pid = cpu_to_be32(id); } static void s390x_write_elf64_fpregset(Note *note, S390CPU *cpu, int id) From patchwork Wed Jun 19 05:00:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 1949555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osandov-com.20230601.gappssmtp.com header.i=@osandov-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=01grOxXv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W3s0h6WqWz20Wb for ; Wed, 19 Jun 2024 15:01:40 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJnR7-0008A0-AH; Wed, 19 Jun 2024 01:00:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJnQz-00086x-7C for qemu-devel@nongnu.org; Wed, 19 Jun 2024 01:00:38 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJnQu-0002DW-Sj for qemu-devel@nongnu.org; Wed, 19 Jun 2024 01:00:36 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-705c739b878so428764b3a.1 for ; Tue, 18 Jun 2024 22:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1718773231; x=1719378031; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CnHosSMTlhyZy4/smUQmVXiKBF37sEAO5boId4LvkC4=; b=01grOxXvZ4QjyUPmU8rPBbU1luNUaQymAYHhPOmVzVI7IQR8zG/s9zynjrpugdurDO yX95c5NpkfMl5waQCx5UsuK1D5bDnm8bCAmVJF1cH0ApB8nyWVzePiQGpy7TGwcFNq6h RnalrwU3IvNMlsAqjIu4bNL3Znq5lUKj+APpvEWWvqPBNRm8bO9Y69AzGvOnt2nRD+QY NcilGRK9QBSIAPIHwoYoIJTn2i1a5VwRlTEiJzPTJV4U44usxi/scMtU0xXc6s4Z0y6N 3h0e35aEZR8J60IC+5EtTQkLt6AF5r+tYt3XBM0+1hLPMrIvSfaUu0NZuBxp8ORne89K N98g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718773231; x=1719378031; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CnHosSMTlhyZy4/smUQmVXiKBF37sEAO5boId4LvkC4=; b=uAA5zP0Q0TBIqogVThsw36VVBHWbCS95iKeN3t0Ur0LTol8gTbHHXnZL/yyFlrNeSb yuHggnXcI0rI5mnldPzpXyyXOP70IaOBgn7fkaTtlr+DAUwtrHMsI20Qixdoju9sPxCF +vxaGC/MrOjDqHRKgNdLtgnT7ty3udZVw6w3cXcHj0pt1un6aibfhKRhZVfmpc2ijVjr +UH3IbqR9JRoTPcJbGbJxdZocdHYqNrjnpH35vF0IBgSBURdU2Lr8hPWFbjcUVmrAU2O 0g3feeu3bnsi9NneosKDVovmuwkmDsDo889YPUEnOj5w70SC6NP7k0/6BXWtchcDDuqE hxmQ== X-Gm-Message-State: AOJu0YyGadQdnsELdYJBr3monBMnLrPqaCzhl44pYDhFhtFXvEGO7ib8 8VhRyD1j5ccqH+Yg45O6TbGVKTLmTpwBDyfAdXrQd08AeXOlioRy75u2Ed9j4/lq0+OhST/3sHJ dpJQ= X-Google-Smtp-Source: AGHT+IH+pD6pdddjXgKRvRm15zJ2fCm4wOHzm9P4Y5A1pJHZtGupGZ0FTYlkdIu+G+aSj8d3m5wyXQ== X-Received: by 2002:a05:6a20:c31d:b0:1bc:bada:a9fd with SMTP id adf61e73a8af0-1bcbadab018mr1978857637.1.1718773230570; Tue, 18 Jun 2024 22:00:30 -0700 (PDT) Received: from telecaster.hsd1.wa.comcast.net ([2601:602:8980:9170::2f17]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6fedcf36be7sm7457523a12.1.2024.06.18.22.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 22:00:29 -0700 (PDT) From: Omar Sandoval To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Thomas Huth , Nicholas Piggin , Daniel Henrique Barboza , linux-debuggers@vger.kernel.org Subject: [PATCH 2/2] target/ppc/arch_dump: set prstatus pid to cpuid Date: Tue, 18 Jun 2024 22:00:13 -0700 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42f; envelope-from=osandov@osandov.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Every other architecture does this, and debuggers need it to be able to identify which prstatus note corresponds to which CPU. Signed-off-by: Omar Sandoval Reviewed-by: Thomas Huth Reviewed-by: Harsh Prateek Bora --- target/ppc/arch_dump.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c index a8315659d9..78b4205319 100644 --- a/target/ppc/arch_dump.c +++ b/target/ppc/arch_dump.c @@ -47,9 +47,11 @@ struct PPCUserRegStruct { } QEMU_PACKED; struct PPCElfPrstatus { - char pad1[112]; + char pad1[32]; + uint32_t pid; + uint8_t pad2[76]; struct PPCUserRegStruct pr_reg; - char pad2[40]; + char pad3[40]; } QEMU_PACKED; @@ -96,7 +98,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 +111,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 +130,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 +149,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 +181,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 +198,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 +214,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 +285,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;