From patchwork Wed Apr 20 06:50:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1619366 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=h8CTAlYn; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kjrv65r6Mz9sG0 for ; Wed, 20 Apr 2022 16:52:02 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Kjrv650mFz3bXg for ; Wed, 20 Apr 2022 16:52:02 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=h8CTAlYn; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::52d; helo=mail-pg1-x52d.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=h8CTAlYn; dkim-atps=neutral Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Kjrv16ZmHz2ym7 for ; Wed, 20 Apr 2022 16:51:57 +1000 (AEST) Received: by mail-pg1-x52d.google.com with SMTP id q12so764712pgj.13 for ; Tue, 19 Apr 2022 23:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J9VsGIBe8KCPpVBsSbC6xzBHKxHnwZUw+RARbf24C1I=; b=h8CTAlYnrQpxT9tIV7L1eaQf1SPFz/EQdKkMazhs202DcxFhX3mgkHozWtnkMh/JZz 4ZS8iito98cPNLvAHH+jKkvbR8NdWsee9zRwdmerQ++/Gi0yWgGCIrr087x2jIb8Jd1D cOy57IpdlkqciTQdVVMm/tNYna1B+L9g+SYzLw3mwi7sASH4fw2U6uHAcZkh+cxqTQWE ls0qrsfXXGBVe9DsCIYfOpCmrGZHGICDn6A8u+3+ocw19hWocccuFNYZ7xMVv1wOSVWs 5LrxOAmVauo7qynWaztuOSl57o1sfvGpG1QGBMmILp76AXXJ7aTGR+ZR0H6+dklCH2O8 z1/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J9VsGIBe8KCPpVBsSbC6xzBHKxHnwZUw+RARbf24C1I=; b=hPoCrpeywxF2jIu9cY7Lfx7k81jTMy5UST84HRTA2wvmbars8IBs+WgXjUkEygLBjC Y7szfpiW1vARxALmOKlMUThMCTe8eoVoLwcJnCBeHqMMgQ6zCr9cvMhOQSrog8Y39u9c 1vg0OfM361lDUjS2lGq2pbMX5T+KQHMd6XTfuPaSvnAmrNnRd2AlemmsnYUkhejX1zAg 4V1lWx15vos+0txrt/2MPicVRh5EVWJaD6KxWHwzqjVttQ69o7nb7+op2dNJJ4TdFhG8 Ia8zLqKvxf5wo5rYHGXHGVCH+XfqD21En3EP1IT6HAoVRa6Isg00h9r9dbkqQfBkLt+/ XpkQ== X-Gm-Message-State: AOAM5330BHrlMmTxPDbjqGXRqB9tPqQTQarRnkMdqEVC8mdAugn57tC8 UCEoY14EUS0Tp8ARRUMNZWw0+/ns3h46PA== X-Google-Smtp-Source: ABdhPJyTqOm/8/GzzwiUZC8pueh4VKcUoDuBkHSgy9hJwodAp45XecXCQXhbo2qpoUncuJVgi/trfw== X-Received: by 2002:a63:450d:0:b0:3a8:f2ed:1aa5 with SMTP id s13-20020a63450d000000b003a8f2ed1aa5mr14997567pga.367.1650437515738; Tue, 19 Apr 2022 23:51:55 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([203.221.203.144]) by smtp.gmail.com with ESMTPSA id x20-20020aa79574000000b005061f4782c5sm18481235pfq.183.2022.04.19.23.51.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 23:51:55 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Wed, 20 Apr 2022 16:50:13 +1000 Message-Id: <20220420065013.222816-40-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220420065013.222816-1-npiggin@gmail.com> References: <20220420065013.222816-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 39/39] gdbserver: remove fallback breakpoint support in put_mem X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" With breakpoint ops implemented, gdb does not need to write its break op using memory-ops. Remove the breakpoint logic from the memory-write command. Signed-off-by: Nicholas Piggin Reviewed-by: Joel Stanley --- src/pdbgproxy.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c index cc73a36d..13b72408 100644 --- a/src/pdbgproxy.c +++ b/src/pdbgproxy.c @@ -603,8 +603,6 @@ static void put_mem(uint64_t *stack, void *priv) { uint64_t addr, len; uint8_t *data; - uint8_t attn_opcode[] = {0x00, 0x00, 0x02, 0x00}; - uint8_t gdb_break_opcode[] = {0x7d, 0x82, 0x10, 0x08}; int err = 0; addr = stack[0]; @@ -618,38 +616,6 @@ static void put_mem(uint64_t *stack, void *priv) goto out; } - if (len == 4 && !memcmp(data, gdb_break_opcode, 4)) { - uint64_t msr; - - /* Check endianess in MSR */ - err = thread_getmsr(thread_target, &msr); - if (err) { - PR_ERROR("Couldn't read the MSR. Are all threads on this chiplet quiesced?\n"); - goto out; - } - if (msr & 1) { /* little endian */ - attn_opcode[1] = 0x02; - attn_opcode[2] = 0x00; - } - - /* According to linux-ppc-low.c gdb only uses this - * op-code for sw break points so we replace it with - * the correct attn opcode which is what we need for - * breakpoints. - * - * TODO: Upstream a patch to gdb so that it uses the - * right opcode for baremetal debug. */ - - PR_INFO("Breakpoint opcode detected, replacing with attn\n"); - memcpy(data, attn_opcode, 4); - - /* Need to enable the attn instruction in HID0 */ - if (set_attn(true)) { - err = 2; - goto out; - } - } - if (write_memory(addr, len, data, 8)) { PR_ERROR("Unable to write memory\n"); err = 3;