From patchwork Fri Mar 3 02:57:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 658460 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp226015wrb; Thu, 2 Mar 2023 19:00:55 -0800 (PST) X-Google-Smtp-Source: AK7set+28Mx1OOUjZvr4yCgWHpc+IiPw/JaxPX4MfJejQ6dD6yGevbPD6e9BfOoTw+gJuTylRxa7 X-Received: by 2002:ac8:5b84:0:b0:3bf:d48e:26c4 with SMTP id a4-20020ac85b84000000b003bfd48e26c4mr742457qta.39.1677812455347; Thu, 02 Mar 2023 19:00:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677812455; cv=none; d=google.com; s=arc-20160816; b=1LIjqE9Xv032v7MC0+t2AjEEzCtaj+mwPP3lHv+jTb2IEALTQIBbGIrda+pXrLGJ/e gMzTQBfs9eGEP6UfJDWhy4Aft4NJJQdDxtr8MJD2CbmtkhqlRokfmCv5KgrNR4NKuMjA /fXPry5mjwh7OcLa4lVoAVpi7vJgFJtZhcFQodj26mJwF6hGnUPZvN52+xd27kdR8fdG zFqMFNtJdWO+a2zkUnE//pIxjFu8n8c57ZQbUQLDnhk1VnXDGfx1xpPlmtzLrguEhhx4 L5EUVhvVyqBDX7vXxnZzng9ZF3Xcl1zvl/bmTQ+XiUOsAeaZQ42hBSLBc4gitfZmFGqf mvSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mzQlLd9zUuaRJux4t6YnHFCedCjY2bATUZGlQrOk4kk=; b=psp7vOqsWZtQsYUdELZgOL13WNrcQBe4DJdZDgJjM0dIBa9x4SaILRh82M+rGkD3fE 65/fcxboV1EQ3nlyB4Zw0Ru9H6WQVgPRl8UyFuxVIBnGMuGHRvlBzwG8nI2hwOzL5qK3 Iw0hfARouTL+okp1ajrG7Bt6+XDIlj5sjr5nW9mw+Mbl/M4x4DE3/VhfsOeDVnqLpy1l lA8V3tLavduxQVaueHS7eaBwX+l2fwyYrAODxFrZ9MzoSGzrsvRDjWMbV3JDTnN7AncY z0LNppNXUT7yRYf1djlXvP68NqVHhd67jDaqakfCWVcnly0ESU54XQ34aaUmLT1sb2/K /drg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qq5GgzVX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z13-20020ac87f8d000000b003b9a47ccfc5si988561qtj.313.2023.03.02.19.00.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2023 19:00:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qq5GgzVX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXvcm-0007Ut-43; Thu, 02 Mar 2023 21:58:24 -0500 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 1pXvcj-0007Sh-2k for qemu-devel@nongnu.org; Thu, 02 Mar 2023 21:58:21 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXvch-0001pk-EY for qemu-devel@nongnu.org; Thu, 02 Mar 2023 21:58:20 -0500 Received: by mail-pl1-x632.google.com with SMTP id ky4so1363141plb.3 for ; Thu, 02 Mar 2023 18:58:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677812298; 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=mzQlLd9zUuaRJux4t6YnHFCedCjY2bATUZGlQrOk4kk=; b=qq5GgzVXiFtb7paXe24HRWNpHl4VWdQqJbfqpdqEnYKpVQHUVCyEzd6csff+ybYZTp ZqUiugksfFt9qSpL17V2Vghs0Gt/1Wn6ICdVbKu8d6wGY47fM+sF6ZEJniMMNPORRiif eLzLMEcapxYvd+PflyyKBH5G5rb7lI9fXaKMmO+7cDGFKcMdzpD33D7Y9oWA+OYpkBjl 16S5b6UfwDBuR/YVPHb8BMp+LXqYO1fR9DAl4qZ4uviwpK1kltmfE525Q4yEAaMD3d5T SGWPdyL949YyeVe65aZGJvbkZMHAvEkIPQHiVxc2/l35QGofSa16ZgildD9FgCvQwzCl Laig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677812298; 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=mzQlLd9zUuaRJux4t6YnHFCedCjY2bATUZGlQrOk4kk=; b=ohO5DNfBn4BxChxRBwjk9eIWBM0d9eudKorCjaSaY8ETp2gP7C8ljyUSryy7hggYw4 lUjtQXEYnvw5qUwpT9Ii0O8L8uIsKDller2yGscwz9eqQ5953/nsZ4zr83OyDF6fPROx a+YmvdAY4Zimx9KImLsKwZKYEaqrFnlEZvGbqi8j3/XzbmxYCTJv1xejDkYa/JU9BxpP bXxEEwVGwVNUFLbDjgnXlZS3lcf4s83xlStzTdfMxfi/28RaQu5EjRKsS3LF0PVlbzbA PL3BlL2OF0rrRMBsWGcIX7pLKhWoPjhPewKERZXRez0d2SKAobt7id7uN/7r2voE5HH1 5KpQ== X-Gm-Message-State: AO0yUKWibLZ7B7BrotORvDq0TQgj3wpFvSUjMJxx9/y7pYhRL43cq+is wcPPfyPbljnNkxuxM6qGbwxecFbAnlib01KdLNA= X-Received: by 2002:a17:903:32cf:b0:19a:8e52:ce0 with SMTP id i15-20020a17090332cf00b0019a8e520ce0mr585261plr.58.1677812297862; Thu, 02 Mar 2023 18:58:17 -0800 (PST) Received: from stoup.. ([2602:ae:154a:9f01:f3e6:4626:fbc8:b2ce]) by smtp.gmail.com with ESMTPSA id e4-20020a17090301c400b001992e74d055sm372244plh.12.2023.03.02.18.58.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 18:58:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org Subject: [PATCH v4.5 12/29] gdbstub: rationalise signal mapping in softmmu Date: Thu, 2 Mar 2023 18:57:48 -0800 Message-Id: <20230303025805.625589-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230303025805.625589-1-richard.henderson@linaro.org> References: <20230303025805.625589-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Alex Bennée We don't really need a table for mapping two symbols. Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20230302190846.2593720-13-alex.bennee@linaro.org> --- gdbstub/softmmu.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c index a6c196ade6..6796761fd9 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -506,20 +506,14 @@ enum { TARGET_SIGTRAP = 5 }; -static int gdb_signal_table[] = { - -1, - -1, - TARGET_SIGINT, - -1, - -1, - TARGET_SIGTRAP -}; - int gdb_signal_to_target(int sig) { - if (sig < ARRAY_SIZE(gdb_signal_table)) { - return gdb_signal_table[sig]; - } else { + switch (sig) { + case 2: + return TARGET_SIGINT; + case 5: + return TARGET_SIGTRAP; + default: return -1; } }