From patchwork Thu Mar 1 19:38:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10252317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9D57260365 for ; Thu, 1 Mar 2018 19:39:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BD5A28521 for ; Thu, 1 Mar 2018 19:39:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 804DC28536; Thu, 1 Mar 2018 19:39:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E80A928521 for ; Thu, 1 Mar 2018 19:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=RDJItFcOtwY5equ1L3oUcxSYE4ntke5fk3E23e86imI=; b=C8S T99ywvCwytFkmZWKGlk/bv8pR9uqmqjNxE1MOGP8YitsC5YUUUchdArCUGQ2S08wZLh+w8Ml0ayzS auuQfdiYYeXHFrsaRxcTE/XWZ8SCNXleurPi2mNDPsP0rspcspQnxDviNBgK6pCxwCHutdSprNqYt gQgZOm6C9SC5/HUrNWB61R1tVwGQjljQVbT0HSvlCml148U05mgEHDUPQJRZx3pGYTbMfToSqoL64 I/ZSZZkAXyYACWDCO9Ce0ReVr3NOW2Zr0Yhh/QYS+0H9glz9JmGcosYiUqiU4e3Pwryd0O87pUEYx NNJE5d+LrVvn0H9TBjkQNaO3edepN2Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1erU2e-0000qK-St; Thu, 01 Mar 2018 19:39:00 +0000 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1erU2b-0000oR-0g for linux-arm-kernel@lists.infradead.org; Thu, 01 Mar 2018 19:38:58 +0000 Received: by mail-pl0-x243.google.com with SMTP id y8-v6so4230188pll.13 for ; Thu, 01 Mar 2018 11:38:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=u7cUzQ+EbOSNogtCFngtVY0Qsdiz1q1bjC/fpFYrauU=; b=LOyRj2vw12NCdTe823eLTdu80o7+PEBr7N/L1Zv6nAU0M8+dj56pxhM5QiMmTab6Sl zj4qgI1SYwZbe+8SOmyhLMkVxZOzBTEUPbo6BJDvQXWr/FEXvxRlmLPHapwtfF6+pk/4 Z0vVMa5GtDqbsJ0DkqCSbwdELjDpJEVvmQeMs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=u7cUzQ+EbOSNogtCFngtVY0Qsdiz1q1bjC/fpFYrauU=; b=rhwNQfbgyZk0XI93FcKQwuxzG14fVmRdARAfqBsZM2Yn7ev3t+mhZ5pe9wrKvbGDxa mmpXk6xBbVuc5qkY6VFwAQDVORuAgdcSJ1Q/JdhYxhmLucpuADHmG7wSyYN72tPzGDYz drHIfH44obYvilvf1wwrVsdDqZRE4ZhBasvj0uYakkt5AITiW4/0PObMYyAMY1ORd/d2 aT/6ikgVPQaEa3W4ZSo7vKUklNxQVePpr57SYuWwUBvRuns4dqcvCdYpAbh51vHZOJxo dRZ/c8Ojh6VrkGX/dJiuoHpYitYjQNDw1eiVEXdtGBdYAJ6UOXvLAOkYYRROAoeFgpDj xo3w== X-Gm-Message-State: APf1xPB8q2CGSmGRpMpvP4Sj6ErWSU9VLhJ4qQK8C1YFvs+QiQ41v0CG J97/MBixjMu0ZnvHCxqeT+uyMg== X-Google-Smtp-Source: AG47ELtvHeFVmJTH8RE/hwQJNu3GCoku1c7bW7awqY4wG6m4hBSjQUxPKPRkwlsf0F9Gr8NkHJOIzg== X-Received: by 2002:a17:902:6ac2:: with SMTP id i2-v6mr2853165plt.368.1519933125597; Thu, 01 Mar 2018 11:38:45 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:0:1000:1501:38e4:86fe:ec0c:4007]) by smtp.gmail.com with ESMTPSA id j19sm6026555pfh.26.2018.03.01.11.38.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 11:38:44 -0800 (PST) From: Douglas Anderson To: Catalin Marinas , Will Deacon Subject: [PATCH] arm64/debug: Fix registers on sleeping tasks Date: Thu, 1 Mar 2018 11:38:03 -0800 Message-Id: <20180301193803.129195-1-dianders@chromium.org> X-Mailer: git-send-email 2.16.2.395.g2e18187dfd-goog X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180301_113857_067385_BDA7F49D X-CRM114-Status: GOOD ( 12.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: briannorris@chromium.org, Douglas Anderson , evgreen@chromium.org, linux-kernel@vger.kernel.org, Ingo Molnar , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This is the equivalent of commit 001bf455d206 ("ARM: 8428/1: kgdb: Fix registers on sleeping tasks") but for arm64. Nuff said. Signed-off-by: Douglas Anderson --- arch/arm64/kernel/kgdb.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c index 2122cd187f19..01285d4dcdc3 100644 --- a/arch/arm64/kernel/kgdb.c +++ b/arch/arm64/kernel/kgdb.c @@ -138,14 +138,26 @@ int dbg_set_reg(int regno, void *mem, struct pt_regs *regs) void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task) { - struct pt_regs *thread_regs; + struct thread_struct *thread = &task->thread; + struct cpu_context *cpu_context = &thread->cpu_context; /* Initialize to zero */ memset((char *)gdb_regs, 0, NUMREGBYTES); - thread_regs = task_pt_regs(task); - memcpy((void *)gdb_regs, (void *)thread_regs->regs, GP_REG_BYTES); - /* Special case for PSTATE (check comments in asm/kgdb.h for details) */ - dbg_get_reg(33, gdb_regs + GP_REG_BYTES, thread_regs); + + gdb_regs[19] = cpu_context->x19; + gdb_regs[20] = cpu_context->x20; + gdb_regs[21] = cpu_context->x21; + gdb_regs[22] = cpu_context->x22; + gdb_regs[23] = cpu_context->x23; + gdb_regs[24] = cpu_context->x24; + gdb_regs[25] = cpu_context->x25; + gdb_regs[26] = cpu_context->x26; + gdb_regs[27] = cpu_context->x27; + gdb_regs[28] = cpu_context->x28; + gdb_regs[29] = cpu_context->fp; + + gdb_regs[31] = cpu_context->sp; + gdb_regs[32] = cpu_context->pc; } void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)