From patchwork Tue Mar 29 15:49:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1610720 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=BoET/a9+; 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 4KSYvB33l1z9sFk for ; Wed, 30 Mar 2022 02:51:02 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KSYvB2D8Kz2xvv for ; Wed, 30 Mar 2022 02:51:02 +1100 (AEDT) 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=BoET/a9+; 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::1036; helo=mail-pj1-x1036.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=BoET/a9+; dkim-atps=neutral Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 4KSYv814pxz2xfP for ; Wed, 30 Mar 2022 02:51:00 +1100 (AEDT) Received: by mail-pj1-x1036.google.com with SMTP id o3-20020a17090a3d4300b001c6bc749227so3308427pjf.1 for ; Tue, 29 Mar 2022 08:51:00 -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=3p590vNkPmwGGmVyewt9nVSJJxUU1xdowYrQdntA/IU=; b=BoET/a9+RkyLM8W7vlouxyZjknLvvjycmq25KTbuaR0esFqzLVTr8WZrK3i/7/Ynkl 8Rb3nIFbpPJVa6qIuaDDtrZkwjXzokWi10WnqIZj8fRhstYoj2YicBtnUGbhz//tpN5e ErPQUwRRYlXzsdbfb6RYAZrteVZa1/5UsLdYo4KbnYZbWihcA2B1ct1chq2hEfA1/PR+ 0BmO2IWGynoSaxeI3/Uukw+X2dnk0KNqnvi6QRmFVMbHXnsUxDjY7Lhy4QnA/T7rDj5T 1l3lOu+b0PeW/nTRK+GClCC3fL1poCHjM/U84AG4r01yNfSCwd4wHsOPSo6KnMIT1MjV ITNQ== 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=3p590vNkPmwGGmVyewt9nVSJJxUU1xdowYrQdntA/IU=; b=YwI9Q5TuMK6WMP15m/6aQwcrm52NC9xqudVvOccu6czbIYNd5Fq2BfKC01/QSqr8wy Z/8GpfwoC8BtHvvrrASOuIIpbQ7BW/9Mbar3abyLyacBv77MMVH7Z8v2cCluH7R1pqq3 23NP09MMwqYg1b85c4MYvW8hiFIirwXfQ0IBcxfaA4SOSsk5NPqPp6D0hZpFmHwmwuG6 IV5Hw/AV2o5ZMm0PsO2rjsorqOZ7ygAQvfOIVwUh2Ei9zn3Ttq+chQGpSM2QxBIsHNvj /CD1B7UGQE/2KqikQXdIBrI0sdJKvUbcVYAd8hYZlafwj89nchbbiZ6qY5nljXevU8Tq IfCA== X-Gm-Message-State: AOAM53317kXrGz+aeRsDsqEnCwNjmy9HYbVigOsOg8X+b/ZZ43TM1X8z nEQ4q0rYXFVOXJF9fv+uBlMsdEfGBYw= X-Google-Smtp-Source: ABdhPJxjdNzWkeNJBCAtMSQdKjORovpDKnPNa0xTWA/L0pWkcPZWthBonNMQ3wC0P//z6iV+6pgRZQ== X-Received: by 2002:a17:903:18c:b0:154:9ee:ced3 with SMTP id z12-20020a170903018c00b0015409eeced3mr30963900plg.170.1648569058338; Tue, 29 Mar 2022 08:50:58 -0700 (PDT) Received: from bobo.ibm.com (58-6-255-110.tpgi.com.au. [58.6.255.110]) by smtp.gmail.com with ESMTPSA id s35-20020a056a001c6300b004fb20b5d6c1sm14163564pfw.40.2022.03.29.08.50.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Mar 2022 08:50:58 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Wed, 30 Mar 2022 01:49:31 +1000 Message-Id: <20220329154931.493851-39-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220329154931.493851-1-npiggin@gmail.com> References: <20220329154931.493851-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 38/38] 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 directly, which allows that hackly logic to be removed. Signed-off-by: Nicholas Piggin --- src/pdbgproxy.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c index c257361..f4b592e 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"); - data = attn_opcode; - - /* 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;