From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9825C433F5 for ; Sat, 29 Jan 2022 00:09:25 +0000 (UTC) Received: from localhost ([::1]:47142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDbIx-0004Fb-TI for qemu-devel@archiver.kernel.org; Fri, 28 Jan 2022 19:09:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDafr-0000kb-KE for qemu-devel@nongnu.org; Fri, 28 Jan 2022 18:29:01 -0500 Received: from [2607:f8b0:4864:20::134] (port=46750 helo=mail-il1-x134.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDafg-0001af-PT for qemu-devel@nongnu.org; Fri, 28 Jan 2022 18:28:58 -0500 Received: by mail-il1-x134.google.com with SMTP id e8so6733367ilm.13 for ; Fri, 28 Jan 2022 15:28:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+J/ZcXBMkl7vIRUbXRkoafaooBA4s7iAGTsSYqX/VvY=; b=OtRKQ0OyHjbDTlZb8uDTFiqizwycj/piUQPqgrK1iBRncpZuiPHVjYopHPonWSq9nW y8B32pggl4KSoyyv6Hc1JrxZkoW4B+DYQpVxrWiZlgbMGZC+wn+FGqexEKciucMSgabN IAJQo6r5wveXmlWmdPZzAzELriWBiAIsBrzY5wDTlTUHhUhScK+CqQnaFTD+6cJC08+W xJCt+sxatQerdvoJt/csygEjXOZK5YDnlV4aO3iS+ngtTML5vrzANDVfkvuNRsBHhBYT R6Y8astKPWv0InG8VIOOxTL41a2sf5GnNNW4Cd0kkQZrqpKuhnKK0ulG0wf9OOm5sL8L aFqg== 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=+J/ZcXBMkl7vIRUbXRkoafaooBA4s7iAGTsSYqX/VvY=; b=p5udkMpflq9sbC7oK+J2SBhYGATJRwjuWXj9Huv2VsCZEVRHFUi9UjBJQf5Bofc24t RRGyH5MIunFps9FyAWjbUqhxEby8kIR70cAVMc5IyyZQynGIVVL+FGnCyrH43clm8YBw nYs8h2XwN1d4zuVBboJ6yZLuwPc9IJ3DTfmSU5Bb0zlwIano4T5BrHVTRPjKhAa1tmVi Jl7EHmEO+UANaOos4s6LLEz/9qOZbPVI13f43goVq9ndq/tsAULUDCX3rN6kgjMfs/ne wAydr6zE3MU8dEqYsQNKTv9xcCx2VhkPm9kczhI0OAWc4zTc8clPDi6Q1NF6d5ZpiH/9 vWTA== X-Gm-Message-State: AOAM531uZ+n4n01fGJ+NANnba6cDuHsVJQxYbbKaDubiBIZ3xOklimaI V6/9fv0O0FwV8u8pBS8se65OEqcfY9fTMg== X-Google-Smtp-Source: ABdhPJz9VaoGPFK7v6ISWipt17w5dy1ddBB+AWVTZzUfYaY0cxGEEbWFums4qIX1v1uMBaJ5lKOHgg== X-Received: by 2002:a05:6e02:b4f:: with SMTP id f15mr7631077ilu.265.1643412505450; Fri, 28 Jan 2022 15:28:25 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id o11sm14323111ilm.20.2022.01.28.15.28.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 15:28:25 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v3 21/40] bsd-user/host/x86_64/host-signal.h: Implement host_signal_* Date: Fri, 28 Jan 2022 16:27:46 -0700 Message-Id: <20220128232805.86191-22-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128232805.86191-1-imp@bsdimp.com> References: <20220128232805.86191-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::134 (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::134; envelope-from=imp@bsdimp.com; helo=mail-il1-x134.google.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Peter Maydell , Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Implement host_signal_pc, host_signal_set_pc and host_signal_write for x86_64. Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson --- bsd-user/host/x86_64/host-signal.h | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 bsd-user/host/x86_64/host-signal.h diff --git a/bsd-user/host/x86_64/host-signal.h b/bsd-user/host/x86_64/host-signal.h new file mode 100644 index 00000000000..47ca19f8814 --- /dev/null +++ b/bsd-user/host/x86_64/host-signal.h @@ -0,0 +1,37 @@ +/* + * host-signal.h: signal info dependent on the host architecture + * + * Copyright (c) 2021 Warner Losh + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef X86_64_HOST_SIGNAL_H +#define X86_64_HOST_SIGNAL_H + +#include +#include +#include +#include + +static inline uintptr_t host_signal_pc(ucontext_t *uc) +{ + return uc->uc_mcontext.mc_rip; +} + +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.mc_rip = pc; +} + +static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) +{ + /* + * Look in sys/amd64/amd64/trap.c. NOTE: mc_err == tr_err due to type + * punning between a trapframe and mcontext on FreeBSD/amd64. + */ + return uc->uc_mcontext.mc_trapno == T_PAGEFLT && + uc->uc_mcontext.mc_err & PGEX_W; +} + +#endif -- 2.33.1