From patchwork Thu Jun 27 18:03:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 807903 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp937596wrn; Thu, 27 Jun 2024 11:05:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXi2gkgyOVreN8/hefA7oO0Xi5V799NXihnaI4MynT7KVBVzjsVCwAXqMC/gv/u99qmFE2q3cl2auY+mrePD/ZB X-Google-Smtp-Source: AGHT+IEvNIU3uY87PpADygsF8f7GFO5sEPyjKhsyah4FCA1eajequTg1IPdb+8r1XXBbSo/dyzdn X-Received: by 2002:a4a:a54f:0:b0:5c2:2033:db19 with SMTP id 006d021491bc7-5c22033dcf0mr7909743eaf.5.1719511524569; Thu, 27 Jun 2024 11:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719511524; cv=none; d=google.com; s=arc-20160816; b=PT6WSpcpzUlrog57xXoOg19M891Gk60ADEjNyVsLBJDuP6OYLl5TSYPn1ve8HwOuwv I4mGKFE13H1ZtjfpX33ap08DhjMqibaf1g8pPDfBAW9EvpWsP4QOp+FBVUx4gCxD3f8S 68QHnPDYUIMAbFTLH3OSEIRuryTiKwk+6WoYNuxyAD6SesHW65IMpMRdWq3Cqwh1BeTf 5A2451SzTH+VaiVwriih4OG8COgupqDWm6mtjBjLL3e5ls6fcyWchi21waH9lwnoQOJt YjPv81il4w6TZPm8DRY/iUizYL/hJDdjxI5nRL5FKlHT7NjorFOeO8Z09mnwUM8/oO9F WTAA== 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=TAEbuMWRBzQhtzD9qy0BIESVSrOd35nsQcBa/S7f+Kw=; fh=kyPrIR1BE4roCkZQ1B6IGIhtuBXZ6jnqUwWV6BJmstw=; b=Ho7o+CZ0tnoLrN4MvchL4P1CWU3Ju8jGP2agHhw0UIc+fSmRxU6rurjYoYjCx27lyk x1JodK8reXO2shD6CnDQ+k7p6fIrwy1mmT5Zpi/gx4KprCyA4G9E4KEsiM5dksRQn7MI A04UbXoxtmJ/l4TNYDnJq0G9gIqK64UOG4sSkH7jopb6fVZLaj04UfUA22glky94+By4 0GgOfYMR8XAxDwepkyOfdXedQnq9s4hdH5qR9pyyY5DhDfFDdCUwV9KWrA46iAh+zQdc Vq7djhJ/9i9JHFP0dsmwmCTV/I4Txlg6mF7e0yHeJaXp9jl5gLr+/K5J8cIJJ0hMIq7A O2eA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ucUhODRp; 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 71dfb90a1353d-4f29224e45asi44668e0c.140.2024.06.27.11.05.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 11:05:24 -0700 (PDT) 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=ucUhODRp; 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 1sMtTh-0001Ad-Ch; Thu, 27 Jun 2024 14:04:13 -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 1sMtTe-0001A1-8V for qemu-devel@nongnu.org; Thu, 27 Jun 2024 14:04:10 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMtTP-0001M1-8j for qemu-devel@nongnu.org; Thu, 27 Jun 2024 14:04:09 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-7178ba1c24bso4587360a12.3 for ; Thu, 27 Jun 2024 11:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719511434; x=1720116234; 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=TAEbuMWRBzQhtzD9qy0BIESVSrOd35nsQcBa/S7f+Kw=; b=ucUhODRpQUnzl5mVD1nKMZl4ptEf1xudg8JOp+PRtq1tiVI6X6bZmfMDY90U7y82iG topoq18AfXYQEaym2iTKmSaAzus09cUqEor2k41CHxEVJyghRVIGowz9WiGxCFUJbtCI MUpV+9/SdL13cjZtM403LEKGVzjYxOlcV4djUkVgCKj9Vu16VW6Z8Y/yP4cG2aYH2AvR ODk5GpU27rY7MzUtJfhwUhjSmNFlctplOatV1HXsvkc1xsYU/sDYRsyj2Ch3SDrXUtCL 7s+euDVusjhGT92ZW6et+Ui6/Wu01JC9Xby1MWmX7fgvR/qopbLUy6MWFi5VdGXeGY1U J79w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719511434; x=1720116234; 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=TAEbuMWRBzQhtzD9qy0BIESVSrOd35nsQcBa/S7f+Kw=; b=oVyB2UtvjEHGTyqx+0cBoiGn5/+by7Mijxbzk7fXNDFbAINN130wurSfC6hp1KgxBY 4JDFTlhyWEjeLXHU+Je28lItBAkFVvoovlz+C8+VCTI2a+5x6c5Ct8NqlAD1Js6NK+5i N3IFfULC4N4i50Oj6VfSKIhRWu75HBLIsqoN37iXiDJFuvIlZggqhYeK5E8MhWtVDP25 BFsLpou8B5pB2cHeNOOGCPM3yoU8DGjCYZ6us1OSClnQ3kRy4wNLdUd9RrT9trd/Y/16 wILUl5OmWPt+9YnTLPPJk4ZVS8Y0w65jwHgCDcqEe6wH4wbymmZn7/YbfBaPH1dRWzHv t/vg== X-Gm-Message-State: AOJu0Yz2HRMtcufPbSR4soC6ghiM7q6onh90074Yz+lC7mrcPYDz/w/p 27D0s/60eQ1TwymDr5qtEkiA7VadzgHWPGlQU/JfZrdCoPecVvqjGhFfnO1Ytda1dd2htmlOO82 m X-Received: by 2002:a05:6a21:3289:b0:1be:cea5:c77e with SMTP id adf61e73a8af0-1becea5cf6fmr3546140637.7.1719511433704; Thu, 27 Jun 2024 11:03:53 -0700 (PDT) Received: from stoup.. (174-21-76-141.tukw.qwest.net. [174.21.76.141]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70803ecf764sm2170b3a.106.2024.06.27.11.03.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 11:03:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: brad@comstyle.com, Alistair.Francis@wdc.com, palmer@dabbelt.com, qemu-riscv@nongnu.org Subject: [PATCH 2/3] util/cpuinfo-riscv: Support OpenBSD signal frame Date: Thu, 27 Jun 2024 11:03:49 -0700 Message-Id: <20240627180350.128575-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240627180350.128575-1-richard.henderson@linaro.org> References: <20240627180350.128575-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reported-by: Brad Smith Signed-off-by: Richard Henderson --- util/cpuinfo-riscv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/util/cpuinfo-riscv.c b/util/cpuinfo-riscv.c index 6b97100620..abf799794f 100644 --- a/util/cpuinfo-riscv.c +++ b/util/cpuinfo-riscv.c @@ -13,7 +13,14 @@ static void sigill_handler(int signo, siginfo_t *si, void *data) { /* Skip the faulty instruction */ ucontext_t *uc = (ucontext_t *)data; + +#ifdef __linux__ uc->uc_mcontext.__gregs[REG_PC] += 4; +#elif defined(__OpenBSD__) + uc->sc_sepc += 4; +#else +# error Unsupported OS +#endif got_sigill = 1; }