From patchwork Fri Nov 5 03:18:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551200 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=A356aFL5; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmD324Sfz9sf8 for ; Fri, 5 Nov 2021 14:27:47 +1100 (AEDT) Received: from localhost ([::1]:41300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miptJ-0007nP-2x for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:27:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplh-0004G1-J9 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:54 -0400 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]:46871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipld-00042u-Pv for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:53 -0400 Received: by mail-il1-x134.google.com with SMTP id w10so8225761ilc.13 for ; Thu, 04 Nov 2021 20:19:49 -0700 (PDT) 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=N4lcEk/ClAeFeQ3e0ZN2TFMzonlfqSNAu0iwaNY3yxc=; b=A356aFL5/27F4ADePxdAXUUKDYnR0qufKDZpDDOE+m4epfikrV/5Ofowb9wrmezTf8 PWSdG7LrRs/VyYWd8nbV1BN3EObH/PpaIavrlm+2aWADvRQaJVFAOFfgC8UKm6BmuLSs j8f4JhI29zhrCw8eqDG8bphJ11MrX9UwyooySpCVSeNnCVpMay0ZZng1IW3OOfMWDAML 65gYm08ILpnAVEN9u9rjdQuZPYcDIsAYKXdYn2hrSohDR2kFU9zC+diiz+3/FQVBlhiQ xHVOEGD/E9u/b7695aJiVqOn/pDeZpB3H1MOSbDXp5nAFJAODXqRofzc5r3MmLqggJOM /bUg== 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=N4lcEk/ClAeFeQ3e0ZN2TFMzonlfqSNAu0iwaNY3yxc=; b=6ulR/g11/WqRh7CMruGTVj4LSPe8lIws6+mPtIPfwDVPre9ItAdHfMZks5+emMFp2f MbLKEupsloybdsbKKz9qFU0brwqstL44U9JbWMoCgBE2qAihfAE712q5Hx5mLY1hvWGg 3V4h8ZApDgy2WY16uJn8rZYTaowdSSKHJFBHhCxjwCecP0VAtejNPKQPbJDSUw0mZ3O5 LJ6P1uEq8mFMJItMp33IxDhO44n9qw/ocgI9ECt0F301b3pKzjU48U1KsZxFDi9dEevs iClVQAmSs/d8/J7T8KTDqDp1YeAZYTQQFToIYvX5hqg/rpE1A0YwLtPgLUsH/UnyvCad w8eA== X-Gm-Message-State: AOAM530Mm34zN54Uj3U7JSFBKnWiJGcgbnFyOlGXF46rwSuAAnR8j7y7 HlJQ82iTLzwkHqXtVCZCvD0u5xvkH5fS2A== X-Google-Smtp-Source: ABdhPJxRXZTesQrzPNcQhI41F5F3vICaws7paZJ8ujgPe8XiUcm0elSw3FQI5/4B8TSkfO/XwhzW8A== X-Received: by 2002:a05:6e02:16c7:: with SMTP id 7mr15345161ilx.201.1636082387256; Thu, 04 Nov 2021 20:19:47 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:46 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 01/36] bsd-user/mips*: Remove Date: Thu, 4 Nov 2021 21:18:42 -0600 Message-Id: <20211105031917.87837-2-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" FreeBSD has dropped support for mips starting with FreeBSD 14. mips support has been removed from the bsd-user fork because updating it for new signal requirements. Remove it here since it is a distraction. Signed-off-by: Warner Losh Acked-by: Richard Henderson Acked-by: Richard Henderson --- bsd-user/mips/target_arch_sysarch.h | 69 --------------------------- bsd-user/mips/target_syscall.h | 52 -------------------- bsd-user/mips64/target_arch_sysarch.h | 69 --------------------------- bsd-user/mips64/target_syscall.h | 53 -------------------- 4 files changed, 243 deletions(-) delete mode 100644 bsd-user/mips/target_arch_sysarch.h delete mode 100644 bsd-user/mips/target_syscall.h delete mode 100644 bsd-user/mips64/target_arch_sysarch.h delete mode 100644 bsd-user/mips64/target_syscall.h diff --git a/bsd-user/mips/target_arch_sysarch.h b/bsd-user/mips/target_arch_sysarch.h deleted file mode 100644 index 6da803a408..0000000000 --- a/bsd-user/mips/target_arch_sysarch.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * mips sysarch() system call emulation - * - * Copyright (c) 2013 Stacey D. Son - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef BSD_USER_ARCH_SYSARCH_H_ -#define BSD_USER_ARCH_SYSARCH_H_ - -#include "target_syscall.h" -#include "target_arch.h" - -static inline abi_long do_freebsd_arch_sysarch(CPUMIPSState *env, int op, - abi_ulong parms) -{ - int ret = 0; - - switch (op) { - case TARGET_MIPS_SET_TLS: - target_cpu_set_tls(env, parms); - break; - - case TARGET_MIPS_GET_TLS: - if (put_user(target_cpu_get_tls(env), parms, abi_ulong)) { - ret = -TARGET_EFAULT; - } - break; - - default: - ret = -TARGET_EINVAL; - break; - } - - return ret; -} - -static inline void do_freebsd_arch_print_sysarch( - const struct syscallname *name, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6) -{ - - switch (arg1) { - case TARGET_MIPS_SET_TLS: - gemu_log("%s(SET_TLS, 0x" TARGET_ABI_FMT_lx ")", name->name, arg2); - break; - - case TARGET_MIPS_GET_TLS: - gemu_log("%s(GET_TLS, 0x" TARGET_ABI_FMT_lx ")", name->name, arg2); - break; - - default: - gemu_log("UNKNOWN OP: %d, " TARGET_ABI_FMT_lx ")", (int)arg1, arg2); - } -} - -#endif /*!BSD_USER_ARCH_SYSARCH_H_ */ diff --git a/bsd-user/mips/target_syscall.h b/bsd-user/mips/target_syscall.h deleted file mode 100644 index aacc6ddf9f..0000000000 --- a/bsd-user/mips/target_syscall.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * mips system call definitions - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ -#ifndef _MIPS_SYSCALL_H_ -#define _MIPS_SYSCALL_H_ - -/* - * struct target_pt_regs defines the way the registers are stored on the stack - * during a system call. - */ - -struct target_pt_regs { - /* Saved main processor registers. */ - abi_ulong regs[32]; - - /* Saved special registers. */ - abi_ulong cp0_status; - abi_ulong lo; - abi_ulong hi; - abi_ulong cp0_badvaddr; - abi_ulong cp0_cause; - abi_ulong cp0_epc; -}; - -#if defined(TARGET_WORDS_BIGENDIAN) -#define UNAME_MACHINE "mips" -#else -#define UNAME_MACHINE "mipsel" -#endif - -#define TARGET_HW_MACHINE "mips" -#define TARGET_HW_MACHINE_ARCH UNAME_MACHINE - -/* sysarch() commands */ -#define TARGET_MIPS_SET_TLS 1 -#define TARGET_MIPS_GET_TLS 2 - -#endif /* !_MIPS_SYSCALL_H_ */ diff --git a/bsd-user/mips64/target_arch_sysarch.h b/bsd-user/mips64/target_arch_sysarch.h deleted file mode 100644 index e6f9c00d5f..0000000000 --- a/bsd-user/mips64/target_arch_sysarch.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * mips64 sysarch() system call emulation - * - * Copyright (c) 2013 Stacey D. Son - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef BSD_USER_ARCH_SYSARCH_H_ -#define BSD_USER_ARCH_SYSARCH_H_ - -#include "target_syscall.h" -#include "target_arch.h" - -static inline abi_long do_freebsd_arch_sysarch(CPUMIPSState *env, int op, - abi_ulong parms) -{ - int ret = 0; - - switch (op) { - case TARGET_MIPS_SET_TLS: - target_cpu_set_tls(env, parms); - break; - - case TARGET_MIPS_GET_TLS: - if (put_user(target_cpu_get_tls(env), parms, abi_ulong)) { - ret = -TARGET_EFAULT; - } - break; - - default: - ret = -TARGET_EINVAL; - break; - } - - return ret; -} - -static inline void do_freebsd_arch_print_sysarch( - const struct syscallname *name, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6) -{ - - switch (arg1) { - case TARGET_MIPS_SET_TLS: - gemu_log("%s(SET_TLS, 0x" TARGET_ABI_FMT_lx ")", name->name, arg2); - break; - - case TARGET_MIPS_GET_TLS: - gemu_log("%s(GET_TLS, 0x" TARGET_ABI_FMT_lx ")", name->name, arg2); - break; - - default: - gemu_log("UNKNOWN OP: %d, " TARGET_ABI_FMT_lx ")", (int)arg1, arg2); - } -} - -#endif /*!BSD_USER_ARCH_SYSARCH_H_ */ diff --git a/bsd-user/mips64/target_syscall.h b/bsd-user/mips64/target_syscall.h deleted file mode 100644 index bf4c598b13..0000000000 --- a/bsd-user/mips64/target_syscall.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * mips64 system call definitions - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ -#ifndef _MIPS64_SYSCALL_H_ -#define _MIPS64_SYSCALL_H_ - -/* - * struct target_pt_regs defines the way the registers are stored on the stack - * during a system call. - */ - -struct target_pt_regs { - /* Saved main processor registers. */ - abi_ulong regs[32]; - - /* Saved special registers. */ - abi_ulong cp0_status; - abi_ulong lo; - abi_ulong hi; - abi_ulong cp0_badvaddr; - abi_ulong cp0_cause; - abi_ulong cp0_epc; -}; - - -#if defined(TARGET_WORDS_BIGENDIAN) -#define UNAME_MACHINE "mips64" -#else -#define UNAME_MACHINE "mips64el" -#endif - -#define TARGET_HW_MACHINE "mips" -#define TARGET_HW_MACHINE_ARCH UNAME_MACHINE - -/* sysarch() commands */ -#define TARGET_MIPS_SET_TLS 1 -#define TARGET_MIPS_GET_TLS 2 - -#endif /* !_MIPS64_SYSCALL_H_ */ From patchwork Fri Nov 5 03:18:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551193 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=cGhb2Bis; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hlm4l4ZNjz9sf8 for ; Fri, 5 Nov 2021 14:21:27 +1100 (AEDT) Received: from localhost ([::1]:52350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mipnB-0004Hc-G3 for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:21:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplg-0004EL-QD for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:52 -0400 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]:38411) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipld-00042y-O2 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:52 -0400 Received: by mail-il1-x135.google.com with SMTP id f10so8266611ilu.5 for ; Thu, 04 Nov 2021 20:19:49 -0700 (PDT) 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=MDPt+10pI2apuOo9dXdmFVld2os3PLc83HBDg8phZBs=; b=cGhb2BisdGQt9pQ+jOl57shUMusmZDfK7i7YyovASaM8LtIa+Onj8GDIWD/T1rEyaD Ttn7sIASZkG1U+a3mi/+H7steP9rE4ae7t+YUoUnkSLfPFF8q6tFszMmC0yzTqwhlSEU CQZRrD1NCrXsUQcQ6q3hdcrUhXcIzPrZ1nMaSorfqAgzGj7dTUSlG+zYRRplniFVbC/y h7O2LntKnBUTh9C/5KP6sKo2NhsW6JXazYT9tM47NwlBU09x3+jGa5rU0rk8AuSVCjFf TyehDt+egTUstqG9L9nATfTr027f2tqwpc4p99UcpVPGlaei9sZzy2YRy7SsPprFx/xy OsJA== 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=MDPt+10pI2apuOo9dXdmFVld2os3PLc83HBDg8phZBs=; b=6B42tD9C2TfqbeC4VfCkGR3CryBYn5OXuH0v6oRRLY6LZzGwWY+G8co97HIP0WJRt7 VEJxGJripYrJGojcA5aUe6QCcVwoyk2e0qJL/FJuHW+GlzUEV/RQ8km+YU13vOxDOFNY IiS71FbBORJFoVIDILn6Ms9/4yCQQxmZER7Zd9C+UpqJjo9bHQUTC7mlC2myqUrISxlo uPpm7I7J5w1Ohni0a9oTXJVOKpMuUJ8uoNvE8/ZfducRi6paQmmirkdLufzfVzLeXSqh fkTOISIiwueoxEm0pd4ESyRMax5rrsEx2zHPihKC2dvr8yVvxg2GmRVbbq2XFaeE3/Oh a49A== X-Gm-Message-State: AOAM531RJPPFpsTcAXHQo0Qarmul4L9U+pxFRuWxCw3FTLa7vhIvi/wH u/m1NIRLfrKNIzxnwS1RE+SmsiDEuy/lVQ== X-Google-Smtp-Source: ABdhPJyyNr6VGXtoH4vWJOIJmyrJly1Jp0Lj67zE6PoCh3B9DO/7+xLp419jcloOWNtwIFHmgppksg== X-Received: by 2002:a92:6412:: with SMTP id y18mr32996662ilb.178.1636082388232; Thu, 04 Nov 2021 20:19:48 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:47 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 02/36] bsd-user/freebsd: Create common target_os_ucontext.h file Date: Thu, 4 Nov 2021 21:18:43 -0600 Message-Id: <20211105031917.87837-3-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::135; envelope-from=imp@bsdimp.com; helo=mail-il1-x135.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" FreeBSD has a MI ucontext structure that contains the MD mcontext machine state and other things that are machine independent. Create an include file for all the ucontext stuff. It needs to be included in the arch specific files after target_mcontext is defined. This is largely copied from sys/_ucontext.h with the comments about layout removed because we don't support ancient FreeBSD binaries. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/target_os_signal.h | 3 --- bsd-user/freebsd/target_os_ucontext.h | 35 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 bsd-user/freebsd/target_os_ucontext.h diff --git a/bsd-user/freebsd/target_os_signal.h b/bsd-user/freebsd/target_os_signal.h index 1a4c5faf19..3ed454e086 100644 --- a/bsd-user/freebsd/target_os_signal.h +++ b/bsd-user/freebsd/target_os_signal.h @@ -1,9 +1,6 @@ #ifndef _TARGET_OS_SIGNAL_H_ #define _TARGET_OS_SIGNAL_H_ -/* FreeBSD's sys/ucontext.h defines this */ -#define TARGET_MC_GET_CLEAR_RET 0x0001 - #include "target_os_siginfo.h" #include "target_arch_signal.h" diff --git a/bsd-user/freebsd/target_os_ucontext.h b/bsd-user/freebsd/target_os_ucontext.h new file mode 100644 index 0000000000..1d0c3c4e65 --- /dev/null +++ b/bsd-user/freebsd/target_os_ucontext.h @@ -0,0 +1,35 @@ +/* + * FreeBSD has a common ucontext definition for all architectures. + * + * Copyright 2021 Warner Losh + * + * SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause + */ +#ifndef TARGET_OS_UCONTEXT_H +#define TARGET_OS_UCONTEXT_H + +/* + * Defines the common bits for all of FreeBSD's architectures. Has to be + * included AFTER the MD target_mcontext_t is defined, however, so can't + * be in the grab-bag that is target_os_signal.h. + */ + +/* See FreeBSD's sys/ucontext.h */ +#define TARGET_MC_GET_CLEAR_RET 0x0001 + +/* FreeBSD's sys/_ucontext.h structures */ +typedef struct target_ucontext { + target_sigset_t uc_sigmask; + target_mcontext_t uc_mcontext; + abi_ulong uc_link; + target_stack_t uc_stack; + int32_t uc_flags; + int32_t __spare__[4]; +} target_ucontext_t; + +#ifdef TARGET_MCONTEXT_SIZE +G_STATIC_ASSERT(TARGET_MCONTEXT_SIZE == sizeof(target_mcontext_t)); +G_STATIC_ASSERT(TARGET_UCONTEXT_SIZE == sizeof(target_ucontext_t)); +#endif /* TARGET_MCONTEXT_SIZE */ + +#endif /* TARGET_OS_UCONTEXT_H */ From patchwork Fri Nov 5 03:18:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551196 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=FL8PpF/b; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hlm8L3nr0z9sf8 for ; Fri, 5 Nov 2021 14:24:33 +1100 (AEDT) Received: from localhost ([::1]:60886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mipq9-00023w-Om for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:24:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplh-0004Fn-FS for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:53 -0400 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]:45719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplf-00043M-2B for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:53 -0400 Received: by mail-io1-xd32.google.com with SMTP id q203so9161676iod.12 for ; Thu, 04 Nov 2021 20:19:50 -0700 (PDT) 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=av0Dv2nhr+A9RjUWFgiLGe/ya97+oVzXha6GTTS/bK4=; b=FL8PpF/bRQjurmKXUiXCaEzmEmu1BIFgiiJo97Bntca3FNHooDZKmhcXvOALhlZXFT kwGRaFndRybwqQlCo6089MA5hlfFdFwer1/TPY1YvlHI6lITZc7SUwsklI2o2Y5nMD4j 9TKrZip2X1zxhfCer6QHwElBTKZFl4cI++A7bOJHPtpMYy51FoDK+nsJl0/sjZDBLoMm ORSEsNEGV4ZG4CD1KUuPB42o4nsWZJ+vIcLegA44GKiuIGdUp25L+W1y5vw956SqL2Yh BJsGqaXu+7/KYe8BTod1bSRvkmbRNxObWl1shmFHois0kJ6JVRNXM8SgsOnDFkbC+3EK BKaQ== 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=av0Dv2nhr+A9RjUWFgiLGe/ya97+oVzXha6GTTS/bK4=; b=DdqZ0odWfi/2nn0tSIgyUvS9tX1vtIbQeQCX3Oxvja9u/VbMTIfl8ZvFOAiJunqV4s 3YeUNNOFDn4fWtlyQgx/K1plSkpM4sd0aabA1fMTMXMlHsfibMsQM/+9dtdtKUoDW60C Bw0VF+8p6K3ypmsliEeILy80wd26DSDhhBkDsuytKdny7MUrgci3E32DXXoU4N8c+X0/ mZoL/ljm81cEsionzjwi5aM7vHVHHytowR2L8ABa6RjJQKneaAAgHuWAQ2VvV85gVcIT KsClThXG1+UKGjRzdPLmRKOQKPYwQwwBXVPHkymgPfS5v3THeFNRdZ798hAu9fz+K1xm 0JcQ== X-Gm-Message-State: AOAM530rwTI1vUwrSpaJTYLU44J22t+vuvOxrzH9olugMiIZFlJ30NCC T45bHOWOFAu+CiFbdZvB8OFTDs4u96L09A== X-Google-Smtp-Source: ABdhPJze3OlhIZYiAvDFxr/mQj024QZqGlPPdxsN09L8oX6kXJyhRRhWvTQmMeGil2Qk0QSaJ//JHQ== X-Received: by 2002:a05:6638:1606:: with SMTP id x6mr6760992jas.17.1636082389335; Thu, 04 Nov 2021 20:19:49 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:48 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 03/36] bsd-user: create a per-arch signal.c file Date: Thu, 4 Nov 2021 21:18:44 -0600 Message-Id: <20211105031917.87837-4-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d32; envelope-from=imp@bsdimp.com; helo=mail-io1-xd32.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Create a place-holder signal.c file for each of the architectures that are currently built. In the future, some code that's currently inlined in target_arch_signal.h will live here. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/signal.c | 1 + bsd-user/x86_64/signal.c | 1 + meson.build | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 bsd-user/i386/signal.c create mode 100644 bsd-user/x86_64/signal.c diff --git a/bsd-user/i386/signal.c b/bsd-user/i386/signal.c new file mode 100644 index 0000000000..ac90323365 --- /dev/null +++ b/bsd-user/i386/signal.c @@ -0,0 +1 @@ +/* Placeholder for signal.c */ diff --git a/bsd-user/x86_64/signal.c b/bsd-user/x86_64/signal.c new file mode 100644 index 0000000000..ac90323365 --- /dev/null +++ b/bsd-user/x86_64/signal.c @@ -0,0 +1 @@ +/* Placeholder for signal.c */ diff --git a/meson.build b/meson.build index 26c58123e9..14b0bb2042 100644 --- a/meson.build +++ b/meson.build @@ -2888,7 +2888,7 @@ foreach target : target_dirs base_dir = 'bsd-user' target_inc += include_directories('bsd-user/' / targetos) dir = base_dir / abi - arch_srcs += files(dir / 'target_arch_cpu.c') + arch_srcs += files(dir / 'signal.c', dir / 'target_arch_cpu.c') endif target_inc += include_directories( base_dir, From patchwork Fri Nov 5 03:18:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551202 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=HsDjNmtO; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmDM3tdMz9sf8 for ; Fri, 5 Nov 2021 14:28:03 +1100 (AEDT) Received: from localhost ([::1]:42760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miptZ-0000S5-8w for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:28:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipli-0004Gb-GQ for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:56 -0400 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]:33686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplg-00043d-HZ for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:54 -0400 Received: by mail-il1-x136.google.com with SMTP id l19so8322801ilk.0 for ; Thu, 04 Nov 2021 20:19:51 -0700 (PDT) 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=rOISPYYKecMk71RBzznUZbzYo3FGryyldBKKzRc7muU=; b=HsDjNmtOoFA6hBAH8rjKqis5saoGQ1Kk7UyzD0c8L2dKow0WG8ibimMhhexPMiGQDL UYNqXFbiz7QXWKpR6dz/rf40xqoJgKsnaJl4+iLIT5XX277VYCZTn378lS/xEX7JHxil +IbXyZQYVM0aVgPUtHMBKFa/MARhXlKCp6I3ykM/Q9eMYmh8cHZL2BLgllrv7xbmT+UP 2qCu3kiKvsAwfKphNC73FXfW91fmcCfB3tASKzA0BrmX992aF1oUjIBxtU6mzkbs9S5X CBFTzyzUxdcMEDSjbu4C7QeN8DVxhrIOGBkYUTv8G5dVYaKGAtIsfWE9+BbftuJSbfBl UHuA== 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=rOISPYYKecMk71RBzznUZbzYo3FGryyldBKKzRc7muU=; b=hHjX624dJV/e6kTWhrBwJMY44/LoH/S2HLkzeHRvcP1P9OxyFyVvmL2YGkVoq9cA3a k2qCAGAZB4HxBg4hBY+aqRB2YCR76jBzzwCX8Yo62QMVXKdFyUKTvVBaGE/wRuRl+pAC UjfUu2/T8jslXnJJ1CjTY9c/lueR+xunkm4GT+zQVVsCIBNgyondo6or5n9tyFU2xztQ hvK4+yTMpgulnCP2QZVCMYcfgRxhYtWGpBt2pC0t924nGfa8rvURX5ia/XxwYBbUj5sS s97VOAG41Z7JKVH1whq7fmkP8nO9NscT5P1HWQaipYFKwR3RM1VbIIGCibhWSfnWIZ/0 ZqTA== X-Gm-Message-State: AOAM531Ty/wMJolrJzDpzshCCc3/ECYkZMctlyvGayx9cKF89uWSbK59 cX8/NR1To/nUa3NODKIC6txuN/d12YqfpA== X-Google-Smtp-Source: ABdhPJzVFhzWsOGkE7rfKs03PlXzdcfqK0dvnp7/2wm1iAaSeJCCt+j7QDp3NRC4/kE4jyvRvRrv6w== X-Received: by 2002:a05:6e02:1ca9:: with SMTP id x9mr12340717ill.273.1636082390111; Thu, 04 Nov 2021 20:19:50 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:49 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 04/36] bsd-user/i386/target_arch_signal.h: Remove target_sigcontext Date: Thu, 4 Nov 2021 21:18:45 -0600 Message-Id: <20211105031917.87837-5-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::136; envelope-from=imp@bsdimp.com; helo=mail-il1-x136.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" In FreeBSD, sigcontext was retired in favor of ucontext/mcontext. Remove vestigial target_sigcontext. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch_signal.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bsd-user/i386/target_arch_signal.h b/bsd-user/i386/target_arch_signal.h index a90750d602..e262667bda 100644 --- a/bsd-user/i386/target_arch_signal.h +++ b/bsd-user/i386/target_arch_signal.h @@ -27,10 +27,6 @@ #define TARGET_MINSIGSTKSZ (512 * 4) /* min sig stack size */ #define TARGET_SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended size */ -struct target_sigcontext { - /* to be added */ -}; - typedef struct target_mcontext { } target_mcontext_t; From patchwork Fri Nov 5 03:18:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551197 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=5qxLB4Zd; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hlm8q2hQCz9sf8 for ; Fri, 5 Nov 2021 14:24:59 +1100 (AEDT) Received: from localhost ([::1]:33674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mipqb-0002lD-5c for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:24:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplj-0004Gl-CD for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:56 -0400 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]:42961) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplg-00043m-Hw for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:55 -0400 Received: by mail-io1-xd34.google.com with SMTP id n128so9290814iod.9 for ; Thu, 04 Nov 2021 20:19:51 -0700 (PDT) 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=YUhiVOQnmpNFSdmZg3CHyQkzJYfHEf7WcwU0TPM0Y70=; b=5qxLB4ZdqD/SJBGHlPvaveJoxwDCsTLPc1BgkXHsVd66IEUWrWYpJqlAKHBi2XLhXA aeLFmEiuuPW1DoxMSihZoZpe3HRGloi0gRJwlZ4ivjG5xeX27kW2gUqOEk8fWEnQ2twq MVRU4QT6UluKanUDEovoM4JeFyeWe4g+e4svjuI8dM842OxeVTG10vsgcimkxulxt4sb dkk7Qc8Mbwt/gUm/W/4piTpofMPWHD/mTQZWvKUJkbUwYSGtR9z/9lJMaC6B0qGaB5Kx VDkqyQyVsY9Spop+JbD1GdduDJytNRuFX4bSe8+8Sk+KM004/ZzCdBBde8P/rwEEIkI8 taRA== 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=YUhiVOQnmpNFSdmZg3CHyQkzJYfHEf7WcwU0TPM0Y70=; b=eWRzzwYseB5GHnYDY80wpkWvxDjFwrQebBBUU47bbHNksMHNH9eOCc96MBtmufpM0F TtJa8G1gJg+j1vrCcCSjfu7Z5uYdVZzseXc3a1WnBXCoN1IprodlmYWl441POL27yjGa HOXsp/SaCDbGc07uNKdevXiKAbr3y7sY2p+pCUKx5G2QoFnyCzisxU8ARNTVV72HqgLb a9ptXO+f/0N/ocIlLYrOrWB32ODSC98if+l4I3keboSKlXEAgRvuW0zfkiEt9P7q/cfx 1URl5q8CPB5voiFA96a6qkcA7lP7ACywktUel/d8cGdJGCNl5txhXTV8m/LceIUD2ztl bKyA== X-Gm-Message-State: AOAM532hkkTO8zezjcDWPOQBkufoOs43kt2ZivLXXm0LfI1oYb0R9sN5 Q/AWL/P1AmC2bybpTo/G5IMKxA9PgftC3w== X-Google-Smtp-Source: ABdhPJyvL+2Tm/sSUxGF6AVJBfltr0yDymFvwceUglM2QXjAVc/Y5dLIH+O6iO9zdLRCnuFys20+6w== X-Received: by 2002:a02:84ec:: with SMTP id f99mr7027850jai.122.1636082390824; Thu, 04 Nov 2021 20:19:50 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:50 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 05/36] bsd-user/i386/target_arch_signal.h: use new target_os_ucontext.h Date: Thu, 4 Nov 2021 21:18:46 -0600 Message-Id: <20211105031917.87837-6-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d34; envelope-from=imp@bsdimp.com; helo=mail-io1-xd34.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch_signal.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bsd-user/i386/target_arch_signal.h b/bsd-user/i386/target_arch_signal.h index e262667bda..bf7263c4f8 100644 --- a/bsd-user/i386/target_arch_signal.h +++ b/bsd-user/i386/target_arch_signal.h @@ -30,14 +30,7 @@ typedef struct target_mcontext { } target_mcontext_t; -typedef struct target_ucontext { - target_sigset_t uc_sigmask; - target_mcontext_t uc_mcontext; - abi_ulong uc_link; - target_stack_t uc_stack; - int32_t uc_flags; - int32_t __spare__[4]; -} target_ucontext_t; +#include "target_os_ucontext.h" struct target_sigframe { abi_ulong sf_signum; From patchwork Fri Nov 5 03:18:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551198 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=gUzhFJ+m; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hlm9Q3L5dz9sf8 for ; Fri, 5 Nov 2021 14:25:30 +1100 (AEDT) Received: from localhost ([::1]:34018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mipr6-0002zK-7P for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:25:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplj-0004Gk-8d for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:56 -0400 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]:46865) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplh-000442-20 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:54 -0400 Received: by mail-il1-x12d.google.com with SMTP id w10so8225880ilc.13 for ; Thu, 04 Nov 2021 20:19:52 -0700 (PDT) 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=uyxbbQF80/XM90AkSm9sfWQoRQdroYy3zT6tj7fuzSM=; b=gUzhFJ+m6gVCo0IVbvzNb9vIKJDZOREqpnlVvzWej1XgQea6sRgzANMIaSe/eUpYvv 48sUgqtZ4MqR1zwjVRKxQ2DCwy0BmKbTec5DeFk8ZIRW9AfqTz0Y7BAo9ig0P/sbRyiI stkQJgV+Z14GUDyaje9asE3I7+p4G9Ay9aGXIwXLGbnEAG4lECILUHCXxe5PWqPxLUZf Js+BpIFr/TqdO5tJSCafmi2kQNu8cce89JZQ7bEbcXYdMt+avQTz4mRiBUq4AUcXE73v E6xiVl8o6pRYC0EfwPycJiFVlJYnJVYVC65t/S/3RfgM9CM314UN8c2NHaHnNlT4lKsJ 0Q9Q== 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=uyxbbQF80/XM90AkSm9sfWQoRQdroYy3zT6tj7fuzSM=; b=108kLslKKEzC0rsjnrekNgQEbBdSWamCo1JlLiPyaqQSPvH/DhqaqjS+KzB5J93seF 1bbRr8t4jDB8VRvrztR+5KEcezLCwTN/nJChJfCh1Tfj7v3fCqNDll7aJoDk8qLmSas3 nlBoLzZfvT/K9ypKj2gWSZYwvhQWqK820L/KgXpGfkF6gcRZoZYyz8Mv12LQv7Twe1CK WmOXt/zSJ8mdA0Uqvs+gQ79G744jPVCqqopBD/JxaEUaJupHcAhFA0w9t8dGQbnQBT5p EihZ3zHZQomvDn6REhPZbrkNlgJpys3y80OQs0rfLzgowavf8kJOH6c2Yt0qQzpVXvUs gjEw== X-Gm-Message-State: AOAM530yH10RSR2p801ng2HifPnaK8ZNU+3ovLiGDf1z0UAtTgM7MK2/ DuPYmCipspweXr2YzroDsCVrT44crQS15w== X-Google-Smtp-Source: ABdhPJzm0ueogUqa54TooubBKIrJmszRV4HXCRYu0LetXr5XCWiQdVBZsCv7wG0HNc2xzk5n0Z4sew== X-Received: by 2002:a05:6e02:1c47:: with SMTP id d7mr20175541ilg.6.1636082391748; Thu, 04 Nov 2021 20:19:51 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:51 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 06/36] bsd-user/i386/target_arch_signal.h: Update mcontext_t to match FreeBSD Date: Thu, 4 Nov 2021 21:18:47 -0600 Message-Id: <20211105031917.87837-7-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12d; envelope-from=imp@bsdimp.com; helo=mail-il1-x12d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Fill in target_mcontext_t to match the FreeBSD mcontex_t. Also tag the current size of mcontext and ucontext to enable size checking for i386. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch_signal.h | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/bsd-user/i386/target_arch_signal.h b/bsd-user/i386/target_arch_signal.h index bf7263c4f8..701c6f964f 100644 --- a/bsd-user/i386/target_arch_signal.h +++ b/bsd-user/i386/target_arch_signal.h @@ -28,8 +28,54 @@ #define TARGET_SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended size */ typedef struct target_mcontext { + abi_ulong mc_onstack; /* XXX - sigcontext compat. */ + abi_ulong mc_gs; /* machine state (struct trapframe) */ + abi_ulong mc_fs; + abi_ulong mc_es; + abi_ulong mc_ds; + abi_ulong mc_edi; + abi_ulong mc_esi; + abi_ulong mc_ebp; + abi_ulong mc_isp; + abi_ulong mc_ebx; + abi_ulong mc_edx; + abi_ulong mc_ecx; + abi_ulong mc_eax; + abi_ulong mc_trapno; + abi_ulong mc_err; + abi_ulong mc_eip; + abi_ulong mc_cs; + abi_ulong mc_eflags; + abi_ulong mc_esp; + abi_ulong mc_ss; + + int32_t mc_len; /* sizeof(mcontext_t) */ +#define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */ +#define _MC_FPFMT_387 0x10001 +#define _MC_FPFMT_XMM 0x10002 + int32_t mc_fpformat; +#define _MC_FPOWNED_NONE 0x20000 /* FP state not used */ +#define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */ +#define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */ + int32_t mc_ownedfp; + abi_ulong mc_flags; + /* + * See for the internals of mc_fpstate[]. + */ + int32_t mc_fpstate[128] __aligned(16); + + abi_ulong mc_fsbase; + abi_ulong mc_gsbase; + + abi_ulong mc_xfpustate; + abi_ulong mc_xfpustate_len; + + int32_t mc_spare2[4]; } target_mcontext_t; +#define TARGET_MCONTEXT_SIZE 640 +#define TARGET_UCONTEXT_SIZE 704 + #include "target_os_ucontext.h" struct target_sigframe { From patchwork Fri Nov 5 03:18:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551195 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=hb6W+ObE; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hlm5T5n3Zz9sf8 for ; Fri, 5 Nov 2021 14:22:05 +1100 (AEDT) Received: from localhost ([::1]:54408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mipnn-0006C5-HM for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:22:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplk-0004Gq-92 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:56 -0400 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]:37603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipli-00044l-1v for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:56 -0400 Received: by mail-il1-x130.google.com with SMTP id h23so8255999ila.4 for ; Thu, 04 Nov 2021 20:19:53 -0700 (PDT) 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=jsIdVmjKOIUEZ1G1O3ibGx2Ed5U+hmNQGqNLw2OjQ6c=; b=hb6W+ObEwC+zujrIs9OyIVgVJx8DnBF3k2gWNWWjbBsge/WX9bugH9sQNhKW754WkB XBAdiuAg5mA0pk8sKvwerDt+WeAcbtf8ATd9JrC5HUdyP8kh0pSADfPbBr/kSCNzIja/ Pwbc1ZTPioGosCPpDuQbW8rierGO/lcKb6+Gh6aUMhqfUJn+6/gnXBXUpnTxpuxVmsqT tyQfM5IYnUSPA9Cq2e9rrhemcxR1TXAiubG9zQLEn44uo346bmrXvC36wMiVHpJRN3ae 0f4vUEym8rNnJQAtsK6h6IDT0cEEXFQ+TDdl8FinRsR9W9Z18U12orDQPvBd2z0ToQ/+ e5RA== 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=jsIdVmjKOIUEZ1G1O3ibGx2Ed5U+hmNQGqNLw2OjQ6c=; b=m67B0/wEDm31bn7WgeBONi6Z8v8KgU5YdY8elrJIpcQGf2GXMjIpH5QoWQzVYp6Uiz FUy5ENwKFwxqgdf4kfwJIaK7fw022NU+5xln3OqAnkTNShvFpYaxe+VSksTCeiJ0C/n8 ciVIXvs/zyh6QOC1gQvq/Ankr0MetwoX8bU3vbI5Rbfm/Jxk/d6PM/PXDEkTAovXuLm5 5Z1VKhjUeM5hOZTAM6O4+Vy3qzXPeBC9QV3IR2q5iXq9MNYuDDOgPiFTuMcirqQRxavV Q5uAqbp0W1D6wgjNGbUyO299jonX+HRA4w7dSRjXBgDpoBLaf9C0ssb/y1OpACGjeXpC rIcw== X-Gm-Message-State: AOAM533MrWuA2MaNVHFlSYADsN8gYou4rOGTi27PMONBy2osou4fpEqU zsIqXyyBM+A00BTW9suuNh9+DkdVF+cQmA== X-Google-Smtp-Source: ABdhPJwzm1qGR41d5bGkndxttj2JpPv0jtWLYWKQhb4J96q8ihMUArXteM/PVKYERYPIQeCkyQyxtA== X-Received: by 2002:a92:ca0b:: with SMTP id j11mr36127551ils.289.1636082392775; Thu, 04 Nov 2021 20:19:52 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:52 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 07/36] bsd-user/i386: Move the inlines into signal.c Date: Thu, 4 Nov 2021 21:18:48 -0600 Message-Id: <20211105031917.87837-8-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::130; envelope-from=imp@bsdimp.com; helo=mail-il1-x130.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the (now stubbed out) inlines into bsd-user/i386/signal.c. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/signal.c | 56 +++++++++++++++++++++++++++++- bsd-user/i386/target_arch_signal.h | 43 +++++------------------ 2 files changed, 63 insertions(+), 36 deletions(-) diff --git a/bsd-user/i386/signal.c b/bsd-user/i386/signal.c index ac90323365..2939d32400 100644 --- a/bsd-user/i386/signal.c +++ b/bsd-user/i386/signal.c @@ -1 +1,55 @@ -/* Placeholder for signal.c */ +/* + * i386 dependent signal definitions + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "qemu.h" + +/* + * Compare to i386/i386/machdep.c sendsig() + * Assumes that target stack frame memory is locked. + */ +abi_long set_sigtramp_args(CPUX86State *env, int sig, + struct target_sigframe *frame, + abi_ulong frame_addr, + struct target_sigaction *ka) +{ + /* XXX return -TARGET_EOPNOTSUPP; */ + return 0; +} + +/* Compare to i386/i386/machdep.c get_mcontext() */ +abi_long get_mcontext(CPUX86State *regs, target_mcontext_t *mcp, int flags) +{ + /* XXX */ + return -TARGET_EOPNOTSUPP; +} + +/* Compare to i386/i386/machdep.c set_mcontext() */ +abi_long set_mcontext(CPUX86State *regs, target_mcontext_t *mcp, int srflag) +{ + /* XXX */ + return -TARGET_EOPNOTSUPP; +} + +abi_long get_ucontext_sigreturn(CPUX86State *regs, abi_ulong target_sf, + abi_ulong *target_uc) +{ + /* XXX */ + *target_uc = 0; + return -TARGET_EOPNOTSUPP; +} diff --git a/bsd-user/i386/target_arch_signal.h b/bsd-user/i386/target_arch_signal.h index 701c6f964f..982c7035c7 100644 --- a/bsd-user/i386/target_arch_signal.h +++ b/bsd-user/i386/target_arch_signal.h @@ -88,40 +88,13 @@ struct target_sigframe { uint32_t __spare__[2]; }; -/* - * Compare to i386/i386/machdep.c sendsig() - * Assumes that target stack frame memory is locked. - */ -static inline abi_long set_sigtramp_args(CPUX86State *regs, - int sig, struct target_sigframe *frame, abi_ulong frame_addr, - struct target_sigaction *ka) -{ - /* XXX return -TARGET_EOPNOTSUPP; */ - return 0; -} - -/* Compare to i386/i386/machdep.c get_mcontext() */ -static inline abi_long get_mcontext(CPUX86State *regs, - target_mcontext_t *mcp, int flags) -{ - /* XXX */ - return -TARGET_EOPNOTSUPP; -} - -/* Compare to i386/i386/machdep.c set_mcontext() */ -static inline abi_long set_mcontext(CPUX86State *regs, - target_mcontext_t *mcp, int srflag) -{ - /* XXX */ - return -TARGET_EOPNOTSUPP; -} - -static inline abi_long get_ucontext_sigreturn(CPUX86State *regs, - abi_ulong target_sf, abi_ulong *target_uc) -{ - /* XXX */ - *target_uc = 0; - return -TARGET_EOPNOTSUPP; -} +abi_long set_sigtramp_args(CPUX86State *env, int sig, + struct target_sigframe *frame, + abi_ulong frame_addr, + struct target_sigaction *ka); +abi_long get_mcontext(CPUX86State *regs, target_mcontext_t *mcp, int flags); +abi_long set_mcontext(CPUX86State *regs, target_mcontext_t *mcp, int srflag); +abi_long get_ucontext_sigreturn(CPUX86State *regs, abi_ulong target_sf, + abi_ulong *target_uc); #endif /* TARGET_ARCH_SIGNAL_H */ From patchwork Fri Nov 5 03:18:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551204 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=5aexJ+o/; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmGz679yz9sf8 for ; Fri, 5 Nov 2021 14:30:18 +1100 (AEDT) Received: from localhost ([::1]:49900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mipvj-0005BR-0K for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:30:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplk-0004Gr-BG for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:56 -0400 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]:46872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipli-000458-Rx for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:56 -0400 Received: by mail-il1-x133.google.com with SMTP id w10so8225941ilc.13 for ; Thu, 04 Nov 2021 20:19:54 -0700 (PDT) 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=wZvh57AWzS8inwSMVn1OaBIlb06mOlklnUcQyFDbg60=; b=5aexJ+o/VItz8FeK7eHwx5APZdqxmqLLl+Hjs87Ai47PgrN+qKs/zwd1nJohu8dqTK m63BcsaRYG2w6D4qJgAushkRS7L5IXXXOM2f2INj985OZJH6Q8PunATELIk8CzDa+XTD 881jn71tQZLAmtEID/KhnlHSmhAFiQ0MFkM0pY4gthCPTUuEYQkpvIMAK5LhGglRFBk4 QUP+zhGLj3Y++jbFGmvU5ePszw85V+O6o4Uaprwd+3GiYX2TzBEnt/1bZbNb9a+rtgCP FHFxqgaQ0Hu6IoikrIAlQMVXynD0drplCZ+wkEIRdhrcA3QcMdGNqK3pxG3xkyGpkpeA HRHw== 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=wZvh57AWzS8inwSMVn1OaBIlb06mOlklnUcQyFDbg60=; b=1SjOKQov/GCxzEp92OBeZPi02xwF7FMHNGQJcXuhWR/4lROEcERDFeehfTMhQnba1H SCXE6QNOZTicdNL2WfKiBoo0/Q7JCYIAguyFhrrwwDqRCYH4dXVQCmmOCEBvGBMscTnE WsttjyxFCFZkpsyQoYukiuLP0Q42a7jeC9uFa3XDCHuuQqpXzlaZIdzPu5sppa6azfCN WHjVmw6E/2FtpgwioA24SYry0i/1Xn1kKCpFTWOthG/wgmQh+RVtO2EZU2Pq9ll9QOZ/ OxHfanp0n8t/87RaDX9sR5FG0KKNneMVL0svYCUHsypvgrzVgzy/u/fQuFSAWIWEcnbx ZDEQ== X-Gm-Message-State: AOAM530A1dOs/TDjTXvWPSTUpeHAZgutDCjThYTIcfgc/oe65dhV+4ej sW1GPyw5XgrHGkIDy2EI4ZuXtgKy+VsypQ== X-Google-Smtp-Source: ABdhPJzZAqgytSnO5QI0vvY4aagc/iecK29jO+8jNmDZ+yO3Y04d6P7QOjBjiXiW11cYSBd84mOriQ== X-Received: by 2002:a92:3642:: with SMTP id d2mr38342564ilf.91.1636082393582; Thu, 04 Nov 2021 20:19:53 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:53 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 08/36] bsd-user/x86_64/target_arch_signal.h: Remove target_sigcontext Date: Thu, 4 Nov 2021 21:18:49 -0600 Message-Id: <20211105031917.87837-9-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::133; envelope-from=imp@bsdimp.com; helo=mail-il1-x133.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" In FreeBSD, sigcontext was retired in favor of ucontext/mcontext. Remove vestigial target_sigcontext. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/x86_64/target_arch_signal.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bsd-user/x86_64/target_arch_signal.h b/bsd-user/x86_64/target_arch_signal.h index 4bb753b08b..55f742b0a8 100644 --- a/bsd-user/x86_64/target_arch_signal.h +++ b/bsd-user/x86_64/target_arch_signal.h @@ -27,10 +27,6 @@ #define TARGET_MINSIGSTKSZ (512 * 4) /* min sig stack size */ #define TARGET_SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended size */ -struct target_sigcontext { - /* to be added */ -}; - typedef struct target_mcontext { } target_mcontext_t; From patchwork Fri Nov 5 03:18:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551214 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=5FE3VFxv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmQB0qljz9sf8 for ; Fri, 5 Nov 2021 14:36:32 +1100 (AEDT) Received: from localhost ([::1]:60652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq1k-000429-Um for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:36:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplm-0004Kd-K3 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:00 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:37605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplk-00045l-6m for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:19:57 -0400 Received: by mail-il1-x132.google.com with SMTP id h23so8256055ila.4 for ; Thu, 04 Nov 2021 20:19:55 -0700 (PDT) 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=+ZNPpOkk6VPcljeu7Kbkpd5a4MaTSH5kT5BRcPYHMyg=; b=5FE3VFxv4iXD64ueP7dHU+oLzLTy+EQhywD59obEdthcS/Srme8FYPb2QVBmFxLp1l B+lB9k/W5mRmgphVDyF7MmQS11GSfiS+wmzZQb0hUNnnVGabiaHpFfok8Yy2XzWJcxgL LTCGDSbK8QWYWE42xog8rnQq6DYBMo+aJkXDT9raw67X+IMJvPuqkjhJkIyYggoHW4SF zxfg9qy6576ogoFZjuSSjdC8XhVTTagARW3yvev/w+5+yZ2efeTZzefmEi+cwEGrlJMF eZljbRFYm5UoIvP7V1iO74+4FgxVgSYHz0uGDNKCvPtb2FiSicLLmoE3324ggqoNS3xJ EIWA== 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=+ZNPpOkk6VPcljeu7Kbkpd5a4MaTSH5kT5BRcPYHMyg=; b=VjPS4ghF7TuWQe6S9ufn+Vez5CMmCohwUOwYzLs/f0mcEQyxjX/Q2yYLJlbu4OVqbO 7x5Jwu88xVOHkJnuclV1KjZGAq9qcVo6MT/ozoLK4DCoZXwGFXONYdk+Y1PVpKS0Moue A5xFjeDHx9SkWO3nN0bYzB3QGF9ItdE3PsjPIdWuktQwIpVMHJeX5hwVUKbxVZUyU/P8 4XsErsbWaDPgSYX1xg9HF95wQ+pK9bVp8AMxa8KkrNRCTTdKJOtkJZJx15D/97W8Tyxu dwPk2JPiilvN30pWt5tDvoLvDk9e0SQC6CixgXBNIB8zdULgkLDKPMfwJg37FiR3/uPv +jww== X-Gm-Message-State: AOAM533EtuZm1KjuBs7Csbe365VF2FUXtuGIpVGXEUnNQxzt4UdZKKFV NRMfHoifm3Qe/GIQhKqJYzZKeYR3/G0c+Q== X-Google-Smtp-Source: ABdhPJyEM8IKOEywCxlo3LSQUFQFAfEN5NnfYYewtWDfQ5fOv7EaItxxGjPQp2e4zA8On3L/tzTAyg== X-Received: by 2002:a05:6e02:18c5:: with SMTP id s5mr5031515ilu.193.1636082394749; Thu, 04 Nov 2021 20:19:54 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:54 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 09/36] bsd-user/x86_64/target_arch_signal.h: use new target_os_ucontext.h Date: Thu, 4 Nov 2021 21:18:50 -0600 Message-Id: <20211105031917.87837-10-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::132; envelope-from=imp@bsdimp.com; helo=mail-il1-x132.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/x86_64/target_arch_signal.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bsd-user/x86_64/target_arch_signal.h b/bsd-user/x86_64/target_arch_signal.h index 55f742b0a8..e84aff948c 100644 --- a/bsd-user/x86_64/target_arch_signal.h +++ b/bsd-user/x86_64/target_arch_signal.h @@ -30,14 +30,7 @@ typedef struct target_mcontext { } target_mcontext_t; -typedef struct target_ucontext { - target_sigset_t uc_sigmask; - target_mcontext_t uc_mcontext; - abi_ulong uc_link; - target_stack_t uc_stack; - int32_t uc_flags; - int32_t __spare__[4]; -} target_ucontext_t; +#include "target_os_ucontext.h" struct target_sigframe { abi_ulong sf_signum; From patchwork Fri Nov 5 03:18:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551205 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=V/iIR1dY; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmHM5jytz9sf8 for ; Fri, 5 Nov 2021 14:30:39 +1100 (AEDT) Received: from localhost ([::1]:51298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mipw5-00066M-FK for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:30:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplo-0004Lr-G5 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:02 -0400 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]:41623) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplm-00046N-4E for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:00 -0400 Received: by mail-il1-x136.google.com with SMTP id i9so8227630ilu.8 for ; Thu, 04 Nov 2021 20:19:56 -0700 (PDT) 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=0aoD6kQGvGec2fmTrLm6bXRNADKHnrqvYBTPMgruHQg=; b=V/iIR1dYnCG+e4eXQXyCkYHYrRkKzy4L+8lwR6TFkFtO7z+B8ZrJkYY74YhD2Dc7Zu 9f0wlOqaN89ZwIvEdm46klv13QeIQIZy9Ye9Z7tJBzQFO81HosobLLVtpJXx23akjwhv LAme2s3ZIOiityWCjHZ5TKWKr07acv343V88WBPqqHDTQX79pdEw6MfqrTBV+HHY4g+6 6kCEvB8Lwnf/5gUh9yvgeB5+ykvLkt7s40xw4a1a3nuTO90tuKN8t88eImKF+bk/3WrI 8MASV0qPdiuPa8zjVrWbRneQmGgkG4iznBJWGrpq8YUiaBAXLnf31T9OBwQjbb/MJ8gU ZzKQ== 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=0aoD6kQGvGec2fmTrLm6bXRNADKHnrqvYBTPMgruHQg=; b=sm0eCK2i2uxUqSMATSxOd9T6zamZvM5oDiJWoW3km0fnuPStMCZaW9ymu2GA3OzQct kHjHTkMXHbeLgevogWw3PF/mttlyADlCXCPDqYFtKLO+f7q0Wsm6SObGEeafr4rADKA1 OHTtU8m3Zngdv65q0iC1WqLuIIuFasjwzl4SFjS4/nxUEKj0beECnyRVgMHq5LfWHSoY mN2s0/bE3n8oUeSxAre9qBsEc9mkZEd9aRH6b5iNj1AnHW37UrcKV1b/8mV6XyTcpdNr UaO4y96J5LxkY08NmE2FdHOTylX1bkzkEBYa2ZiI5qyOkyaTbR1IFvKqrdYi0w2q+LVk BkOQ== X-Gm-Message-State: AOAM532pNqEPYysL/kF2wgoSOkKloAhsKoMgGRsMhfMZe4cYN+6sWrDw qi0uZ1jSK2b9dOA9XGEbKv6OASb5w/XhbQ== X-Google-Smtp-Source: ABdhPJyHTqNCBbKxViV1tszZNb2rZOuirvSglCJOfn7JvUh7sJseTqKeDpYBR/FyNA9PO4tf7d++yA== X-Received: by 2002:a05:6e02:20c3:: with SMTP id 3mr22912632ilq.314.1636082395832; Thu, 04 Nov 2021 20:19:55 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:55 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 10/36] bsd-user/x86_64/target_arch_signal.h: Fill in mcontext_t Date: Thu, 4 Nov 2021 21:18:51 -0600 Message-Id: <20211105031917.87837-11-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::136; envelope-from=imp@bsdimp.com; helo=mail-il1-x136.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Fill in target_mcontext match the FreeBSD mcontext_t structure. Also define the size correctly. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/x86_64/target_arch_signal.h | 54 ++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/bsd-user/x86_64/target_arch_signal.h b/bsd-user/x86_64/target_arch_signal.h index e84aff948c..720e3939c3 100644 --- a/bsd-user/x86_64/target_arch_signal.h +++ b/bsd-user/x86_64/target_arch_signal.h @@ -28,8 +28,62 @@ #define TARGET_SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended size */ typedef struct target_mcontext { + abi_ulong mc_onstack; /* XXX - sigcontext compat. */ + abi_ulong mc_rdi; /* machine state (struct trapframe) */ + abi_ulong mc_rsi; + abi_ulong mc_rdx; + abi_ulong mc_rcx; + abi_ulong mc_r8; + abi_ulong mc_r9; + abi_ulong mc_rax; + abi_ulong mc_rbx; + abi_ulong mc_rbp; + abi_ulong mc_r10; + abi_ulong mc_r11; + abi_ulong mc_r12; + abi_ulong mc_r13; + abi_ulong mc_r14; + abi_ulong mc_r15; + uint32_t mc_trapno; + uint16_t mc_fs; + uint16_t mc_gs; + abi_ulong mc_addr; + uint32_t mc_flags; + uint16_t mc_es; + uint16_t mc_ds; + abi_ulong mc_err; + abi_ulong mc_rip; + abi_ulong mc_cs; + abi_ulong mc_rflags; + abi_ulong mc_rsp; + abi_ulong mc_ss; + + abi_long mc_len; /* sizeof(mcontext_t) */ + +#define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */ +#define _MC_FPFMT_XMM 0x10002 + abi_long mc_fpformat; +#define _MC_FPOWNED_NONE 0x20000 /* FP state not used */ +#define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */ +#define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */ + abi_long mc_ownedfp; + /* + * See for the internals of mc_fpstate[]. + */ + abi_long mc_fpstate[64] __aligned(16); + + abi_ulong mc_fsbase; + abi_ulong mc_gsbase; + + abi_ulong mc_xfpustate; + abi_ulong mc_xfpustate_len; + + abi_long mc_spare[4]; } target_mcontext_t; +#define TARGET_MCONTEXT_SIZE 800 +#define TARGET_UCONTEXT_SIZE 880 + #include "target_os_ucontext.h" struct target_sigframe { From patchwork Fri Nov 5 03:18:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551219 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=2mUwZ56M; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmTb6mGVz9sf8 for ; Fri, 5 Nov 2021 14:39:31 +1100 (AEDT) Received: from localhost ([::1]:41822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq4f-000204-Gi for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:39:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplo-0004MK-N7 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:02 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:36760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplm-00046d-Bv for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:00 -0400 Received: by mail-io1-xd2b.google.com with SMTP id e144so9318582iof.3 for ; Thu, 04 Nov 2021 20:19:57 -0700 (PDT) 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=xP7qtQ+lrDr+iZjFW+q6X/N5asMVv8qg8pOJCQ+QUNc=; b=2mUwZ56MYAvWXPKQhMz42iIlnK7xxqWpxON719SuKMAsXPs9ocbmJa1QTdC0roy/fN Y3qGD8E91oHzA1QnzMlPzysE1YxvFACTEqz6cJdEu2Ivw0sSG7dyMNFE13I/wYYAEXHW xY2JkRQ7Tl486MgVgWwFr1EqwLgBskll5VNakVi8iaRNETBlAHsekwYSwtHfhAkP02qH ibFgqb3I7MRr7YUL+cjVjCzrfF23TFtOPDo3MLjk8Yr1PJO70yL3YOkGC+XxcCSIVj5I ppSAIg3OLVR5mrLXAQV+3zrPg8uLBhfO3xravdP2laR1GufFv6qWjgkzwjnsGiciqTFB XzkA== 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=xP7qtQ+lrDr+iZjFW+q6X/N5asMVv8qg8pOJCQ+QUNc=; b=LMuhU+x3NRXGgXJBDashNp9svpF5+mhS10O82STF/uR+KXOEzI07t3ZjfXc36gDd+g jesUnVnx8FxBkeG/zMfokfKVC/giEBGvEHB/BaZthliTOG5hAbk2p3GEnitqFG0AoMfS Za4aSDDT6i7HIdqonxeUMkXmaSaUxfBOctVDlyHiIW4DKJhQtXTTJTulObybcaKMOqwp e9h+ljNJb7hYCINPQmLuu9NBxnVkhIDvDrk5jIsIxD2jQzwaX7MWh8Nx5fQiuoGPVUxN OvRq4DgwlGS49jKEZjzRXyVgBzXBxogbBjFu7/yT/Fq9wvj8KFZhQgq10jwWB0YM9jcF b+EQ== X-Gm-Message-State: AOAM533R9JWsbmOyOt14tgT3qp7YFCNkMGk1GhpBcGeJvU+tpDTAfwvp wblHFdgBx16RA4UTJKXDGus43Pyrv53lHg== X-Google-Smtp-Source: ABdhPJzIZ6bB5lzLEwwKBjV9NJpplcDsctvvT3T1W4ZuktOO54u31WZIMZf8lBlpZU6l8AccPOxxWg== X-Received: by 2002:a02:ca4e:: with SMTP id i14mr6862078jal.140.1636082396966; Thu, 04 Nov 2021 20:19:56 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:56 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 11/36] bsd-user/x86_64: Move functions into signal.c Date: Thu, 4 Nov 2021 21:18:52 -0600 Message-Id: <20211105031917.87837-12-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2b; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the current inline functions into sigal.c. This will increate the flexibility of implementation in the future. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/x86_64/signal.c | 56 +++++++++++++++++++++++++++- bsd-user/x86_64/target_arch_signal.h | 43 ++++----------------- 2 files changed, 63 insertions(+), 36 deletions(-) diff --git a/bsd-user/x86_64/signal.c b/bsd-user/x86_64/signal.c index ac90323365..8885152a7d 100644 --- a/bsd-user/x86_64/signal.c +++ b/bsd-user/x86_64/signal.c @@ -1 +1,55 @@ -/* Placeholder for signal.c */ +/* + * x86_64 signal definitions + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "qemu.h" + +/* + * Compare to amd64/amd64/machdep.c sendsig() + * Assumes that target stack frame memory is locked. + */ +abi_long set_sigtramp_args(CPUX86State *regs, + int sig, struct target_sigframe *frame, abi_ulong frame_addr, + struct target_sigaction *ka) +{ + /* XXX return -TARGET_EOPNOTSUPP; */ + return 0; +} + +/* Compare to amd64/amd64/machdep.c get_mcontext() */ +abi_long get_mcontext(CPUX86State *regs, + target_mcontext_t *mcp, int flags) +{ + /* XXX */ + return -TARGET_EOPNOTSUPP; +} + +/* Compare to amd64/amd64/machdep.c set_mcontext() */ +abi_long set_mcontext(CPUX86State *regs, + target_mcontext_t *mcp, int srflag) +{ + /* XXX */ + return -TARGET_EOPNOTSUPP; +} + +abi_long get_ucontext_sigreturn(CPUX86State *regs, + abi_ulong target_sf, abi_ulong *target_uc) +{ + /* XXX */ + *target_uc = 0; + return -TARGET_EOPNOTSUPP; +} diff --git a/bsd-user/x86_64/target_arch_signal.h b/bsd-user/x86_64/target_arch_signal.h index 720e3939c3..b39b70466e 100644 --- a/bsd-user/x86_64/target_arch_signal.h +++ b/bsd-user/x86_64/target_arch_signal.h @@ -96,40 +96,13 @@ struct target_sigframe { uint32_t __spare__[2]; }; -/* - * Compare to amd64/amd64/machdep.c sendsig() - * Assumes that target stack frame memory is locked. - */ -static inline abi_long set_sigtramp_args(CPUX86State *regs, - int sig, struct target_sigframe *frame, abi_ulong frame_addr, - struct target_sigaction *ka) -{ - /* XXX return -TARGET_EOPNOTSUPP; */ - return 0; -} - -/* Compare to amd64/amd64/machdep.c get_mcontext() */ -static inline abi_long get_mcontext(CPUX86State *regs, - target_mcontext_t *mcp, int flags) -{ - /* XXX */ - return -TARGET_EOPNOTSUPP; -} - -/* Compare to amd64/amd64/machdep.c set_mcontext() */ -static inline abi_long set_mcontext(CPUX86State *regs, - target_mcontext_t *mcp, int srflag) -{ - /* XXX */ - return -TARGET_EOPNOTSUPP; -} - -static inline abi_long get_ucontext_sigreturn(CPUX86State *regs, - abi_ulong target_sf, abi_ulong *target_uc) -{ - /* XXX */ - *target_uc = 0; - return -TARGET_EOPNOTSUPP; -} +abi_long set_sigtramp_args(CPUX86State *env, int sig, + struct target_sigframe *frame, + abi_ulong frame_addr, + struct target_sigaction *ka); +abi_long get_mcontext(CPUX86State *regs, target_mcontext_t *mcp, int flags); +abi_long set_mcontext(CPUX86State *regs, target_mcontext_t *mcp, int srflag); +abi_long get_ucontext_sigreturn(CPUX86State *regs, abi_ulong target_sf, + abi_ulong *target_uc); #endif /* !TARGET_ARCH_SIGNAL_H_ */ From patchwork Fri Nov 5 03:18:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551201 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=FU4E+e5B; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmDF5vmHz9sf8 for ; Fri, 5 Nov 2021 14:27:57 +1100 (AEDT) Received: from localhost ([::1]:42208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miptT-0008VM-Jb for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:27:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplq-0004Nk-EL for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:03 -0400 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]:37405) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipln-00046u-Am for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:01 -0400 Received: by mail-io1-xd36.google.com with SMTP id y73so9312245iof.4 for ; Thu, 04 Nov 2021 20:19:59 -0700 (PDT) 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=0zcqxxx9i9efPGyMNGiYlMMaZ7Z90otmzxtyKTD4u1s=; b=FU4E+e5BGZ8StZdS8YofTWyLMY6Bibvm3gcKaj1PVpm/xJOXUy82TMM0QBUrfH+F99 r+l51Tswko5UPzUpJSzeUQPRBM9YLAgWViy9GyJ42jReFbKJwDA99taB7w7MzKB4iZJd FjAwPt0YLqyT70KjeCCB1x6k/kCRT5jvhNUjtNJjhgyJu9P9SojY8gYLUgXzXzytx9Yd EKTfck6XjTimkYq5rEgIlvV/YNtzOQnG6Y9G/p70lXY3nnIwM18/iIQfZei0jLnOm71A RXsy435txb4yek6NQlG4VMSYtXFwL5h1Z7HlZPt7f9JGOgmpfgchX//jXkWM9tq93JOl inIw== 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=0zcqxxx9i9efPGyMNGiYlMMaZ7Z90otmzxtyKTD4u1s=; b=Z2PmzB5izGrhQ/rh2wje9vfYGml7AL08ZWpzFKTebcIYL0ZwrYrKFgxBfTDq33XlmT +ens0UI98knvfJzYtmcLrz/zlVa4ZiAkStnobBz+AbEmRUg8mEEfbn2x6Tpir/1E3CAf IY2Kf53+Yu2kRilbmrniuYNUo3AMvIudrIWgjYgSaa1wWM/qrVQUCQ7VyhpiKeCoXwCV exa0qP7qFPGhwV42lyzMafzKtl5tW1pEG09Vlet3Q4fL5vRdyo4BFleg2o1Po8WS9Qxf GK4ujnwLHqc3uDa6HQJqF8VRoVZzbFjum5Dq9oGMgLXYHvazN7ftcDQqft4VRulDgKmc LYgw== X-Gm-Message-State: AOAM5305mHeDfIt85KYIx2XbsGlsPSDBTOSwQFeGK+WhinmTscs9bjrE /ov0tda9Fu8rrHjYTCI47/FgRoDeAIxdAQ== X-Google-Smtp-Source: ABdhPJwafey/NN/waSEqjhmiF3mK62/RzNz1kglWNiO1P8xAPs0KXUpYmFFq/uBglV0n5wZagmX8Iw== X-Received: by 2002:a5e:d80a:: with SMTP id l10mr39587725iok.182.1636082397988; Thu, 04 Nov 2021 20:19:57 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:57 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 12/36] bsd-user/arm/target_arch_sysarch.h: Use consistent include guards Date: Thu, 4 Nov 2021 21:18:53 -0600 Message-Id: <20211105031917.87837-13-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d36; envelope-from=imp@bsdimp.com; helo=mail-io1-xd36.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" As part of upstreaming, the include guards have been made more consistent. Update this file to use the new guards. Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_sysarch.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bsd-user/arm/target_arch_sysarch.h b/bsd-user/arm/target_arch_sysarch.h index 632a5cd453..8cc6bff207 100644 --- a/bsd-user/arm/target_arch_sysarch.h +++ b/bsd-user/arm/target_arch_sysarch.h @@ -17,8 +17,8 @@ * along with this program; if not, see . */ -#ifndef BSD_USER_ARCH_SYSARCH_H_ -#define BSD_USER_ARCH_SYSARCH_H_ +#ifndef _TARGET_ARCH_SYSARCH_H_ +#define _TARGET_ARCH_SYSARCH_H_ #include "target_syscall.h" #include "target_arch.h" @@ -75,4 +75,4 @@ static inline void do_freebsd_arch_print_sysarch( } } -#endif /*!BSD_USER_ARCH_SYSARCH_H_ */ +#endif /*!_TARGET_ARCH_SYSARCH_H_ */ From patchwork Fri Nov 5 03:18:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551217 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=jB2K9PU6; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmS96qrvz9sf8 for ; Fri, 5 Nov 2021 14:38:17 +1100 (AEDT) Received: from localhost ([::1]:36832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq3T-00071t-GO for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:38:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm1-0004XW-UW for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:15 -0400 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]:34405) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplo-00047B-Iw for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:13 -0400 Received: by mail-io1-xd35.google.com with SMTP id 2so5963436iou.1 for ; Thu, 04 Nov 2021 20:20:00 -0700 (PDT) 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=5K9w6Dgj9bW+v4mINR6IMzovYCKqh6rwlm+KG2b5Ybg=; b=jB2K9PU6I0f/0+YgbHqJoZv289ASKXkDaDIWwBQ7x/1TyLYnMLJ5kWXI4xNqfTfmbA O56Gjj4cc+HC1dlxWYMby/l8BK+qhio0lIwSlX5l3iLpdqykDCb/Bw/HkOwsRY9mYboi j4MOEJsyMRXnmEGb4kI7WzSIAWyHjJes1pwE1Fx7lCnWlq+8tLmqnH64d0kz4CDjgqfV 0WX5N1LlR1FNbbf0hvPl7WmNO43lQ20JBjCBufgCCnkc3rmH5ZprazHy0+/yLdJskC/W m1v3W9NjFm4eItI7GpbqzN0bfPwl6ihE1hSV048PML2PBIVW8VIErXWSaHTSCuZ6EgaS 3jxg== 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=5K9w6Dgj9bW+v4mINR6IMzovYCKqh6rwlm+KG2b5Ybg=; b=vDTuaZqSC1eqzqP2NvcHTMgqHv4OzfdJYbCUJkt9YSo9Rl6VCgrJ0ydhnX57xZ149v cG/xCiVP1odCvzcxj6OUqUBGTuvjpux8H5qwAU8IIySPW6V7YCPJgS9F7+t9Okur8qve zaoCONNHrM61Kx2+gJYJb2rBxMHLSlJw8dMMuQKeuyp4P9i9JqJZXbAP7pkKOocwQJa0 ZJStsjiOI+YSQn0S42H8tvJGQTmHnzGMCE3gWzajFvbh6yy05ojrtguoaxkzakcRrIR/ VzUgbPoO/oBKzD3qJ4SvBBoi/DYlBXXAsmJ6a9TAIuoKdu89nlzFyiU6i0vbCmDFcNGJ ih5w== X-Gm-Message-State: AOAM530VhbUME6q40ufUwdbI4LmMAWvBrNTOlXh8u6G0Ye8R4+BYC8JR BQNNb/jC/oYOLmigW2ttOCDivkgVbvwCpw== X-Google-Smtp-Source: ABdhPJyskoZ2e/6mCjgDzKJN8+1AE+mJhgFdUtOtJvLlPB+KLeIit5KLFttCXho7MDQ+Opj2ofqmzQ== X-Received: by 2002:a02:a88f:: with SMTP id l15mr6912381jam.48.1636082399038; Thu, 04 Nov 2021 20:19:59 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:58 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 13/36] bsd-user/arm/target_syscall.h: Add copyright and update name Date: Thu, 4 Nov 2021 21:18:54 -0600 Message-Id: <20211105031917.87837-14-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d35; envelope-from=imp@bsdimp.com; helo=mail-io1-xd35.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The preferred name for the 32-bit arm is now armv7. Update the name to reflect that. In addition, add Stacey's copyright to this file and update the include guards to the new convention. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_syscall.h | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/bsd-user/arm/target_syscall.h b/bsd-user/arm/target_syscall.h index ef4b37f017..a5f2bb4e01 100644 --- a/bsd-user/arm/target_syscall.h +++ b/bsd-user/arm/target_syscall.h @@ -1,5 +1,24 @@ -#ifndef BSD_USER_ARCH_SYSCALL_H_ -#define BSD_USER_ARCH_SYSCALL_H_ +/* + * arm cpu system call stubs + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef _TARGET_ARCH_SYSCALL_H_ +#define _TARGET_ARCH_SYSCALL_H_ struct target_pt_regs { abi_long uregs[17]; @@ -31,6 +50,6 @@ struct target_pt_regs { #define TARGET_FREEBSD_ARM_GET_TP 3 #define TARGET_HW_MACHINE "arm" -#define TARGET_HW_MACHINE_ARCH "armv6" +#define TARGET_HW_MACHINE_ARCH "armv7" -#endif /* !BSD_USER_ARCH_SYSCALL_H_ */ +#endif /* !_TARGET_ARCH_SYSCALL_H_ */ From patchwork Fri Nov 5 03:18:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551199 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=Om5dZ6t1; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmCv3FpCz9sf8 for ; Fri, 5 Nov 2021 14:27:39 +1100 (AEDT) Received: from localhost ([::1]:40708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miptB-0007Pf-7c for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:27:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipls-0004P4-R4 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:05 -0400 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]:34394) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplq-00047g-9N for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:04 -0400 Received: by mail-io1-xd29.google.com with SMTP id 2so5963453iou.1 for ; Thu, 04 Nov 2021 20:20:01 -0700 (PDT) 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=3XmuKD3L8C0RdT+vaSED8BhWG5EV9OjA2AgZ0ahq8Uw=; b=Om5dZ6t1GD8UDSi2ulRbelVymFATGoKwzbdLN5BIu4b0OW4eQCf1LTb5y4IGuiLEj4 DYdWZFIlMOb4rUgdqjiqu9a7UZN72l61/Gv29Nhqio5P+ixSQhsbGZTIfsO5xSZpTTL8 P3z9Sxp8jFwzVzqBSyjnP4N5efNI5kit3hfVIucslo2wVBLWfCcZ+wS92fvm07KomTsD fZQpR+cybl45iz8soq+DUIsoBRZFsQq7lxl3CeQTlps2EohhrLeq2Nu70JDcppaV3L+Q fkNkaBT3eNbLLOoa+ERisH+CTTj90/ukO3XD3UCZmfyeE/pEvkVCFSSC+9bNXEYgpuuz grCg== 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=3XmuKD3L8C0RdT+vaSED8BhWG5EV9OjA2AgZ0ahq8Uw=; b=hTIsTvZR5bmqtqIsAUd1n8lc5LNjIL3TVrvsCmbToLVoo4fpmtZrBSAtVIRSGomhM4 RJFcsq2ZsKwapw7O2oVLzC/aEulQ5LzOV+QrQ1RKcySsWranKOn65mxjzOSyLSdGxfDS Kp4CLXvgxB9wiUparpube7XFqPGIx88xvjgaa6l5LCCDcJSKNj8ZGeWJuQbde0z+WqHw fYhsQS2VPzgYfviKPDiGt94XY46cbYk42ivHLQqvMZ1N8l94UUJDTvE20j3yi1gGSJ52 1Sc3Ci9hogLGSJ0YnokFk1GvOW432aNp/FN0gqjiNa5WBlL64H5FR4NGPcp1pUE8ncMV d/NQ== X-Gm-Message-State: AOAM533Bhue4Uoqi2YgFApcomumJqC2STxhlUFwqbGVL0HlLfcgWSo3T VimHpc+9w3GkL0WtFvfeRxT97YFMCvR8Pg== X-Google-Smtp-Source: ABdhPJyCWAhSxDQ6dcXH4YsNBjQyB19pkV9o77AE5gnTVafsAacgxzyvdEzmiV1MlDD/TqBUyK2sEA== X-Received: by 2002:a05:6602:27c2:: with SMTP id l2mr39103258ios.147.1636082400204; Thu, 04 Nov 2021 20:20:00 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.19.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:19:59 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 14/36] bsd-user/arm/target_arch_cpu.c: Target specific TLS routines Date: Thu, 4 Nov 2021 21:18:55 -0600 Message-Id: <20211105031917.87837-15-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d29; envelope-from=imp@bsdimp.com; helo=mail-io1-xd29.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Target specific TLS routines to get and set the TLS values. Signed-off-by: Kyle Evans Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch.h | 28 ++++++++++++++++++++++++ bsd-user/arm/target_arch_cpu.c | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 bsd-user/arm/target_arch.h create mode 100644 bsd-user/arm/target_arch_cpu.c diff --git a/bsd-user/arm/target_arch.h b/bsd-user/arm/target_arch.h new file mode 100644 index 0000000000..93cfaea098 --- /dev/null +++ b/bsd-user/arm/target_arch.h @@ -0,0 +1,28 @@ +/* + * ARM 32-bit specific prototypes for bsd-user + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef _TARGET_ARCH_H_ +#define _TARGET_ARCH_H_ + +#include "qemu.h" + +void target_cpu_set_tls(CPUARMState *env, target_ulong newtls); +target_ulong target_cpu_get_tls(CPUARMState *env); + +#endif /* !_TARGET_ARCH_H_ */ diff --git a/bsd-user/arm/target_arch_cpu.c b/bsd-user/arm/target_arch_cpu.c new file mode 100644 index 0000000000..02bf9149d5 --- /dev/null +++ b/bsd-user/arm/target_arch_cpu.c @@ -0,0 +1,39 @@ +/* + * arm cpu related code + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +#include "target_arch.h" + +void target_cpu_set_tls(CPUARMState *env, target_ulong newtls) +{ + if (access_secure_reg(env)) { + env->cp15.tpidrurw_s = newtls; + env->cp15.tpidruro_s = newtls; + return; + } + + env->cp15.tpidr_el[0] = newtls; + env->cp15.tpidrro_el[0] = newtls; +} + +target_ulong target_cpu_get_tls(CPUARMState *env) +{ + if (access_secure_reg(env)) { + return env->cp15.tpidruro_s; + } + return env->cp15.tpidrro_el[0]; +} From patchwork Fri Nov 5 03:18:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551223 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=7sgS0wNa; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmZl0phqz9sf8 for ; Fri, 5 Nov 2021 14:43:59 +1100 (AEDT) Received: from localhost ([::1]:50284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq8y-0007vs-Te for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:43:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplt-0004P7-Fb for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:05 -0400 Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]:33682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplr-000485-EB for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:05 -0400 Received: by mail-il1-x12f.google.com with SMTP id l19so8323111ilk.0 for ; Thu, 04 Nov 2021 20:20:02 -0700 (PDT) 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=5iIfFcYyYja/cPaQ9qdIgUErIUCnLNWxpKMyL/JDBtE=; b=7sgS0wNaMypH+B2pRnp6JxirU8GrwCtcz4vg586usnsBFJtF92pr458j8ima9M1zDc 41DqgpIa90Rj4mSgpWuzolUXTUFDEKVQfB6dRnOBHPhdPXxOXK0dFy4M4LQBPS4V+xYa czXXOtYFXhkl8FawyWHnr8wo4/nwG3caztBTzTAJIzAYb/jMdRbe+u7i6ldsq230fpyP JAGwmlhn6gi+eWLiJIg1b0eFd1eKrWMklc1LstAqiyM9Rak3QHWKaddj2mTmM0QD9PbA DE2Esq+5WLv+oGhUIAWGDtGNMu7MXWx8gPkH+yZaA0vlut1ZOxzFCExUgNXfejlc7TIz hC1w== 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=5iIfFcYyYja/cPaQ9qdIgUErIUCnLNWxpKMyL/JDBtE=; b=oEO7QkoQeVhP8qZWSsdCJ5GpD1gp1s64Xw5ceJfr+PGtCuchRR21bTzZqI8+0hVM1K afSkvpfxqi/okMNtpGSgUqVhps//XLa8yhdI5gJ/wC4X3ywxHlrr8V/sydcpuRacu9XT bhQgXPeI3jYWhVNEFV88MB75XoxbzPyA3GML/mmmeMLjJN8ZYk8c33iHzNYVhbvbnO/H bczE+MJy89qF8/hFPHLlKZm2o63BHMh8WsrKv6RhTU2X+S6hnN6fZT4ntWGc2LGuaIpW rogKHsdTdiBFMpkjAM32fb0s6urXHhcLXQVpavhbbzHN7uLmjQJpTWWUzr+VsfN1ST/h mSsQ== X-Gm-Message-State: AOAM5305+Ip1YuVBVxYw5XaH/tb36VGbKoWxXJvKE+bFEoNcA7rDsCBg kGFs+PTCBdHXgYY1zHiWABrDLJDLm6VygA== X-Google-Smtp-Source: ABdhPJypkh9s3TyDfIXDGWEkSL7tEswAYjkD1GWu7/Rr52YEWzPQUkLVfFX2ESdqVvDLNMZE96iTMA== X-Received: by 2002:a92:cda2:: with SMTP id g2mr28387347ild.46.1636082401440; Thu, 04 Nov 2021 20:20:01 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:01 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 15/36] bsd-user/arm/target_arch_cpu.h: CPU Loop definitions Date: Thu, 4 Nov 2021 21:18:56 -0600 Message-Id: <20211105031917.87837-16-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12f; envelope-from=imp@bsdimp.com; helo=mail-il1-x12f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Olivier Houchard , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" target_arch_cpu.h is for CPU loop definitions. Create the file and define target_cpu_init and target_cpu_reset for arm. Signed-off-by: Olivier Houchard Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_cpu.h | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 bsd-user/arm/target_arch_cpu.h diff --git a/bsd-user/arm/target_arch_cpu.h b/bsd-user/arm/target_arch_cpu.h new file mode 100644 index 0000000000..66215684d6 --- /dev/null +++ b/bsd-user/arm/target_arch_cpu.h @@ -0,0 +1,43 @@ +/* + * arm cpu init and loop + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef _TARGET_ARCH_CPU_H_ +#define _TARGET_ARCH_CPU_H_ + +#include "target_arch.h" + +#define TARGET_DEFAULT_CPU_MODEL "any" + +static inline void target_cpu_init(CPUARMState *env, + struct target_pt_regs *regs) +{ + int i; + + cpsr_write(env, regs->uregs[16], CPSR_USER | CPSR_EXEC, + CPSRWriteByInstr); + for (i = 0; i < 16; i++) { + env->regs[i] = regs->uregs[i]; + } +} + +static inline void target_cpu_reset(CPUArchState *cpu) +{ +} + +#endif /* !_TARGET_ARCH_CPU_H */ From patchwork Fri Nov 5 03:18:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551215 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=MZ/vc/uw; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmQB0smnz9sfG for ; Fri, 5 Nov 2021 14:36:33 +1100 (AEDT) Received: from localhost ([::1]:60830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq1m-0004A0-V6 for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:36:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplu-0004Pe-Pw for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:07 -0400 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]:46971) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplr-00048F-Ps for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:06 -0400 Received: by mail-io1-xd36.google.com with SMTP id i79so8978844ioa.13 for ; Thu, 04 Nov 2021 20:20:03 -0700 (PDT) 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=IOY3t4AaHZe80iw8hQcSliA4Md0iNA8hrA2Uy7U0qF8=; b=MZ/vc/uwwMM0D4ZGvXXSa+8JpjH1La9hcwghoui1HGO/gFzC8EMAFuAfMn2/xReDwX g+2gj4bqsuBz7hk+W5PcypWYYNf6Q2RXBgz3s43tsedBYfz+P7k8Z9ITQebKBH4YEfGM UHQXCEZ7GBkaim6C69pYGTVMRRvXk3ZFdtgTe2csDZJup2tdrmGYrLCABis4KI3dd8Lk xc9vU66qA9jwyOHUI1KFiwVw9mzURmQXyeEBrQe7AZNFA4AovD2mHWqBembQKMcSQlGm TQDlapVuooqim9D1xMon1EfvYrdiin6/zVoF0IDJmcVDpnBCpDp2CTSVMbtztZkmTvzE 8Dgg== 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=IOY3t4AaHZe80iw8hQcSliA4Md0iNA8hrA2Uy7U0qF8=; b=tSmRW+kb5cAr0thhzXoAgj3PHDmBvpIdMZAdKjqj62mNv5Fc0Agu5Est2V6C+ZMbCQ yOyl9zEqHFpVTgqLjZYY+3EzEH4c8yOoW41MHfT4mjc06DD9XE78e8DqxR8JPkzBLoId 6rV/ZZRKs3CSKu6TVAS+RIhc9uHgr0gs2ZclMRnXi9naR970L0oywCZcCH01hhk0p0g2 9IKvsuGeT6llRlFQXcmVD/Jk+qFFnrDhuDEL00w186DG5OENwlsRPMwmClK4YBWcJZJv t7dSghwyQu+HGi8J4OAXgIub90iBsJihn3XCzUbLjOUoxk25nn8+rckRfuw+tRhX6/r1 ciOA== X-Gm-Message-State: AOAM530BZr3pDXnCMa2OPvzHxXZeH5bRm4aRmAQT3vYVwbsp5F1M7/t6 zOuKtni00BCrqZDkjmUttqPTzcZtNXMAHw== X-Google-Smtp-Source: ABdhPJxla9FITUmU/XG7eNbWa2IPDTC1oVHDVn8ZxnC9wFLU2qew942nyuCUsa9e40iSLKnzmF2Wfg== X-Received: by 2002:a02:2345:: with SMTP id u66mr6906527jau.129.1636082402573; Thu, 04 Nov 2021 20:20:02 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:01 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 16/36] bsd-user/arm/target_arch_cpu.h: Implement target_cpu_clone_regs Date: Thu, 4 Nov 2021 21:18:57 -0600 Message-Id: <20211105031917.87837-17-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d36; envelope-from=imp@bsdimp.com; helo=mail-io1-xd36.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Implement target_cpu_clone_regs to clone the resister state on a fork. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_cpu.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bsd-user/arm/target_arch_cpu.h b/bsd-user/arm/target_arch_cpu.h index 66215684d6..fa45d9335d 100644 --- a/bsd-user/arm/target_arch_cpu.h +++ b/bsd-user/arm/target_arch_cpu.h @@ -36,6 +36,14 @@ static inline void target_cpu_init(CPUARMState *env, } } +static inline void target_cpu_clone_regs(CPUARMState *env, target_ulong newsp) +{ + if (newsp) { + env->regs[13] = newsp; + } + env->regs[0] = 0; +} + static inline void target_cpu_reset(CPUArchState *cpu) { } From patchwork Fri Nov 5 03:18:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551218 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=VPByo9HS; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmTN5t4fz9sf8 for ; Fri, 5 Nov 2021 14:39:20 +1100 (AEDT) Received: from localhost ([::1]:41022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq4U-0001Si-KS for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:39:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplw-0004Qh-3O for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:08 -0400 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]:43573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipls-00048W-P3 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:07 -0400 Received: by mail-il1-x130.google.com with SMTP id s14so8245789ilv.10 for ; Thu, 04 Nov 2021 20:20:04 -0700 (PDT) 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=GLFz+hfOtxy/QWMpxfsl9nCO3CdG/6n25bbQ+o+tB/w=; b=VPByo9HSGRWQMPnFe4gpIC5P1pp52UMI+mhoFA6vLrAiYRYztBkpFVCwrneHQestxc RytprFGqceDKPPMq1lKopmu6F12H+fk9g05fsNwFpW2qPTT8ZlcvZjLwqN7+bXd3m29a Eg4lgRgOZOVqBmxTEJOy/Zm1Wsouhz/RGCsLRLoLfAik7Th3KcXZ6xmLf29fGXj0pqBa CUvuMWEwvX6TQXBQON0VgNOrgMIa0096FibzmmLLhMQW7BVZ87NA0iVk2Jg5n4SNZsQX 63Rx0yGk63Zii2v1lwO9tS3cOndcBI6gk4Io4jj96UZT8Qj9j0Yisf7d7slPOWA17T7V iFZQ== 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=GLFz+hfOtxy/QWMpxfsl9nCO3CdG/6n25bbQ+o+tB/w=; b=e1rzPYVvn55CT3bYrZugF/LJordB+A0gTBX43tSViPtvEBG8OKTvvmnhymTGmFQIjm ctNAeT/6G65HAX+4Br2Aj8/7p7ok85Y88K85C+AsHi4zyG1KP2h/KsYb0rdtSBVCHAAJ nUds71QAj6gRj/RVzyNq19SUR/pQGNg34bsZn99NRyXAw7CqO9owKJc4D+gHUhYo9xhm nl305WNrDCw2cgPEDD3hnwFZPTSMJD7RqUVV16KjoWLZK5g2ILhmhJjeCWbDFCcyAycW GtgvVqhBBmF/WBHYkCkG4lqnLIAzHaiHYy21Z23u+D6RkZNd2n9riiSPfL2nMFuhY0mp /pQg== X-Gm-Message-State: AOAM531+LaFZGMmAJLHqWQl7JxFUQR8ofOuIRrJTz/M4d8YTrHYQZU2i +gCrENkk+Tixv3JhuCvNdbu1S3A/e21pRg== X-Google-Smtp-Source: ABdhPJzfc+BIQNUDZL4sUrXb6FSJA9lhy4K8vLjwmTO1RSz9/AuTI4pY4nc11OPMFuefwZ5SwbLxZg== X-Received: by 2002:a92:d411:: with SMTP id q17mr23469321ilm.116.1636082403517; Thu, 04 Nov 2021 20:20:03 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:03 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 17/36] bsd-user/arm/target_arch_cpu.h: Dummy target_cpu_loop implementation Date: Thu, 4 Nov 2021 21:18:58 -0600 Message-Id: <20211105031917.87837-18-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::130; envelope-from=imp@bsdimp.com; helo=mail-il1-x130.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Sean Bruno , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a boiler plate CPU loop that does nothing except return an error for all traps. Signed-off-by: Sean Bruno Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_cpu.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bsd-user/arm/target_arch_cpu.h b/bsd-user/arm/target_arch_cpu.h index fa45d9335d..2484bdc2f7 100644 --- a/bsd-user/arm/target_arch_cpu.h +++ b/bsd-user/arm/target_arch_cpu.h @@ -36,6 +36,28 @@ static inline void target_cpu_init(CPUARMState *env, } } +static inline void target_cpu_loop(CPUARMState *env) +{ + int trapnr; + target_siginfo_t info; + CPUState *cs = env_cpu(env); + + for (;;) { + cpu_exec_start(cs); + trapnr = cpu_exec(cs); + cpu_exec_end(cs); + process_queued_cpu_work(cs); + switch (trapnr) { + default: + fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", + trapnr); + cpu_dump_state(cs, stderr, 0); + abort(); + } /* switch() */ + process_pending_signals(env); + } /* for (;;) */ +} + static inline void target_cpu_clone_regs(CPUARMState *env, target_ulong newsp) { if (newsp) { From patchwork Fri Nov 5 03:18:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551227 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=FZHA2yda; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hlmd721rnz9sf8 for ; Fri, 5 Nov 2021 14:46:03 +1100 (AEDT) Received: from localhost ([::1]:59216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqAz-0005cR-0Y for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:46:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53730) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplw-0004RK-8D for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:08 -0400 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]:44626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplt-00048x-PR for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:07 -0400 Received: by mail-il1-x134.google.com with SMTP id h2so8198848ili.11 for ; Thu, 04 Nov 2021 20:20:05 -0700 (PDT) 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=unoUheHOiBFwRIZBJ0G39ayIeTidxh9oy5cQLMJnocc=; b=FZHA2ydaGrPN3uvp9MS4CP459nkzM7FyZfrZxd8J5kMBFFaM8q+y3K4yNf4bzG11pa sq7AGdfLWFqb3VVzIlp1EQkQpt+u4nCdP0WNnjaUBEwksXQ22mfhALvfnGepbPFN8s9J Gguf5S3RyeKhy3pGzTmEFr4J25Pdn3MDYIRQQ2niDorjJ2ihb2RiDbn/+V4JpjoiF130 im4cb1yWGhhsZvZ7bACW9OZL+Kc/7c6KHofgnKakFd2xdpQ2c1VGRMzncSLZssH71Fg3 5TIHFx/XHZLaqUsap5PxUelJB8af7thQNbiNeUAjP3iBcTQGpzrO/CKqLIaKp2gompUD 9/uA== 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=unoUheHOiBFwRIZBJ0G39ayIeTidxh9oy5cQLMJnocc=; b=gP/wpm8jFb30/fnQ1LKhirjX3vhTH4gAfcZXcP6FZ9NUJHNMo/BTXXOEBRbNPp4Fp5 DuX/cAP5n2NjB9IAUB18GRIklvOqVlsgPIf5Qif6O9q+2P8Ooy4HpSCXGFssV2uKBdUR QGEXknVUTENw6bcSWxFv+P2pRM8R2yUvTUcwt9uUx5/HW24Teu1/eJkGrGkVrVvJ9u2I sQdnQ5cliVZaTSTwTGBPiXsqW6a5AZnvaPCIU5NzEX2ycM7DNcsWw+D+7Bo+6roR5cNs TtncDIFcWRVfiq8VAuCclAtGMdxBEbadbh4pWCmu/+9Ns5qCTyzcOXRgSAiPKaX5pMEn YAfQ== X-Gm-Message-State: AOAM533bycXtjldL8yUPyEDAv9AFej8rozDUdLiNdEWQvtsOsnnr9Xps YI4FJwoDmrXFFe/TY3vV+CmaqlOSyOfsLA== X-Google-Smtp-Source: ABdhPJzUBkl5yF0iSOArViaO+vDlCr3FUAiBch59YqVTaaw3Q5LMZUzIMuTFrXu7shtaWgWMJuP0EA== X-Received: by 2002:a05:6e02:1a21:: with SMTP id g1mr10569735ile.153.1636082404650; Thu, 04 Nov 2021 20:20:04 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:04 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 18/36] bsd-user/arm/target_arch_cpu.h: Implement trivial EXCP exceptions Date: Thu, 4 Nov 2021 21:18:59 -0600 Message-Id: <20211105031917.87837-19-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , =?utf-8?q?Mika=C3=ABl_Urankar?= , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Implement EXCP_UDEF, EXCP_DEBUG, EXCP_INTERRUPT, EXCP_ATOMIC and EXCP_YIELD. The first two generate a signal to the emulated binary. EXCP_ATOMIC handles atomic operations. The remainder are fancy nops. Signed-off-by: Stacey Son Signed-off-by: Mikaël Urankar Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_cpu.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/bsd-user/arm/target_arch_cpu.h b/bsd-user/arm/target_arch_cpu.h index 2484bdc2f7..9f9b380b13 100644 --- a/bsd-user/arm/target_arch_cpu.h +++ b/bsd-user/arm/target_arch_cpu.h @@ -48,6 +48,39 @@ static inline void target_cpu_loop(CPUARMState *env) cpu_exec_end(cs); process_queued_cpu_work(cs); switch (trapnr) { + case EXCP_UDEF: + { + /* See arm/arm/undefined.c undefinedinstruction(); */ + info.si_addr = env->regs[15]; + + /* illegal instruction */ + info.si_signo = TARGET_SIGILL; + info.si_errno = 0; + info.si_code = TARGET_ILL_ILLOPC; + queue_signal(env, info.si_signo, &info); + + /* TODO: What about instruction emulation? */ + } + break; + case EXCP_INTERRUPT: + /* just indicate that signals should be handled asap */ + break; + case EXCP_DEBUG: + { + + info.si_signo = TARGET_SIGTRAP; + info.si_errno = 0; + info.si_code = TARGET_TRAP_BRKPT; + info.si_addr = env->exception.vaddress; + queue_signal(env, info.si_signo, &info); + } + break; + case EXCP_ATOMIC: + cpu_exec_step_atomic(cs); + break; + case EXCP_YIELD: + /* nothing to do here for user-mode, just resume guest code */ + break; default: fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", trapnr); From patchwork Fri Nov 5 03:19:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551230 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=IhcYbX5a; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmjS4YYGz9sf8 for ; Fri, 5 Nov 2021 14:49:48 +1100 (AEDT) Received: from localhost ([::1]:39294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqEc-00036X-B9 for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:49:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miplx-0004Rb-F8 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:09 -0400 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]:39889) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplu-00049V-Q3 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:09 -0400 Received: by mail-io1-xd2d.google.com with SMTP id r3so7829049iod.6 for ; Thu, 04 Nov 2021 20:20:06 -0700 (PDT) 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=IfRWeGYD+0hbc23c7Edg1M5XjxcHd+iZ98b19hdHbHg=; b=IhcYbX5abXFL8PzO6fye0GhR32iHsBReyOxGNf/pTJNi9mstsrcv3CgMqe7K2cPms/ 7CQJbm6SA7Ac3LuV6fDBfYaSw2nk8Cl5KL6KTKjgJOWpZYnJZrTdKEcRXdKoHxn/hOkq 8gE3ZfTSrGQPJrnu1+v3mRcfft4spZ2GZoDI1Q/8BkMMR3zSbMoD6RJiGwOoUry3JYUU imiSmnn/F+B7PyaX49gBfV8M/OS9yoZbp1ZMawlj0hvwjQ4kIC7zVKTp9eqobdG2fpEQ VI7T1rE08gPpEus/Mo1KfqAW4/MhOanMf9tsuZs4k/O223Z2pRReqf+q230KMA6vvv6O uamQ== 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=IfRWeGYD+0hbc23c7Edg1M5XjxcHd+iZ98b19hdHbHg=; b=ch3NyBNW2qNBjvPAtQtpL1qX1CAnbCGoHImgtfCR/cDOWrXBDnV2oK0anE8rPY/Zax lCqw0JjEyMY+t4W2c5HaphgjyL/A5KcBYxC+KCbwI5f+QsHbFaDXpPG7SOqc2wMV3Xdj aac94unu+a8c5H8H/fyd9nPqrHd6ucGLEoaQn0pfnhwvV/FsqeQDtU9Cr7cK8803tb8w CX1RcTuBGB78Q/UKtesStnv/KUwQKyDE5XczyAmd6eYrXU7Mx3541o4i3p0Oa6g+Sc1N g0XVp8dHJ7ZcKU4s3BEKsw+mXlwMEEQQ6LZwRlDZql/7WV4jaLxDyyTIk1nDoZN++Jpg 3Bjw== X-Gm-Message-State: AOAM533GqGbVEoFIxFG2Gn67g8tBMqgn6GRiidYnHNcpn6xf1BTig2No BSl4UoQpXgouKyFWIwjgHnjzq4JUmoGBRw== X-Google-Smtp-Source: ABdhPJyOymMXn+1riwIqYgIiXFhlwjQ4xqOySg02neCZZGhb/AHOIUrEA1fLfY671M/zDA6/8gthdw== X-Received: by 2002:a05:6638:d16:: with SMTP id q22mr7146028jaj.35.1636082405556; Thu, 04 Nov 2021 20:20:05 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:05 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 19/36] bsd-user/arm/target_arch_cpu.h: Implement data abort exceptions Date: Thu, 4 Nov 2021 21:19:00 -0600 Message-Id: <20211105031917.87837-20-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2d; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Olivier Houchard , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Implement EXCP_PREFETCH_ABORT AND EXCP_DATA_ABORT. Both of these data exceptions cause a SIGSEGV. Signed-off-by: Kyle Evans Signed-off-by: Olivier Houchard Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_cpu.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bsd-user/arm/target_arch_cpu.h b/bsd-user/arm/target_arch_cpu.h index 9f9b380b13..905a5ffaff 100644 --- a/bsd-user/arm/target_arch_cpu.h +++ b/bsd-user/arm/target_arch_cpu.h @@ -65,6 +65,17 @@ static inline void target_cpu_loop(CPUARMState *env) case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; + case EXCP_PREFETCH_ABORT: + /* See arm/arm/trap.c prefetch_abort_handler() */ + case EXCP_DATA_ABORT: + /* See arm/arm/trap.c data_abort_handler() */ + info.si_signo = TARGET_SIGSEGV; + info.si_errno = 0; + /* XXX: check env->error_code */ + info.si_code = 0; + info.si_addr = env->exception.vaddress; + queue_signal(env, info.si_signo, &info); + break; case EXCP_DEBUG: { From patchwork Fri Nov 5 03:19:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551234 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=6sE0pexe; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmmF1m3qz9sf8 for ; Fri, 5 Nov 2021 14:52:13 +1100 (AEDT) Received: from localhost ([::1]:47336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqGx-0000Bz-2I for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:52:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miply-0004TC-UL for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:11 -0400 Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]:36682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplv-0004AA-Ps for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:10 -0400 Received: by mail-il1-x12f.google.com with SMTP id l8so8272724ilv.3 for ; Thu, 04 Nov 2021 20:20:07 -0700 (PDT) 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=98BqBI8TmV8YvyFkZ3y+XgKQlmpyG8KzRCO1YXNy77I=; b=6sE0pexeQqrn5SF0NWwdIXpUZQpVKw3scy75G62WVxFc4j88ikoIBgIyqRvgYulcPn ZU3oSvxOghyJaD8EiwFFTs0FkTfy95D1B3JlwoOzYeZ2Gtr51s/SmaZzUQNcN8aijcir u4aoxd6WDz2GooofZ834Us2dSpF2RayGhI1q+F3bajNOwaCs2vf/lIfpDz83sO2FJvhb riLPbEiRy/BbavyP4Z1iELrzSIsAPM2ScNYSoGhli5pmAhjcBit1/tcO7fPEPXnxKhmY KPHmonLV82TYL1A/D0XGZxp/PUiJBrK9JpXrQv+bsS4kNlK5lBUUoFn9Gblb2wWi36BS aZ4A== 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=98BqBI8TmV8YvyFkZ3y+XgKQlmpyG8KzRCO1YXNy77I=; b=Eh5YM8foH4hTFMyKQ8QTQlk3Hzdj+onT2dh9EecAapKwBPe9bTj5q0xAn3PeR/bo+W MI85z0/Az4S9THWIINgPVEN8eCTCP6aYqnXE1u3WtosTRRGDfXt31cXhcOVBPoNfYItC smvUal8r0tDr+Ii1ntU2GYlTSn5t29cm7L1PNwChzUdl0To1Fw3+B7yG5E5Wvjr3f5Pe 5s9MVzrRzUP6P0om7wZuEZj2iYUIJxDJpWPIyXHXmfwU6T0rEw51rpOnpgTAwyAAmosL 6RfCfjnDlfrIE0K0yG5mSWUVbVJftRHrt4piwB9RMJ/hMQ3bWUBbbx8arTGj6HyE7j+H Z/aQ== X-Gm-Message-State: AOAM530eUnypS8RLpUtu7Lkmr9bW9eepQUb5trTvp/DcOdnqNrPzH5E/ ZX2+f41eHGraODkn44X6Pb8ZQLKPRoSR9w== X-Google-Smtp-Source: ABdhPJwjwBmxYr41/gavOmKZMyGacQ1Y+/tLALNYmyBnQ6M7yXK5r8+gyGckd1PQws/SWIJCIFPiMA== X-Received: by 2002:a05:6e02:1be2:: with SMTP id y2mr34609188ilv.22.1636082406573; Thu, 04 Nov 2021 20:20:06 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:06 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 20/36] bsd-user/arm/target_arch_cpu.h: Implement system call dispatch Date: Thu, 4 Nov 2021 21:19:01 -0600 Message-Id: <20211105031917.87837-21-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12f; envelope-from=imp@bsdimp.com; helo=mail-il1-x12f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Implement the system call dispatch. This implements all three kinds of system call: direct and the two indirect variants. It handles all the special cases for thumb as well. Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_cpu.h | 94 ++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/bsd-user/arm/target_arch_cpu.h b/bsd-user/arm/target_arch_cpu.h index 905a5ffaff..c675419c30 100644 --- a/bsd-user/arm/target_arch_cpu.h +++ b/bsd-user/arm/target_arch_cpu.h @@ -40,6 +40,7 @@ static inline void target_cpu_loop(CPUARMState *env) { int trapnr; target_siginfo_t info; + unsigned int n; CPUState *cs = env_cpu(env); for (;;) { @@ -62,6 +63,99 @@ static inline void target_cpu_loop(CPUARMState *env) /* TODO: What about instruction emulation? */ } break; + case EXCP_SWI: + case EXCP_BKPT: + { + /* + * system call + * See arm/arm/trap.c cpu_fetch_syscall_args() + */ + if (trapnr == EXCP_BKPT) { + if (env->thumb) { + env->regs[15] += 2; + } else { + env->regs[15] += 4; + } + } + n = env->regs[7]; + if (bsd_type == target_freebsd) { + int ret; + abi_ulong params = get_sp_from_cpustate(env); + int32_t syscall_nr = n; + int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; + + /* See arm/arm/trap.c cpu_fetch_syscall_args() */ + if (syscall_nr == TARGET_FREEBSD_NR_syscall) { + syscall_nr = env->regs[0]; + arg1 = env->regs[1]; + arg2 = env->regs[2]; + arg3 = env->regs[3]; + get_user_s32(arg4, params); + params += sizeof(int32_t); + get_user_s32(arg5, params); + params += sizeof(int32_t); + get_user_s32(arg6, params); + params += sizeof(int32_t); + get_user_s32(arg7, params); + arg8 = 0; + } else if (syscall_nr == TARGET_FREEBSD_NR___syscall) { + syscall_nr = env->regs[0]; + arg1 = env->regs[2]; + arg2 = env->regs[3]; + get_user_s32(arg3, params); + params += sizeof(int32_t); + get_user_s32(arg4, params); + params += sizeof(int32_t); + get_user_s32(arg5, params); + params += sizeof(int32_t); + get_user_s32(arg6, params); + arg7 = 0; + arg8 = 0; + } else { + arg1 = env->regs[0]; + arg2 = env->regs[1]; + arg3 = env->regs[2]; + arg4 = env->regs[3]; + get_user_s32(arg5, params); + params += sizeof(int32_t); + get_user_s32(arg6, params); + params += sizeof(int32_t); + get_user_s32(arg7, params); + params += sizeof(int32_t); + get_user_s32(arg8, params); + } + ret = do_freebsd_syscall(env, syscall_nr, arg1, arg2, arg3, + arg4, arg5, arg6, arg7, arg8); + /* + * Compare to arm/arm/vm_machdep.c + * cpu_set_syscall_retval() + */ + if (-TARGET_EJUSTRETURN == ret) { + /* + * Returning from a successful sigreturn syscall. + * Avoid clobbering register state. + */ + break; + } + if (-TARGET_ERESTART == ret) { + env->regs[15] -= env->thumb ? 2 : 4; + break; + } + if ((unsigned int)ret >= (unsigned int)(-515)) { + ret = -ret; + cpsr_write(env, CPSR_C, CPSR_C, CPSRWriteByInstr); + env->regs[0] = ret; + } else { + cpsr_write(env, 0, CPSR_C, CPSRWriteByInstr); + env->regs[0] = ret; /* XXX need to handle lseek()? */ + /* env->regs[1] = 0; */ + } + } else { + fprintf(stderr, "qemu: bsd_type (= %d) syscall " + "not supported\n", bsd_type); + } + } + break; case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; From patchwork Fri Nov 5 03:19:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551207 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=fyq52+1H; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmM107Kcz9sf8 for ; Fri, 5 Nov 2021 14:33:49 +1100 (AEDT) Received: from localhost ([::1]:56560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mipz8-0001JN-PR for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:33:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm0-0004VL-LJ for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:13 -0400 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]:35753) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplx-0004An-9K for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:12 -0400 Received: by mail-io1-xd2a.google.com with SMTP id c206so7788581iof.2 for ; Thu, 04 Nov 2021 20:20:08 -0700 (PDT) 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=rKLMBYjEYlw1VjEHepSl0BqgSbBEPtGPWDcDEzPgUqg=; b=fyq52+1H7qnvQoDjJrPOm/QQp1mut1XErFX58Q9qnLnEZ4VXfWuiqKVNvlgI+kptM1 Cfy0Gj/Uo2OS2mn0M9/g/oWt7GFFRfYyS310V9BIjcsdaYIE/8BaCcdAhft1Vnvwl5Qj n1/z5eIgi2Du/KuWWtqtLKjz7jxUHPWTxaAnZPjYG6QQm9qfxh5RRnkYvj6kQVIMC3g+ JysL0DQ2uyS0Cui2MrJ+S/MLWaCU45Lqa0CyEcRFZ2/PQcOCnAY1Frb7IXVoiNXlqyKZ xhpDYO+jwruo3+JfsGaRbX77BBD5jjp587R82D/mHpcMc7he5KmoRGnpQ+cVVOyNNsAV HmFw== 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=rKLMBYjEYlw1VjEHepSl0BqgSbBEPtGPWDcDEzPgUqg=; b=moYNcPbBfcZidYxgRhsKOkdk7syE8QbWixXLB+3ZM1v96PSOQvBxy1nAvswPYXrxky 1ACQnoAnjIGjzK2IwmhK5TtgLq9q3w2UWqdwjdjkOGzcPywezJ8+87H9UXWAY8n5xYrB cVc+Qr1pYqNN3R1xjSMsTGgz/L8mq41LqDwau6sxixNVV+2ZfFId4BeRUXEI7EzCe6wB Q0yeQ/I5HhZoXB9hCDw5bHXVPDLQDG4u5jhmp9FhGSXHX0UMIYcOCczIiwVeoCtQQ4uT P66cra/xf3k0ufL9ynOp4dGLbeMZwAmZXxZqDAdtoVxTA5AQrOOA8ON7XNeAxkMqe1Yq e9gQ== X-Gm-Message-State: AOAM531DKDf/MigR72UgWDypd+Jm0R9iGqQZJwHMAA1+70VfoZfwjRsE yJY1hr+4RXLytcQa6LlpWD2YAPhiHCjq6w== X-Google-Smtp-Source: ABdhPJzk+D4b1B7miKa6SSKPZqy971p97GfKWh5yptfPDoXHd0QDPOgyljctneo8X8+a1smh0f+b4w== X-Received: by 2002:a05:6638:164a:: with SMTP id a10mr7011222jat.1.1636082407765; Thu, 04 Nov 2021 20:20:07 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:07 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 21/36] bsd-user/arm/target_arch_reg.h: Implement core dump register copying Date: Thu, 4 Nov 2021 21:19:02 -0600 Message-Id: <20211105031917.87837-22-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2a; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Implement the register copying routines to extract registers from the cpu for core dump generation. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_reg.h | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 bsd-user/arm/target_arch_reg.h diff --git a/bsd-user/arm/target_arch_reg.h b/bsd-user/arm/target_arch_reg.h new file mode 100644 index 0000000000..ef5ed5154f --- /dev/null +++ b/bsd-user/arm/target_arch_reg.h @@ -0,0 +1,60 @@ +/* + * FreeBSD arm register structures + * + * Copyright (c) 2015 Stacey Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef _TARGET_ARCH_REG_H_ +#define _TARGET_ARCH_REG_H_ + +/* See sys/arm/include/reg.h */ +typedef struct target_reg { + uint32_t r[13]; + uint32_t r_sp; + uint32_t r_lr; + uint32_t r_pc; + uint32_t r_cpsr; +} target_reg_t; + +typedef struct target_fp_reg { + uint32_t fp_exponent; + uint32_t fp_mantissa_hi; + u_int32_t fp_mantissa_lo; +} target_fp_reg_t; + +typedef struct target_fpreg { + uint32_t fpr_fpsr; + target_fp_reg_t fpr[8]; +} target_fpreg_t; + +#define tswapreg(ptr) tswapal(ptr) + +static inline void target_copy_regs(target_reg_t *regs, const CPUARMState *env) +{ + int i; + + for (i = 0; i < 13; i++) { + regs->r[i] = tswapreg(env->regs[i + 1]); + } + regs->r_sp = tswapreg(env->regs[13]); + regs->r_lr = tswapreg(env->regs[14]); + regs->r_pc = tswapreg(env->regs[15]); + regs->r_cpsr = tswapreg(cpsr_read((CPUARMState *)env)); +} + +#undef tswapreg + +#endif /* !_TARGET_ARCH_REG_H_ */ From patchwork Fri Nov 5 03:19:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551224 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=jv0dLjV4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmZr0T2cz9sf8 for ; Fri, 5 Nov 2021 14:44:04 +1100 (AEDT) Received: from localhost ([::1]:50760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq93-0008HT-QP for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:44:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm0-0004VK-H1 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:13 -0400 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]:35567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miply-0004B9-3f for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:12 -0400 Received: by mail-il1-x134.google.com with SMTP id w15so8272493ill.2 for ; Thu, 04 Nov 2021 20:20:09 -0700 (PDT) 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=1ztRBQYqWrUwRLf6NQ4W8izvboRcDbY0eKrhIvHHz3I=; b=jv0dLjV4mrXUY3snyiQ6c51BEj97lhaQkMRHPwt5k7otCAN+GpVbKFtyHbXikURwa7 rgV5xgjl0vSE17euTf4i7SrE5RuIugPGBca6SBnznD2Ep/8lsEsNrpse60IjZ319Dm9z dz+n1PHGv4EY3EopGMUQXuLuts8ukU/PTlNJKT00v40U4NNR69V+0HpZVCSU9EbRwWdD i/+tbNoIgu0ZgU5gTOIrQL7/X9W5T8tYdutldwMjEqRpc4ANnv/o+taHI8vgiDJQD2qg PxyJbGPn3Kz9P8tED+CPDst8h9MUN7bbwcPD4Ea4N/wa+kvX7KzRZ1e/8+SH/56isWlt cptQ== 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=1ztRBQYqWrUwRLf6NQ4W8izvboRcDbY0eKrhIvHHz3I=; b=u4YUq/5f2a1K/vrUO6+KRczxThs6Rqmp8CK8wczJozaq/HlN2fYOMUtzBqtGe2Q5yN Vg9XIZrpJHA20UnPYAsMWaPVBjMeYttWaINoQ88Q/CpqFE3Ws6Oeqne7asBZwFC4K/yN nzdPhMaLT+tew7X1cGzpyYE187rO0iDi7YLOyBRwugpp2z96U60b6B7XH3bKy9gpotYP JonkQ63mHczyXAWQZSucFq8gYVsufGOyCPtLH5RFZkW/SlnVLtyjoP3BoVUJcTSaZL4l Q38vi3xYNvG/laRa731Kgz3jCn9noG/MkvocWez7h4cyRYgWfS6CsOo3fEy/2Wyo23Mx 20KQ== X-Gm-Message-State: AOAM533j5aZm1KrasAnfSg6QJEqmP9LJXF/EDk1/zeYcrEzlaVMNgdYZ Wtf7fquRqHxB+I1t1LvynnxG3FIF5V4xlg== X-Google-Smtp-Source: ABdhPJxQKqlXIZYFNc73EhrO2XRmXvaNTXGZacHM5nhF33rM9hn0hDbkSfRJXtXMiWWMlOh0VXUzOg== X-Received: by 2002:a92:d48f:: with SMTP id p15mr36433785ilg.236.1636082408953; Thu, 04 Nov 2021 20:20:08 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:08 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 22/36] bsd-user/arm/target_arch_vmparam.h: Parameters for arm address space Date: Thu, 4 Nov 2021 21:19:03 -0600 Message-Id: <20211105031917.87837-23-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Various parameters describing the layout of the ARM address space. In addition, define routines to get the stack pointer and to set the second return value. Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_vmparam.h | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 bsd-user/arm/target_arch_vmparam.h diff --git a/bsd-user/arm/target_arch_vmparam.h b/bsd-user/arm/target_arch_vmparam.h new file mode 100644 index 0000000000..4bbc04ddf5 --- /dev/null +++ b/bsd-user/arm/target_arch_vmparam.h @@ -0,0 +1,48 @@ +/* + * arm VM parameters definitions + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +#ifndef _TARGET_ARCH_VMPARAM_H_ +#define _TARGET_ARCH_VMPARAM_H_ + +#include "cpu.h" + +/* compare to sys/arm/include/vmparam.h */ +#define TARGET_MAXTSIZ (64 * MiB) /* max text size */ +#define TARGET_DFLDSIZ (128 * MiB) /* initial data size limit */ +#define TARGET_MAXDSIZ (512 * MiB) /* max data size */ +#define TARGET_DFLSSIZ (4 * MiB) /* initial stack size limit */ +#define TARGET_MAXSSIZ (64 * MiB) /* max stack size */ +#define TARGET_SGROWSIZ (128 * KiB) /* amount to grow stack */ + +#define TARGET_RESERVED_VA 0xf7000000 + + /* KERNBASE - 512 MB */ +#define TARGET_VM_MAXUSER_ADDRESS (0xc0000000 - (512 * MiB)) +#define TARGET_USRSTACK TARGET_VM_MAXUSER_ADDRESS + +static inline abi_ulong get_sp_from_cpustate(CPUARMState *state) +{ + return state->regs[13]; /* sp */ +} + +static inline void set_second_rval(CPUARMState *state, abi_ulong retval2) +{ + state->regs[1] = retval2; +} + +#endif /* ! _TARGET_ARCH_VMPARAM_H_ */ From patchwork Fri Nov 5 03:19:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551235 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=o+r8nElG; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hlmrh15zlz9sf8 for ; Fri, 5 Nov 2021 14:56:03 +1100 (AEDT) Received: from localhost ([::1]:56094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqKf-0006Ji-NM for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:56:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm1-0004XV-Tg for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:15 -0400 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]:36687) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miplz-0004BW-BY for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:13 -0400 Received: by mail-il1-x134.google.com with SMTP id l8so8272846ilv.3 for ; Thu, 04 Nov 2021 20:20:11 -0700 (PDT) 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=F9IbbLGjnRnokIuDKxQfCzJoAx075CoGnpnzgfUmRKo=; b=o+r8nElG3iCR9bk7QdbDAE/A0lmTYP5RtZS7XOEARN2hyhWqEMr5ogYwXPJT4P8IJ3 bB4aw9oqBvowgUv0ByB8aNoc0zuZZ2xuOpMr/Kbamqcn06w7ZT9w65Z07aAr/NwQLRfW 4xz4cSD4NWgD4ENbATeR+mG5g/j5/ElpwiVZLW41SyxDrpxMsdetxHG208kqsYdmgcLh lMb050xsM+mpE3iyBwzCGK19f8RKm60QgSEbnHeTBHNk7rKm8I/CAYKZ7789geVxEoF5 2mnZ8g2z5Zjo+l2Lh6E1UDCfrwGXlHkSE7oOJ9PsqS+/xBX/tMczyE3j7PTDRFMiaiPX X4Ew== 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=F9IbbLGjnRnokIuDKxQfCzJoAx075CoGnpnzgfUmRKo=; b=U/phCSc60+ATKkcnou60YM5cSk9nTo1ncylH18SaHaux+lyB52Vn7nDsyfRPE+TZdB Ds4e4Nk8mWxrVRrsIFwHy4kIIajFbsEemrTFKnhf54mf1ba5Tqf6epLCVsvGi4Gud65C hpY6u6hX3MaYPKuTdVoOX1hFsSv6YMdizsks/ZAmE5ECBRu53UdTAusYv2py0PFL9Oip SsHYQhfJSaRN7EPJtlXsvWamITw9UpRSS9wlC/MCjqJ2A4L+RDOmNe1hF/TGKx+47ebK fpAtWqPrH96naaAZtYiDetWDv0/wRuI27AfXOtMD4vTzvP1pNSwkbKAjqbiay/3VfJtn GsxA== X-Gm-Message-State: AOAM5307dCE4fq4PPuMyvuj4aT9Oeol7Ue8IPN5fOb726UkDhHvthHYo zx9VHxGyGgIKxe5FPv23xiBxcWAy3JHsZQ== X-Google-Smtp-Source: ABdhPJy68Ox0LvXgWo+tH9YM1MJ0iaOv59KpkNWxx53+Sbqc1stQBaLdPAiC3ySF5Wml+k7mY4xXqQ== X-Received: by 2002:a92:ca48:: with SMTP id q8mr39332048ilo.173.1636082409906; Thu, 04 Nov 2021 20:20:09 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:09 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 23/36] bsd-user/arm/target_arch_sigtramp.h: Signal Trampoline for arm Date: Thu, 4 Nov 2021 21:19:04 -0600 Message-Id: <20211105031917.87837-24-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Copy of the signal trampoline code for arm, as well as setup_sigtramp to write it to the stack. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_sigtramp.h | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 bsd-user/arm/target_arch_sigtramp.h diff --git a/bsd-user/arm/target_arch_sigtramp.h b/bsd-user/arm/target_arch_sigtramp.h new file mode 100644 index 0000000000..5d434a9e7e --- /dev/null +++ b/bsd-user/arm/target_arch_sigtramp.h @@ -0,0 +1,49 @@ +/* + * arm sysarch() system call emulation + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef _TARGET_ARCH_SIGTRAMP_H_ +#define _TARGET_ARCH_SIGTRAMP_H_ + +/* Compare to arm/arm/locore.S ENTRY_NP(sigcode) */ +static inline abi_long setup_sigtramp(abi_ulong offset, unsigned sigf_uc, + unsigned sys_sigreturn) +{ + int i; + uint32_t sys_exit = TARGET_FREEBSD_NR_exit; + uint32_t sigtramp_code[] = { + /* 1 */ 0xE1A0000D, /* mov r0, sp */ + /* 2 */ 0xE2800000 + sigf_uc, /* add r0, r0, #SIGF_UC */ + /* 3 */ 0xE59F700C, /* ldr r7, [pc, #12] */ + /* 4 */ 0xEF000000 + sys_sigreturn, /* swi (SYS_sigreturn) */ + /* 5 */ 0xE59F7008, /* ldr r7, [pc, #8] */ + /* 6 */ 0xEF000000 + sys_exit, /* swi (SYS_exit)*/ + /* 7 */ 0xEAFFFFFA, /* b . -16 */ + /* 8 */ sys_sigreturn, + /* 9 */ sys_exit + }; + + G_STATIC_ASSERT(sizeof(sigtramp_code) == TARGET_SZSIGCODE); + + for (i = 0; i < 9; i++) { + tswap32s(&sigtramp_code[i]); + } + + return memcpy_to_target(offset, sigtramp_code, TARGET_SZSIGCODE); +} +#endif /* _TARGET_ARCH_SIGTRAMP_H_ */ From patchwork Fri Nov 5 03:19:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551222 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=uocYHOL+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmXg5g3xz9sf8 for ; Fri, 5 Nov 2021 14:42:10 +1100 (AEDT) Received: from localhost ([::1]:46442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq7C-00056Z-Qk for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:42:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm4-0004ak-0G for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:16 -0400 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]:43779) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipm0-0004Bt-9T for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:15 -0400 Received: by mail-io1-xd32.google.com with SMTP id b203so5835785iof.10 for ; Thu, 04 Nov 2021 20:20:11 -0700 (PDT) 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=4oZ5iwXqrJmDcU+2qXHAQ++/SNnYAx62sujgKs8Ho4M=; b=uocYHOL+N/Zc+TzaAsIC0fuw++G00gnW8Jej5GciuPQE3PGm9ZAxaafpaQDaYNOeiQ bBFnil65s+NIOrhWIWDmk2KaS5+MWtQNxTf42KSTtvVh5La/RvTUlK6C5eZzSEcEybJd 31vij7bUVfU3yTBNMhjvLiMxL1U7Y5J9+OGgo75m1GwW0hcBCwPZ4uEu7kAZnEqZhWeV 01z32GahkjmcVJXUKOi3mA4qvb//t90fpzVvjaPB4xCwQbuzUuknQnsC36QDDV8dOORq F3PzkzLetCxHssk18JvWlgpsG/va6S/oH6QvcgNvd8bCWohTNScfCRfvVjaaLsQPzTl+ sTXw== 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=4oZ5iwXqrJmDcU+2qXHAQ++/SNnYAx62sujgKs8Ho4M=; b=jnbsr+nA4Vq+pSVsYBLAj3GRpWijlTVnyKn47xBdE+KNJ0SbzVCSuvXCq4gnF1Dtl8 XQ9rX1H8tFxAR/DBso2JNCJ5nyWoX8iCyOJdtfymyQw3K86DYm44TNkkLuJN9VOp2WSl IwW0jnnLychqbRVI9odWi1EI08RNTtukcLgQnjSgeQC6VrFYeFqwIbCjm384aW+nKXlT f3XU+aZ+mpGL3lo4cKjA0aIkKoK6k5QhMk9saugrBk3hY6y/Z/xM9hFh3K1kr+OadpWJ eGQKu1hwq2IQmtMtNtB3guoiJJxT9XzemgAFUZoMdhmXrs1MAAUDgiJLmqUjl2iZ2K59 G4XA== X-Gm-Message-State: AOAM532NjnWuy3wITacpiN4e+wW4xCdvz6V4yqZsr054Z1ieyTrXE3VS G6Ri0SMLq3ZnKTvcXAm3oWbZtLfkMb+x3A== X-Google-Smtp-Source: ABdhPJxdbmQMhIEDU+vkko9gQWHAA9XohINh0Vprdbh9VKuvscTT6O/MIi+1+d7Osa42nfb6ne+NjA== X-Received: by 2002:a05:6602:2293:: with SMTP id d19mr4244150iod.71.1636082411069; Thu, 04 Nov 2021 20:20:11 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:10 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 24/36] bsd-user/arm/target_arch_thread.h: Routines to create and switch to a thread Date: Thu, 4 Nov 2021 21:19:05 -0600 Message-Id: <20211105031917.87837-25-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d32; envelope-from=imp@bsdimp.com; helo=mail-io1-xd32.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Implement target_thread_init (to create a thread) and target_set_upcall (to switch to a thread) for arm. Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Kyle Evans --- bsd-user/arm/target_arch_thread.h | 82 +++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 bsd-user/arm/target_arch_thread.h diff --git a/bsd-user/arm/target_arch_thread.h b/bsd-user/arm/target_arch_thread.h new file mode 100644 index 0000000000..11c7f76583 --- /dev/null +++ b/bsd-user/arm/target_arch_thread.h @@ -0,0 +1,82 @@ +/* + * arm thread support + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +#ifndef _TARGET_ARCH_THREAD_H_ +#define _TARGET_ARCH_THREAD_H_ + +/* Compare to arm/arm/vm_machdep.c cpu_set_upcall_kse() */ +static inline void target_thread_set_upcall(CPUARMState *env, abi_ulong entry, + abi_ulong arg, abi_ulong stack_base, abi_ulong stack_size) +{ + abi_ulong sp; + + /* + * Make sure the stack is properly aligned. + * arm/include/param.h (STACKLIGN() macro) + */ + sp = (u_int)(stack_base + stack_size) & ~0x7; + + /* sp = stack base */ + env->regs[13] = sp; + /* pc = start function entry */ + env->regs[15] = entry & 0xfffffffe; + /* r0 = arg */ + env->regs[0] = arg; + env->spsr = ARM_CPU_MODE_USR; + /* + * Thumb mode is encoded by the low bit in the entry point (since ARM can't + * execute at odd addresses). When it's set, set the Thumb bit (T) in the + * CPSR. + */ + cpsr_write(env, (entry & 1) * CPSR_T, CPSR_T, CPSRWriteByInstr); +} + +static inline void target_thread_init(struct target_pt_regs *regs, + struct image_info *infop) +{ + abi_long stack = infop->start_stack; + memset(regs, 0, sizeof(*regs)); + regs->ARM_cpsr = ARM_CPU_MODE_USR; + /* + * Thumb mode is encoded by the low bit in the entry point (since ARM can't + * execute at odd addresses). When it's set, set the Thumb bit (T) in the + * CPSR. + */ + if (infop->entry & 1) { + regs->ARM_cpsr |= CPSR_T; + } + regs->ARM_pc = infop->entry & 0xfffffffe; + regs->ARM_sp = stack; + if (bsd_type == target_freebsd) { + regs->ARM_lr = infop->entry & 0xfffffffe; + } + /* + * FreeBSD kernel passes the ps_strings pointer in r0. This is used by some + * programs to set status messages that we see in ps. bsd-user doesn't + * support that functionality, so it's ignored. When set to 0, FreeBSD's csu + * code ignores it. For the static case, r1 and r2 are effectively ignored + * by the csu __startup() routine. For the dynamic case, rtld saves r0 but + * generates r1 and r2 and passes them into the csu _startup. + * + * r0 ps_strings 0 passed since ps arg setting not supported + * r1 obj_main ignored by _start(), so 0 passed + * r2 cleanup generated by rtld or ignored by _start(), so 0 passed + */ +} + +#endif /* !_TARGET_ARCH_THREAD_H_ */ From patchwork Fri Nov 5 03:19:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551226 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=kjjfayhK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hlmbx5hYBz9sf8 for ; Fri, 5 Nov 2021 14:45:01 +1100 (AEDT) Received: from localhost ([::1]:55122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq9z-0002uJ-Am for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:44:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm4-0004ck-Rq for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:16 -0400 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]:44918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipm3-0004CI-5E for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:16 -0400 Received: by mail-io1-xd31.google.com with SMTP id f9so9187406ioo.11 for ; Thu, 04 Nov 2021 20:20:13 -0700 (PDT) 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=oLmdczkCWtTXgS+hIrrLVL8jr4D4Q93OjOn0dkypiZQ=; b=kjjfayhKhadnXPKY1Ckovw00NxlvpWARnZb4s3n5yYGoratnwoCc6pDRdN7gu3lBQQ +A+16Qdkgkt7/zFk4BEJTj/cqH+7Y1avHtbX7XuMqAc5y1Pp6C1soogWVMsFd6H6RSpe yH49cl4shqbXcWtYgl115XQf6J/nbS2pwYv4l9ZY8RmoCF/jI+md8JqEjWvJflguAed5 PY14pM/vMfZIxE6P7Xh8BBSVMtpTqj0qjq/87hNACekeBLanYssQPe14m4X09KFMM45h v/Btw2WUoT5IOfkeqUSZf8ODxS3bXWNYP1p0RRjRdLwvtnr1bJtJ+lucSFKQIFdDkxiT jlWQ== 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=oLmdczkCWtTXgS+hIrrLVL8jr4D4Q93OjOn0dkypiZQ=; b=xcPx91uyLeW7lkqrKttuDLqOQj5orF4VIt11MgIELn51hEWPfx1YzxhRUHWI0lx+xj 0lK1Dp5Elo1R0f0JhXjH2rMydMQejFALvidCSHPk6drw2Fe0FIJX9rGuAUp7rKSryHkk mL2mLE0Ax4IKQhZNBkJNZ5fald/RRjBChzD7tCJo/XhdUWGI+WQWyFICqr+oFsiTAUY5 TmAnnwUWnxPGDTnF+71JmMTA2uGpnf3qJZQsr5CajIFdKTQyiMXICydF1wzJGswmL8Gz N6bNGxI9l/24/7W3t4mQ0w3GQETGqzWOgUg0NXbS1Z2/UalNI6ZwelXfwTeKM3IguCxH oUjg== X-Gm-Message-State: AOAM533cL3N7efTwbqdGXUzG6k1disA8V0ykXX6CqwjM26kZV351LT5r Rj1PnZLP8DhT0w87nqC36FYOowUZnBq9yg== X-Google-Smtp-Source: ABdhPJwGvscJUcaIAXCijl95dr/Y77kQ+aVHvBfpdR2ckhnOj+PfMFQcSEhy9jAWkwScMVmf18Y6Hw== X-Received: by 2002:a05:6602:1649:: with SMTP id y9mr26275400iow.133.1636082412292; Thu, 04 Nov 2021 20:20:12 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:11 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 25/36] bsd-user/arm/target_arch_elf.h: arm defines for ELF Date: Thu, 4 Nov 2021 21:19:06 -0600 Message-Id: <20211105031917.87837-26-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d31; envelope-from=imp@bsdimp.com; helo=mail-io1-xd31.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Basic set of defines needed for arm ELF file activation. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_elf.h | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 bsd-user/arm/target_arch_elf.h diff --git a/bsd-user/arm/target_arch_elf.h b/bsd-user/arm/target_arch_elf.h new file mode 100644 index 0000000000..15b5c66511 --- /dev/null +++ b/bsd-user/arm/target_arch_elf.h @@ -0,0 +1,36 @@ +/* + * arm ELF definitions + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define ELF_START_MMAP 0x80000000 +#define ELF_ET_DYN_LOAD_ADDR 0x500000 + +#define elf_check_arch(x) ((x) == EM_ARM) + +#define ELF_CLASS ELFCLASS32 +#define ELF_DATA ELFDATA2LSB +#define ELF_ARCH EM_ARM + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +#define ELF_HWCAP 0 + +#endif /* _TARGET_ARCH_ELF_H_ */ From patchwork Fri Nov 5 03:19:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551237 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=vnUCfdYj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmvM3kDyz9sfG for ; Fri, 5 Nov 2021 14:58:23 +1100 (AEDT) Received: from localhost ([::1]:34756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqMu-0002kS-Rd for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:58:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm5-0004ga-PP for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:17 -0400 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]:38857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipm3-0004CW-5S for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:17 -0400 Received: by mail-io1-xd30.google.com with SMTP id v65so9301977ioe.5 for ; Thu, 04 Nov 2021 20:20:13 -0700 (PDT) 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=8R82c+oSIU+sp8WqnJE/Io3vjzLSVpjkS5kzwk9Q/Pk=; b=vnUCfdYjsH88o9fPUsVo+W+O0+5uumY9F7skizHk8Kfc9gKK9W5Bn7RE9C1VgxtDs/ bD8ftsPqTeDjMQKstVXwoi29ZzdNeMEc9M86iAgT9r/ydm23M0K+mOekOchDn9T8UA0R Jl7yPoMGX4fXS017AiRlGwCiAGBxHAbutgt9aDAtLyto5Owl7G0inX45s5pP1mfSiU6c NlIA792KAFNCoJm/X9rbzDOsXyn1bIoPEQmY7eSy4ICcUgu5NFIG9Oj5NqCuGS3ypZ2z 10pd+AOio/ovwOBPkPSrRY5RA4zd2H3nHeqo+t4ZpLNs7zVul7Xw55Ws+SVTkWPCmKuk NEUw== 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=8R82c+oSIU+sp8WqnJE/Io3vjzLSVpjkS5kzwk9Q/Pk=; b=a3I4qcNXHy3M+FM9yyXRFIQehJkD0co/Pqo1NAmT/qrxu2h99m1KKhGrG1M/v9VP/I rcoDj2m8Dp1vLlxL3tMkb25OW//Rameepmf1XX03+gcK7hlg+Y5b2TOUGA2xxnVjMnpt 8OFYJnevVs/B43U90hN1YKeOBSmkYp0mHAydU55bORs5cqFn6VGGxiggPMp+OjCGLa8a M9JSUdHObu01bPk6cIpBVITz65LKHEOt3sLnk+EALbRROo6tbOEPQV7ZZH3NKtwgSaHM qad+Xn3hjuiRCoxnlqQ776aUWMqF1bHy78e9VuXqPJi26GungBomAC3Lk6F+DiHVjvOo +U9Q== X-Gm-Message-State: AOAM533upkRkLlQ/RRKrS7bDLlz7lgnSBQYIcQMlyLRmi/oOgowjcrRg NjKiUqg4th3WNMLALp6cEmXU1TfeLWqLiQ== X-Google-Smtp-Source: ABdhPJwBUoeLYNtlSkITxlkI2iu84t+XQGIx40SUbDg3AxeoJrM/36Vo+dIphPjUMDHFRdeHQKwlBQ== X-Received: by 2002:a5d:8ad5:: with SMTP id e21mr40066200iot.195.1636082413058; Thu, 04 Nov 2021 20:20:13 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:12 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 26/36] bsd-user/arm/target_arch_elf.h: arm get hwcap Date: Thu, 4 Nov 2021 21:19:07 -0600 Message-Id: <20211105031917.87837-27-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d30; envelope-from=imp@bsdimp.com; helo=mail-io1-xd30.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Implement get_elf_hwcap to get the first word of hardware capabilities. Signed-off-by: Kyle Evans Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_elf.h | 72 +++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/bsd-user/arm/target_arch_elf.h b/bsd-user/arm/target_arch_elf.h index 15b5c66511..02d25b8926 100644 --- a/bsd-user/arm/target_arch_elf.h +++ b/bsd-user/arm/target_arch_elf.h @@ -31,6 +31,76 @@ #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 -#define ELF_HWCAP 0 +#define ELF_HWCAP get_elf_hwcap() + +#define GET_FEATURE(feat, hwcap) \ + do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0) + +#define GET_FEATURE_ID(feat, hwcap) \ + do { if (cpu_isar_feature(feat, cpu)) { hwcaps |= hwcap; } } while (0) + +enum { + ARM_HWCAP_ARM_SWP = 1 << 0, + ARM_HWCAP_ARM_HALF = 1 << 1, + ARM_HWCAP_ARM_THUMB = 1 << 2, + ARM_HWCAP_ARM_26BIT = 1 << 3, + ARM_HWCAP_ARM_FAST_MULT = 1 << 4, + ARM_HWCAP_ARM_FPA = 1 << 5, + ARM_HWCAP_ARM_VFP = 1 << 6, + ARM_HWCAP_ARM_EDSP = 1 << 7, + ARM_HWCAP_ARM_JAVA = 1 << 8, + ARM_HWCAP_ARM_IWMMXT = 1 << 9, + ARM_HWCAP_ARM_CRUNCH = 1 << 10, + ARM_HWCAP_ARM_THUMBEE = 1 << 11, + ARM_HWCAP_ARM_NEON = 1 << 12, + ARM_HWCAP_ARM_VFPv3 = 1 << 13, + ARM_HWCAP_ARM_VFPv3D16 = 1 << 14, + ARM_HWCAP_ARM_TLS = 1 << 15, + ARM_HWCAP_ARM_VFPv4 = 1 << 16, + ARM_HWCAP_ARM_IDIVA = 1 << 17, + ARM_HWCAP_ARM_IDIVT = 1 << 18, + ARM_HWCAP_ARM_VFPD32 = 1 << 19, + ARM_HWCAP_ARM_LPAE = 1 << 20, + ARM_HWCAP_ARM_EVTSTRM = 1 << 21, +}; + +static uint32_t get_elf_hwcap(void) +{ + ARMCPU *cpu = ARM_CPU(thread_cpu); + uint32_t hwcaps = 0; + + hwcaps |= ARM_HWCAP_ARM_SWP; + hwcaps |= ARM_HWCAP_ARM_HALF; + hwcaps |= ARM_HWCAP_ARM_THUMB; + hwcaps |= ARM_HWCAP_ARM_FAST_MULT; + + /* probe for the extra features */ + /* EDSP is in v5TE and above */ + GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP); + GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT); + GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE); + GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON); + GET_FEATURE(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS); + GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE); + GET_FEATURE_ID(aa32_arm_div, ARM_HWCAP_ARM_IDIVA); + GET_FEATURE_ID(aa32_thumb_div, ARM_HWCAP_ARM_IDIVT); + GET_FEATURE_ID(aa32_vfp, ARM_HWCAP_ARM_VFP); + + if (cpu_isar_feature(aa32_fpsp_v3, cpu) || + cpu_isar_feature(aa32_fpdp_v3, cpu)) { + hwcaps |= ARM_HWCAP_ARM_VFPv3; + if (cpu_isar_feature(aa32_simd_r32, cpu)) { + hwcaps |= ARM_HWCAP_ARM_VFPD32; + } else { + hwcaps |= ARM_HWCAP_ARM_VFPv3D16; + } + } + GET_FEATURE_ID(aa32_simdfmac, ARM_HWCAP_ARM_VFPv4); + + return hwcaps; +} + +#undef GET_FEATURE +#undef GET_FEATURE_ID #endif /* _TARGET_ARCH_ELF_H_ */ From patchwork Fri Nov 5 03:19:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551206 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=NEEjkj/f; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmJh0nDWz9sf8 for ; Fri, 5 Nov 2021 14:31:48 +1100 (AEDT) Received: from localhost ([::1]:53190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mipxB-0007Mh-UK for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:31:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm6-0004j3-FK for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:18 -0400 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]:39890) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipm3-0004Cu-6P for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:18 -0400 Received: by mail-io1-xd2d.google.com with SMTP id r3so7829260iod.6 for ; Thu, 04 Nov 2021 20:20:14 -0700 (PDT) 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=I1XrwZ0o7hRgTEhkk9E1BQTq9616nNWJfCEFdNAWs4w=; b=NEEjkj/fIC5F3QLF/bGtQy0UfetDO/cLXBrFTHJ0pouW6+w1eWh6lXd1FJGY5TYknN 33UgkwxNasdIrKoiWQOswdqm2NMxDG64rEP9HNF1v/UEpTfEa1MCJo2knlCaXcA6GHOu mZduwBcl6JjhLlMquVBjHzRVxF53JqJXeXw5UkeruPJB0k6hIsrCWa1INbiDNqjYayAY f9zvt4JKEaT4+8myHRAc3+R1J8o2XYVhaaM+n5dF+MijkVLA8+ix6xXJlDKyb13rcDMZ l4EamWrFbLrhPOwP10guuWg1L2RaP8fb3W/G27EHrEzPBIfr8RMBmr5NM+A962QHLojz plwQ== 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=I1XrwZ0o7hRgTEhkk9E1BQTq9616nNWJfCEFdNAWs4w=; b=gxrQ0gFoKBYY7cc545hbXAVezVPtyL9Wi2BCcKB8Omrh9gP4uM17yNKs0KgR8VZJoT SGWGphnrzaVvOLVS/Iu3RBnFelO6VP5O4SSU9iaxtO3dI2K/B3KLOeO+HXiONrhVS+Jc 3n3tpu3Jnlx5F3YrUqeaYZ9dwJc98kSksdc74FTakouDYPf4qJDrSkCaopDMuCCx9Ef3 3l9J5nSQjWw7LxU2NSgF0yYzS/2CixMKDFCwvKXDPjyODpuxHPUL/a73aWZHPWUIxctD P7/t8+fY/miO4mJCJCz48Kk5oT/FovV1QD92UiFg7PW9iisDxl0DTGF3pKbJ2iUE8Doo Vsqw== X-Gm-Message-State: AOAM531Oia+sgRqv680FC1+gsCdJR8AmY0ZsVSw5SJ2dwFs24MNAUru0 l1oTGEGEoZQ9gfRhm/k5wLrtHEwOnnXcUg== X-Google-Smtp-Source: ABdhPJyrQe2uvqbevhuznz1rFbPVTY4f39BCpJ/fWlbJkUlZ9hujfgjnxOnRgqy7X1vAyhIAiEBeyQ== X-Received: by 2002:a05:6602:1550:: with SMTP id h16mr38280373iow.125.1636082414010; Thu, 04 Nov 2021 20:20:14 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:13 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 27/36] bsd-user/arm/target_arch_elf.h: arm get_hwcap2 impl Date: Thu, 4 Nov 2021 21:19:08 -0600 Message-Id: <20211105031917.87837-28-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2d; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Implement the extended HW capabilities for HWCAP2. Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_elf.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bsd-user/arm/target_arch_elf.h b/bsd-user/arm/target_arch_elf.h index 02d25b8926..4a0215d02e 100644 --- a/bsd-user/arm/target_arch_elf.h +++ b/bsd-user/arm/target_arch_elf.h @@ -32,6 +32,7 @@ #define ELF_EXEC_PAGESIZE 4096 #define ELF_HWCAP get_elf_hwcap() +#define ELF_HWCAP2 get_elf_hwcap2() #define GET_FEATURE(feat, hwcap) \ do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0) @@ -64,6 +65,14 @@ enum { ARM_HWCAP_ARM_EVTSTRM = 1 << 21, }; +enum { + ARM_HWCAP2_ARM_AES = 1 << 0, + ARM_HWCAP2_ARM_PMULL = 1 << 1, + ARM_HWCAP2_ARM_SHA1 = 1 << 2, + ARM_HWCAP2_ARM_SHA2 = 1 << 3, + ARM_HWCAP2_ARM_CRC32 = 1 << 4, +}; + static uint32_t get_elf_hwcap(void) { ARMCPU *cpu = ARM_CPU(thread_cpu); @@ -100,6 +109,19 @@ static uint32_t get_elf_hwcap(void) return hwcaps; } +static uint32_t get_elf_hwcap2(void) +{ + ARMCPU *cpu = ARM_CPU(thread_cpu); + uint32_t hwcaps = 0; + + GET_FEATURE_ID(aa32_aes, ARM_HWCAP2_ARM_AES); + GET_FEATURE_ID(aa32_pmull, ARM_HWCAP2_ARM_PMULL); + GET_FEATURE_ID(aa32_sha1, ARM_HWCAP2_ARM_SHA1); + GET_FEATURE_ID(aa32_sha2, ARM_HWCAP2_ARM_SHA2); + GET_FEATURE_ID(aa32_crc32, ARM_HWCAP2_ARM_CRC32); + return hwcaps; +} + #undef GET_FEATURE #undef GET_FEATURE_ID From patchwork Fri Nov 5 03:19:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551216 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=4+70WyCe; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmQx5ZT8z9sf8 for ; Fri, 5 Nov 2021 14:37:13 +1100 (AEDT) Received: from localhost ([::1]:33416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq2R-0004jj-Gy for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:37:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm7-0004mA-DP for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:19 -0400 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]:45714) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipm4-0004DY-HX for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:19 -0400 Received: by mail-io1-xd2a.google.com with SMTP id q203so9162436iod.12 for ; Thu, 04 Nov 2021 20:20:16 -0700 (PDT) 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=xELoQ9MP23ZY0icqqnGEqd1dDOY3xpL6nxhgED/dCUI=; b=4+70WyCeUe298IFuNjUCUTB6RGpMksuaazivOLytdluebtyjnefRBXQlFlXcBwHToI xWTF49hVkffSEzxMMZghqPHbKv9RriCnIokKNx0syK2hxzuQFrQOBaLD2EgZFt3IvRyB x41TLrIjfCTeNNuIetWoYEh9HkqwcSQ4v6Y/grRH/mqIfCaYc+UQljP3p6WMnb9B5oHj PPUpbuTL4nFfXx6u0tIhCae4Uv8o6JwEDd0gwpZqdeJMTSpPdx/5Wlz3UO9copIv2Cls WKeOD/369Z0vs9GAdPh0vZnojA6GHjDn5mq4VmZKplGbY+LcE28RPbpK4v3LcSejp9A4 LGZg== 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=xELoQ9MP23ZY0icqqnGEqd1dDOY3xpL6nxhgED/dCUI=; b=BtLpaHd6TLh7UlkLGvGvIXtDT7O/odhluAWWuc+/rvGR5eslctC1AU3/Kt+YvnGfi7 aSWzl18MnxAXWw/5G2VmJluaSiOyE2Ezmjs/E92vzW68AYOu/G6Tm3a8g1wPM3Smx16x BmG4L9J+WvpmMSPSQD7O63BvUwQXwIhyz0zLiysLncDx9/dnlDxuOcdRb5I8SvBqpWsZ jwkx0ItQ/6mMGTxKI4sIQzQn/hwHv+SuATSVdV9HvdJlX6eKy4JZDuyNjeUjlKb5s35l W55nPK7ab6n1F54yQWoVyu/TKR7vl7AYixL1rCO045a97Yu+5merFKS3LcfWpidkGCy6 l6vA== X-Gm-Message-State: AOAM530QlE7d+Ea4gH8ORKvty1WsNVmJ+tMByUfaQqjxkZtoaVmO3MSh 9eyd2aMC6G9pSU/o4B6NL6TkmhHgU38Vng== X-Google-Smtp-Source: ABdhPJzsL3yqZIFIEsMi3J6NXe28GnPJrDUNp3yIAO8pHpHfB2/ythOmmiKIL+TQ6DIqP/ZXLwssZQ== X-Received: by 2002:a5d:87d4:: with SMTP id q20mr32618516ios.190.1636082414906; Thu, 04 Nov 2021 20:20:14 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:14 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 28/36] bsd-user/arm/target_arch_signal.h: arm specific signal registers and stack Date: Thu, 4 Nov 2021 21:19:09 -0600 Message-Id: <20211105031917.87837-29-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2a; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Defines for registers and stack layout related to signals. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_signal.h | 57 +++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 bsd-user/arm/target_arch_signal.h diff --git a/bsd-user/arm/target_arch_signal.h b/bsd-user/arm/target_arch_signal.h new file mode 100644 index 0000000000..973183d99c --- /dev/null +++ b/bsd-user/arm/target_arch_signal.h @@ -0,0 +1,57 @@ +/* + * arm signal definitions + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +#ifndef _TARGET_ARCH_SIGNAL_H_ +#define _TARGET_ARCH_SIGNAL_H_ + +#include "cpu.h" + +#define TARGET_REG_R0 0 +#define TARGET_REG_R1 1 +#define TARGET_REG_R2 2 +#define TARGET_REG_R3 3 +#define TARGET_REG_R4 4 +#define TARGET_REG_R5 5 +#define TARGET_REG_R6 6 +#define TARGET_REG_R7 7 +#define TARGET_REG_R8 8 +#define TARGET_REG_R9 9 +#define TARGET_REG_R10 10 +#define TARGET_REG_R11 11 +#define TARGET_REG_R12 12 +#define TARGET_REG_R13 13 +#define TARGET_REG_R14 14 +#define TARGET_REG_R15 15 +#define TARGET_REG_CPSR 16 +#define TARGET__NGREG 17 +/* Convenience synonyms */ +#define TARGET_REG_FP TARGET_REG_R11 +#define TARGET_REG_SP TARGET_REG_R13 +#define TARGET_REG_LR TARGET_REG_R14 +#define TARGET_REG_PC TARGET_REG_R15 + +#define TARGET_INSN_SIZE 4 /* arm instruction size */ + +/* Size of the signal trampolin code. See _sigtramp(). */ +#define TARGET_SZSIGCODE ((abi_ulong)(9 * TARGET_INSN_SIZE)) + +/* compare to arm/include/_limits.h */ +#define TARGET_MINSIGSTKSZ (1024 * 4) /* min sig stack size */ +#define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768) /* recommended size */ + +#endif /* !_TARGET_ARCH_SIGNAL_H_ */ From patchwork Fri Nov 5 03:19:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551228 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=m6yPdNHE; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmgP23RGz9sf8 for ; Fri, 5 Nov 2021 14:47:59 +1100 (AEDT) Received: from localhost ([::1]:34062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqCq-0007gI-9A for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:47:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm7-0004lk-AO for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:19 -0400 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]:43771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipm5-0004E7-HL for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:18 -0400 Received: by mail-io1-xd29.google.com with SMTP id b203so5835887iof.10 for ; Thu, 04 Nov 2021 20:20:17 -0700 (PDT) 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=IR91cAUVFaEvVZgHdJNkNOwMysdIm06F6HU/985m8ck=; b=m6yPdNHEFYAOhK2Z27WmbyRsu/Uq0zUCvR9ilL3O1ma1j16qVHBc166wwDr0uu8Xwp oUet7ZxMAxOB4QVT9/UrMarPhjPaRsHbvz2BfOuEEca6rKwFJ1A0bNXZwrHEPZFlvhMk /yQfYl5yO1k/N17Yr3gXUxKo7actri22ZAzE3QpYLyEt+EEwnz9mlN30i8UAcjr9qwXJ XcbMDlJBzE608hsRC4A/opQaeL1ax1cVJCBmrDLL0bEQDJyW0yp3aLG5K/WYQVRX3sbt 9cf08b68Tx4h7DjaECKdonooNsRx3/oiHkRJIwPY1dUNZJOplE8BC9Ptqn+CDfFp5Gg2 n+Xw== 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=IR91cAUVFaEvVZgHdJNkNOwMysdIm06F6HU/985m8ck=; b=dpq+XUSXiMCz474iLShCbSyQhuPQrpASiHdpT7U98L5s3sqyoPxrHhcvOR+xZDKNcf o3yrwKNnjpisxG8JhPWCPzITcyaczcLQctQ/XBRCfTfVuFbrexREscyyo8oMACl4qvlQ ixq/caOKbPQkVDR+N4SlgECK7OFT2OgPAazJEd/tD3vJ0oGNBss6Chvxdzov/dvHnYmr x4GeHgGd6Pk/tlvRA4LkKISTGCHXUZTZ/1QFtxI3NnmrKjSwKFLBIMGt3CXjKys4sj2u 2wjkIrUYURWLoVtAthdgSpGtZEFYkJP1DPVpAwyRhKOiyZlNQbDSLmUOe5qCJBr6hWQm nBXw== X-Gm-Message-State: AOAM531NqJJm7VUqU1GiJgTPD+f+DsfOwEuSQzqXhirvMHrIaCZRppgy FmI3dcSqVceXyDbE3/zOrZXfrVlhI/AqJQ== X-Google-Smtp-Source: ABdhPJxcEyrc90Zi3Kcu4+ws5pXb0tEgvloZB1opdjl7CebC11uX8tLQpzduBAhldTFwwb2vi8dtgg== X-Received: by 2002:a6b:4f15:: with SMTP id d21mr4991298iob.188.1636082416280; Thu, 04 Nov 2021 20:20:16 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:15 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 29/36] bsd-user/arm/target_arch_signal.h: arm machine context and trapframe for signals Date: Thu, 4 Nov 2021 21:19:10 -0600 Message-Id: <20211105031917.87837-30-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d29; envelope-from=imp@bsdimp.com; helo=mail-io1-xd29.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_signal.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bsd-user/arm/target_arch_signal.h b/bsd-user/arm/target_arch_signal.h index 973183d99c..9527335cc9 100644 --- a/bsd-user/arm/target_arch_signal.h +++ b/bsd-user/arm/target_arch_signal.h @@ -54,4 +54,32 @@ #define TARGET_MINSIGSTKSZ (1024 * 4) /* min sig stack size */ #define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768) /* recommended size */ +/* + * Floating point register state + */ +typedef struct target_mcontext_vfp { + abi_ullong mcv_reg[32]; + abi_ulong mcv_fpscr; +} target_mcontext_vfp_t; + +typedef struct target_mcontext { + abi_uint __gregs[TARGET__NGREG]; + + /* + * Originally, rest of this structure was named __fpu, 35 * 4 bytes + * long, never accessed from kernel. + */ + abi_ulong mc_vfp_size; + abi_ptr mc_vfp_ptr; + abi_int mc_spare[33]; +} target_mcontext_t; + +#include "target_os_ucontext.h" + +struct target_sigframe { + target_siginfo_t sf_si; /* saved siginfo */ + target_ucontext_t sf_uc; /* saved ucontext */ + target_mcontext_vfp_t sf_vfp; /* actual saved VFP context */ +}; + #endif /* !_TARGET_ARCH_SIGNAL_H_ */ From patchwork Fri Nov 5 03:19:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551225 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=UB0EeSrt; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmZz696pz9sf8 for ; Fri, 5 Nov 2021 14:44:11 +1100 (AEDT) Received: from localhost ([::1]:51308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq9B-0000EA-Kd for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:44:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipm8-0004py-R0 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:20 -0400 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]:43578) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipm6-0004En-Vn for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:20 -0400 Received: by mail-il1-x134.google.com with SMTP id s14so8246148ilv.10 for ; Thu, 04 Nov 2021 20:20:18 -0700 (PDT) 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=yoeAnz3VyRcRL1RlLNODqzA0JM0MBxuW327s+9LBmds=; b=UB0EeSrt4oZV63t/p4qS26PjIoi9MqTlpjjW7ihGyeeNDqpHFSmj2luxikMUsI9CfO e+B1WmNNaogVyV3iC7zrx4l6rjtHKH8N+GJ572Qd81ZFSEeoL76A3thEHUnUm21W44dd Asu4DNm+gKEOxZWrAPc7nzz0Ow7YAgfZ427ON5BjDEZVdDI5RwS4zx8/bpuXIeXv2WhV Sf0yltSRBBS80eoMhyFkYclNXAspsiP8mDkqc1SYcH34G7SnbNR3b/df/bl8jZoJ1s+8 8awHK0vpeOWIBKRbMZts228IJ/2N/9ig0gFxNZNfnPuII/qxj9JNtFP354qhXrM5Wb2E jn5g== 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=yoeAnz3VyRcRL1RlLNODqzA0JM0MBxuW327s+9LBmds=; b=glnjg6Phk8/t9Xm4PT4kR6kbcfwsjqUOWDO0NtFnnCBCb4r2wVtenoYiyLMXLbDCxN sD+vG3TuZTg41tSwYHxEjl05OOyoK3ruq/cbocWIPXMKzt6N/4EawpLTlLLfpYNzyOlz oIXkfj/mDhhOYWUAlkIH4+rM1QmI/J5goHoIjJEOdaDwUlVgwoG4hJUcmvid1GtUtkT2 p3krrDX5KNUOMoHYs5SwGTvaHYm/RATO5VQcskYNfaXrUgRbt4BLNFCEr+lwH9TgjgD8 sTC4+GOjqWGSdNSJmafOcX1bT/boz5IewYLqMrlUKDzDa43SNCi2zdIPY7xF2FK7d8kT S/Vw== X-Gm-Message-State: AOAM533zIMgaKt0NkSqTcodHtlJmBkpBHwqUPJw8GeO7UzR8xVpZirBx m1B5ZgMpR1Sgl7reM1qAU12hQv/DgUlItw== X-Google-Smtp-Source: ABdhPJyOVYS3x7Eputq2oVMVlk4uWPWklj+/s5YUtVlJVe3imYpq8GrmEGlSnrfWtAEHP57vmI7SqQ== X-Received: by 2002:a92:ca07:: with SMTP id j7mr31032795ils.69.1636082417623; Thu, 04 Nov 2021 20:20:17 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:17 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 30/36] bsd-user/arm/target_arch_signal.h: Define size of *context_t Date: Thu, 4 Nov 2021 21:19:11 -0600 Message-Id: <20211105031917.87837-31-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Define the native sizes of mcontext_t and ucontext_t so that the tests in target_os_ucontext.h ensure the size of arm's version of these structures is correct. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_signal.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bsd-user/arm/target_arch_signal.h b/bsd-user/arm/target_arch_signal.h index 9527335cc9..f1844dbf22 100644 --- a/bsd-user/arm/target_arch_signal.h +++ b/bsd-user/arm/target_arch_signal.h @@ -74,6 +74,9 @@ typedef struct target_mcontext { abi_int mc_spare[33]; } target_mcontext_t; +#define TARGET_MCONTEXT_SIZE 208 +#define TARGET_UCONTEXT_SIZE 260 + #include "target_os_ucontext.h" struct target_sigframe { From patchwork Fri Nov 5 03:19:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551240 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=EClI2ibu; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hln2S4F3lz9sfG for ; Fri, 5 Nov 2021 15:04:32 +1100 (AEDT) Received: from localhost ([::1]:41280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqSs-0007XA-3T for incoming@patchwork.ozlabs.org; Fri, 05 Nov 2021 00:04:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipmA-0004u7-0a for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:22 -0400 Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]:45772) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipm8-0004FS-3W for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:21 -0400 Received: by mail-il1-x12e.google.com with SMTP id i12so8228475ila.12 for ; Thu, 04 Nov 2021 20:20:19 -0700 (PDT) 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=d3aDuQc168bTErAstWZqiEF/2xZcEqXziJxXaVtJ/MI=; b=EClI2ibuBVDGCzc8ryOoMsNHWVWIPJmvzUJGLqnw0n5bWH5h0yPjFVZ1y/dOZi4oxO IjPPfwgfahypFLxBjyxMf6X2bgO4nUa7D0NMr47wDeAzdJ72b9cOP73+TAESiDMGycvo UjZgiGjiqNjMA/6YEzcHZ43kr9lgAMcA0RhloekhMY7rTCkfdE1kTIy3ERDlbcm0q9Q0 a7EWqiA/jkNcYgUzcIBZbUTK/gFSnSOaOf5kszh5b4Tmnfaxr0DoKZAddhT8DzJc9dv6 Z3Zg3xltyPGF0JN2lw4clhc9lboCucV0lGt5N9cOSR0tCOcS4I4C4cS8f0gs9GGYs0a/ bV3w== 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=d3aDuQc168bTErAstWZqiEF/2xZcEqXziJxXaVtJ/MI=; b=TL/kF/NaALgkTlbP0YvliVDx7tqn26kO+czMZGGzpxqKE6+XWF8tlgRwVgwlTwHhjs 7OXZxv6A6Ca6O7Ut9rKFKkhKWY4rhu0P9F4MJQqYkQjlQimnGrfcUWRjDQKs5o63cb4C tmUl7ePuch/OFxRvinYFRYfYqFU7RyNLPv4Rz/AYK2DWiF6wmhcJ2yFZmt/SUT/DDrVi o8kEdRSbgbuKUHc+FEVToOk8xFQHJ7wwhBXDBeNv9IxZZum5CAIcq4lw3VIdg/iLrYxQ Z9XGApjwLT+md2ALmggPQbRoGhtfwrP3fxwTlG8IErhjbsGfjZymsBHutn2XIXSfEDFI z5wg== X-Gm-Message-State: AOAM5304gV2Va5mA0/e3IHhA18NYsvPu6ettazzWif+W2URKzrL+JnD+ 8EK29jwo8BTKlrMSYMo+MOWryXmTwNtnSg== X-Google-Smtp-Source: ABdhPJxET9OEMAu0qEX4XIrzEX/h2aGF5vyQke1n1DFhNgpQKKLGIL47/aoi4pC0cUYVNwTfgv/R0g== X-Received: by 2002:a05:6e02:19c8:: with SMTP id r8mr8568510ill.47.1636082418753; Thu, 04 Nov 2021 20:20:18 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:18 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 31/36] bsd-user/arm/target_arch_signal.c: arm set_sigtramp_args Date: Thu, 4 Nov 2021 21:19:12 -0600 Message-Id: <20211105031917.87837-32-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12e; envelope-from=imp@bsdimp.com; helo=mail-il1-x12e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Implement set_sigtramp_args to setup the arguments to the sigtramp calls. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/arm/signal.c | 60 +++++++++++++++++++++++++++++++ bsd-user/arm/target_arch_signal.h | 5 +++ 2 files changed, 65 insertions(+) create mode 100644 bsd-user/arm/signal.c diff --git a/bsd-user/arm/signal.c b/bsd-user/arm/signal.c new file mode 100644 index 0000000000..3c0db30a85 --- /dev/null +++ b/bsd-user/arm/signal.c @@ -0,0 +1,60 @@ +/* + * arm signal functions + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "qemu.h" + +/* + * Compare to arm/arm/machdep.c sendsig() + * Assumes that target stack frame memory is locked. + */ +abi_long set_sigtramp_args(CPUARMState *env, int sig, + struct target_sigframe *frame, + abi_ulong frame_addr, + struct target_sigaction *ka) +{ + /* + * Arguments to signal handler: + * r0 = signal number + * r1 = siginfo pointer + * r2 = ucontext pointer + * r5 = ucontext pointer + * pc = signal handler pointer + * sp = sigframe struct pointer + * lr = sigtramp at base of user stack + */ + + env->regs[0] = sig; + env->regs[1] = frame_addr + + offsetof(struct target_sigframe, sf_si); + env->regs[2] = frame_addr + + offsetof(struct target_sigframe, sf_uc); + + /* the trampoline uses r5 as the uc address */ + env->regs[5] = frame_addr + + offsetof(struct target_sigframe, sf_uc); + env->regs[TARGET_REG_PC] = ka->_sa_handler & ~1; + env->regs[TARGET_REG_SP] = frame_addr; + env->regs[TARGET_REG_LR] = TARGET_PS_STRINGS - TARGET_SZSIGCODE; + /* + * Low bit indicates whether or not we're entering thumb mode. + */ + cpsr_write(env, (ka->_sa_handler & 1) * CPSR_T, CPSR_T, CPSRWriteByInstr); + + return 0; +} diff --git a/bsd-user/arm/target_arch_signal.h b/bsd-user/arm/target_arch_signal.h index f1844dbf22..8286aa5d6e 100644 --- a/bsd-user/arm/target_arch_signal.h +++ b/bsd-user/arm/target_arch_signal.h @@ -85,4 +85,9 @@ struct target_sigframe { target_mcontext_vfp_t sf_vfp; /* actual saved VFP context */ }; +abi_long set_sigtramp_args(CPUARMState *regs, int sig, + struct target_sigframe *frame, + abi_ulong frame_addr, + struct target_sigaction *ka); + #endif /* !_TARGET_ARCH_SIGNAL_H_ */ From patchwork Fri Nov 5 03:19:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551229 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=wQu+O1l8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hlmhk2TD6z9sf8 for ; Fri, 5 Nov 2021 14:49:10 +1100 (AEDT) Received: from localhost ([::1]:36736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqE0-0001BV-3D for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:49:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipmA-0004wp-V3 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:22 -0400 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]:33780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipm9-0004G6-7e for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:22 -0400 Received: by mail-io1-xd2a.google.com with SMTP id z206so9371573iof.0 for ; Thu, 04 Nov 2021 20:20:20 -0700 (PDT) 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=NxuDAF8jAoUwFWtiVKiLjCxUV4oGpS2eNcZyh+rNyYo=; b=wQu+O1l8NZDXq6FwVCEAeRqtrmLa6RAMWccuNggDsJav6tclXCXSykjgK4atQrpy8U KVRrkrONGxxuMEERJZKJCbQ8e9pNTfT6iGyAmJcyGjvUcQtTyF1iQyxwgVqWoIo+vc8L GbxCA/N13UZXZqc2ShdL6biJ9jGT5geUiP/KNNtWCMuHYt2K0GDZay7Qi8PXoTxOqChN nHAN75yWVkj7gXswngOp0GsCAY1cz+PBoV9QTXMojZ43w5gH767zKv8vldB52Fq4+cOC 02Ay0gslbG6cN2wtltqDKilq0UpSB9ls5lx193/2y2xK7f32bK7KeFsEMXgZjhXEu5bj Cizw== 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=NxuDAF8jAoUwFWtiVKiLjCxUV4oGpS2eNcZyh+rNyYo=; b=aa9cgVei9oFCvFFgh5lpiLXPpiXvizDnFUdKhx5WKpS+CDoFIvgryzuGLsY15lMKcc n+ZVAZB6fkrDCx8BCDJUsRLO2eTzaI2IvzsMi6FeQ8PiRZ8/liaudiEtQWnO5aejtz3G ymoBEHpzaog89OlMbRRJfaTEonX9hmZhnf+mKa0Qnqrd50v4BPbxZeb2w2kEfS2Gdsb5 RK9p4PYZx/MRKhqcCY3KqeecA/saeCyEJRb1SeOiB0CdnVQ0iwsMq8grT5nV3D3xoifb vqEsRg5uK9xGuseJWHtji2dZ38SByoksQj5gD81l/qEgxzQFaV+Tll07lNidOmBW5Vqo JS+w== X-Gm-Message-State: AOAM531DGyB+0ckVwQEUSx5sAY6PzKheGWOze2K2tHV1d/Xt0UxOWYt6 SGQPtditWBTAZOCTyjTrCIr9+pg1YItgbg== X-Google-Smtp-Source: ABdhPJx5zmOTncRFsE40th0YO68ACIy6K1m/u4WZRa6s4KWymxLN1QGaAcsLz4b/+JMqTqKH74C+GQ== X-Received: by 2002:a05:6602:2ccf:: with SMTP id j15mr25770582iow.77.1636082419897; Thu, 04 Nov 2021 20:20:19 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:19 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 32/36] bsd-user/arm/target_arch_signal.c: arm get_mcontext Date: Thu, 4 Nov 2021 21:19:13 -0600 Message-Id: <20211105031917.87837-33-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2a; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Get the machine context from the CPU state. Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/arm/signal.c | 51 +++++++++++++++++++++++++++++++ bsd-user/arm/target_arch_signal.h | 1 + 2 files changed, 52 insertions(+) diff --git a/bsd-user/arm/signal.c b/bsd-user/arm/signal.c index 3c0db30a85..93c9bfc0d3 100644 --- a/bsd-user/arm/signal.c +++ b/bsd-user/arm/signal.c @@ -58,3 +58,54 @@ abi_long set_sigtramp_args(CPUARMState *env, int sig, return 0; } + +/* + * Compare to arm/arm/machdep.c get_mcontext() + * Assumes that the memory is locked if mcp points to user memory. + */ +abi_long get_mcontext(CPUARMState *env, target_mcontext_t *mcp, int flags) +{ + int err = 0; + uint32_t *gr = mcp->__gregs; + + if (mcp->mc_vfp_size != 0 && mcp->mc_vfp_size != sizeof(target_mcontext_vfp_t)) { + return -TARGET_EINVAL; + } + + gr[TARGET_REG_CPSR] = tswap32(cpsr_read(env)); + if (flags & TARGET_MC_GET_CLEAR_RET) { + gr[TARGET_REG_R0] = 0; + gr[TARGET_REG_CPSR] &= ~CPSR_C; + } else { + gr[TARGET_REG_R0] = tswap32(env->regs[0]); + } + + gr[TARGET_REG_R1] = tswap32(env->regs[1]); + gr[TARGET_REG_R2] = tswap32(env->regs[2]); + gr[TARGET_REG_R3] = tswap32(env->regs[3]); + gr[TARGET_REG_R4] = tswap32(env->regs[4]); + gr[TARGET_REG_R5] = tswap32(env->regs[5]); + gr[TARGET_REG_R6] = tswap32(env->regs[6]); + gr[TARGET_REG_R7] = tswap32(env->regs[7]); + gr[TARGET_REG_R8] = tswap32(env->regs[8]); + gr[TARGET_REG_R9] = tswap32(env->regs[9]); + gr[TARGET_REG_R10] = tswap32(env->regs[10]); + gr[TARGET_REG_R11] = tswap32(env->regs[11]); + gr[TARGET_REG_R12] = tswap32(env->regs[12]); + + gr[TARGET_REG_SP] = tswap32(env->regs[13]); + gr[TARGET_REG_LR] = tswap32(env->regs[14]); + gr[TARGET_REG_PC] = tswap32(env->regs[15]); + + if (mcp->mc_vfp_size != 0 && mcp->mc_vfp_ptr != 0) { + /* see get_vfpcontext in sys/arm/arm/exec_machdep.c */ + target_mcontext_vfp_t *vfp; + vfp = lock_user(VERIFY_WRITE, mcp->mc_vfp_ptr, sizeof(*vfp), 0); + for (int i = 0; i < 32; i++) { + vfp->mcv_reg[i] = tswap64(*aa32_vfp_dreg(env, i)); + } + vfp->mcv_fpscr = tswap32(vfp_get_fpscr(env)); + unlock_user(vfp, mcp->mc_vfp_ptr, sizeof(*vfp)); + } + return err; +} diff --git a/bsd-user/arm/target_arch_signal.h b/bsd-user/arm/target_arch_signal.h index 8286aa5d6e..429843c70f 100644 --- a/bsd-user/arm/target_arch_signal.h +++ b/bsd-user/arm/target_arch_signal.h @@ -89,5 +89,6 @@ abi_long set_sigtramp_args(CPUARMState *regs, int sig, struct target_sigframe *frame, abi_ulong frame_addr, struct target_sigaction *ka); +abi_long get_mcontext(CPUARMState *regs, target_mcontext_t *mcp, int flags); #endif /* !_TARGET_ARCH_SIGNAL_H_ */ From patchwork Fri Nov 5 03:19:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551243 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=IRUwAkz8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hln780jfrz9sfG for ; Fri, 5 Nov 2021 15:08:35 +1100 (AEDT) Received: from localhost ([::1]:48392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqWl-00042w-HC for incoming@patchwork.ozlabs.org; Fri, 05 Nov 2021 00:08:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipmC-00050b-9J for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:24 -0400 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]:38860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipmA-0004GT-GT for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:23 -0400 Received: by mail-io1-xd32.google.com with SMTP id v65so9302201ioe.5 for ; Thu, 04 Nov 2021 20:20:22 -0700 (PDT) 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=58nY3Z2yBhPr75+AsIyykvpCnSBFtHFIGJuFPLu1qik=; b=IRUwAkz8klEw4Dvxx4a5QN1oakAKkBfW3D5SJ/tLjJFJa/JCJwQEou1gSb03PbTJtV sFuce7WwCSgQH/JV3d4bbrssLbRPEuI92XZdCAddF9rlZUVhdDwuRrQCDbfRzhf5l34a EY8fB7E0VCVqlaAToBVF4LhClMAccmZN5V7L3roQGogVEI6DLCTCdap9WmonQ80x+tiz ApN/u7otLXFngvouZAPkZvSjkHLDi/VIL+BxttRcsnOjjWhVuN4I2IBseKypAjO2cmW9 pMCFAHoQMwDQZJJU+Qlv8CEJVafQSLSL49XSNQUjvmUve7ucQG6ZH4gLWYTu50/qqqCY LlQw== 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=58nY3Z2yBhPr75+AsIyykvpCnSBFtHFIGJuFPLu1qik=; b=YHW2JYIcX8k4GsdWkcsvIJ/g+bWH+vKlpPiRpO3qunDvreYpxF/IvmqjJtSrM+uI0g YAnudoLmZwvQZI0umbAU3p4HGWc574qAZU7YYdauGddIDFClSq739q25E1L1jp1fPFUF EaE6Fz+0VF4uwI0Lq123tIRwxM9Uim20coGgIqQIPbNGLOxPQx6PM3X7LMubmBezovWX Wn5tRjIb1SUgonGL0CQJe+gDpGjlQ1zyOHAPbF7HzCjgy2Kf6aN4HTw4pFz5UjceF6QE pSi9SPfX0J6xiQUz7LXpvlXvuapqIb0V6KqKNHvAwo5yFVInu0DPpCXCpOUA4x34xR9m 6gGg== X-Gm-Message-State: AOAM533NgxSgf0pAx+Tf2ftwLy+GYmCPcuM06KebMmhQsdAqhrJlluf9 j+hbFQUv0w02f6Ri7c+R5/iIVfEAvKBCig== X-Google-Smtp-Source: ABdhPJyHNa3HfRhESco+5r3ltk+fu0c6fkHJqwj8xpE/G3rnDkbn97GJ6kgsuv2RucGPzCI1ATrvoQ== X-Received: by 2002:a05:6638:1242:: with SMTP id o2mr6964239jas.68.1636082420902; Thu, 04 Nov 2021 20:20:20 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:20 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 33/36] bsd-user/arm/target_arch_signal.c: arm set_mcontext Date: Thu, 4 Nov 2021 21:19:14 -0600 Message-Id: <20211105031917.87837-34-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d32; envelope-from=imp@bsdimp.com; helo=mail-io1-xd32.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the machine context to the CPU state. Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed-off-by: Warner Losh --- bsd-user/arm/signal.c | 79 +++++++++++++++++++++++++++++++ bsd-user/arm/target_arch_signal.h | 1 + 2 files changed, 80 insertions(+) diff --git a/bsd-user/arm/signal.c b/bsd-user/arm/signal.c index 93c9bfc0d3..d32e3b4560 100644 --- a/bsd-user/arm/signal.c +++ b/bsd-user/arm/signal.c @@ -109,3 +109,82 @@ abi_long get_mcontext(CPUARMState *env, target_mcontext_t *mcp, int flags) } return err; } + +/* Compare to arm/arm/exec_machdep.c set_mcontext() */ +abi_long set_mcontext(CPUARMState *env, target_mcontext_t *mcp, int srflag) +{ + int err = 0; + const uint32_t *gr = mcp->__gregs; + uint32_t cpsr, ccpsr = cpsr_read(env); + uint32_t fpscr, mask; + + cpsr = tswap32(gr[TARGET_REG_CPSR]); + /* + * Only allow certain bits to change, reject attempted changes to non-user + * bits. In addition, make sure we're headed for user mode and none of the + * interrupt bits are set. + */ + if ((ccpsr & ~CPSR_USER) != (cpsr & ~CPSR_USER)) { + return -TARGET_EINVAL; + } + if ((cpsr & CPSR_M) != ARM_CPU_MODE_USR || + (cpsr & (CPSR_I | CPSR_F)) != 0) { + return -TARGET_EINVAL; + } + mask = cpsr & CPSR_T ? 0x1 : 0x3; + + /* + * Make sure that we either have no vfp, or it's the correct size. + * FreeBSD just ignores it, though, so maybe we'll need to adjust + * things below instead. + */ + if (mcp->mc_vfp_size != 0 && mcp->mc_vfp_size != sizeof(target_mcontext_vfp_t)) { + return -TARGET_EINVAL; + } + /* + * Make sure T mode matches the PC's notion of thumb mode, although + * FreeBSD lets the processor sort this out, so we may need remove + * this check, or generate a signal... + */ + if (!!(tswap32(gr[TARGET_REG_PC]) & 1) != !!(cpsr & CPSR_T)) { + return -TARGET_EINVAL; + } + + env->regs[0] = tswap32(gr[TARGET_REG_R0]); + env->regs[1] = tswap32(gr[TARGET_REG_R1]); + env->regs[2] = tswap32(gr[TARGET_REG_R2]); + env->regs[3] = tswap32(gr[TARGET_REG_R3]); + env->regs[4] = tswap32(gr[TARGET_REG_R4]); + env->regs[5] = tswap32(gr[TARGET_REG_R5]); + env->regs[6] = tswap32(gr[TARGET_REG_R6]); + env->regs[7] = tswap32(gr[TARGET_REG_R7]); + env->regs[8] = tswap32(gr[TARGET_REG_R8]); + env->regs[9] = tswap32(gr[TARGET_REG_R9]); + env->regs[10] = tswap32(gr[TARGET_REG_R10]); + env->regs[11] = tswap32(gr[TARGET_REG_R11]); + env->regs[12] = tswap32(gr[TARGET_REG_R12]); + + env->regs[13] = tswap32(gr[TARGET_REG_SP]); + env->regs[14] = tswap32(gr[TARGET_REG_LR]); + env->regs[15] = tswap32(gr[TARGET_REG_PC] & mask); + if (mcp->mc_vfp_size != 0 && mcp->mc_vfp_ptr != 0) { + /* see set_vfpcontext in sys/arm/arm/exec_machdep.c */ + target_mcontext_vfp_t *vfp; + + vfp = lock_user(VERIFY_READ, mcp->mc_vfp_ptr, sizeof(*vfp), 1); + for (int i = 0; i < 32; i++) { + __get_user(*aa32_vfp_dreg(env, i), &vfp->mcv_reg[i]); + } + __get_user(fpscr, &vfp->mcv_fpscr); + vfp_set_fpscr(env, fpscr); + unlock_user(vfp, mcp->mc_vfp_ptr, sizeof(target_ucontext_t)); + + /* + * linux-user sets fpexc, fpinst and fpinst2, but these aren't in + * FreeBSD's mcontext, what to do? + */ + } + cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr); + + return err; +} diff --git a/bsd-user/arm/target_arch_signal.h b/bsd-user/arm/target_arch_signal.h index 429843c70f..83ecfaafef 100644 --- a/bsd-user/arm/target_arch_signal.h +++ b/bsd-user/arm/target_arch_signal.h @@ -90,5 +90,6 @@ abi_long set_sigtramp_args(CPUARMState *regs, int sig, abi_ulong frame_addr, struct target_sigaction *ka); abi_long get_mcontext(CPUARMState *regs, target_mcontext_t *mcp, int flags); +abi_long set_mcontext(CPUARMState *regs, target_mcontext_t *mcp, int srflag); #endif /* !_TARGET_ARCH_SIGNAL_H_ */ From patchwork Fri Nov 5 03:19:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551220 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=3y+IE4TO; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlmTg1QGzz9sf8 for ; Fri, 5 Nov 2021 14:39:35 +1100 (AEDT) Received: from localhost ([::1]:42078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miq4i-0002AC-Rg for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:39:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipmC-000547-V3 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:24 -0400 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]:46866) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipmB-0004Gw-ES for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:24 -0400 Received: by mail-il1-x12a.google.com with SMTP id w10so8226701ilc.13 for ; Thu, 04 Nov 2021 20:20:23 -0700 (PDT) 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=ZMgOxsjywTPo5T1ggnwREDuM1RtRZU+bSRes/2xG2MQ=; b=3y+IE4TOuz1KfEUs0jSJrledmYnS2yVUWhJ6472jQ0m0tp1qEh9LuiS+EQC0cBBYtl OxtC0DitJFh+3BBiNWub7B4eZPiyWvfgiTMf6DTpk077ZA+UvAJa92dqYzAsWoFbbsHY igXiwZHcn6fBwr6wtiD2fXxGCOhgGFTL9Q68lggy4rMugecL6VcRRhB7oUlDWGvR3mbR pZtE74i6/6LJxGVI1ywYZi6Cm2gAfvv/wa6YITu3l+d3gKGirWmzp567+Wh12Nd2C4iJ q7A9JEXGa8krSkL5ASGwjofqhZcHG9Y6vFYVfIe0WwuU01aQIsfEcbRvP1p+tWbNi08j j+Gw== 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=ZMgOxsjywTPo5T1ggnwREDuM1RtRZU+bSRes/2xG2MQ=; b=rgsFtCziZ4JO/Ki3YS9BmyrQIVZ5fB27nrjxVRsSMZG/w44oVlK9KfKejU2jVrfqKE aTcqyarxcJrmd5uVkutvfmDuEHOqRgS/y7yvwtutiwSlp41dMsi8OYqQcFUkgGHJ4723 096AsHvjdjQkpihHcG7o5FWZ0HLpUV836mJEWvl5UMwOpGk22kPQISZnFnnUyFiQkXrP SJZWD8qejCla0pAGxxaksOjQDqwkVGl4cbkI8JpLQ43wjEqXK3wIXG6RqsXba+CazFhe uTHIDakuzhJZfN71FGnW+UwEsL055YBaIEqYnghCKW1q1N81xUuUWy8vktfLFpc/VEjw Ck1g== X-Gm-Message-State: AOAM531IPLtUCTBjScrFRYBoG6S60WmiQmaP+IfL1lCI90QYd1ha+uHJ gO/c2EnAz9nauhZPrHy61M/k7GLdIiCb7Q== X-Google-Smtp-Source: ABdhPJzfhOe3vO8HAy4JrnUHGqPoqgxThJgg91196lu8b4X4/y/AGylrCUmuLA/6/WGjSPaxHRe+MQ== X-Received: by 2002:a92:cd84:: with SMTP id r4mr25038479ilb.137.1636082421660; Thu, 04 Nov 2021 20:20:21 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:21 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 34/36] bsd-user/arm/target_arch_signal.c: arm get_ucontext_sigreturn Date: Thu, 4 Nov 2021 21:19:15 -0600 Message-Id: <20211105031917.87837-35-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12a; envelope-from=imp@bsdimp.com; helo=mail-il1-x12a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: Stacey Son , qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Update ucontext to implement sigreturn. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/arm/signal.c | 9 +++++++++ bsd-user/arm/target_arch_signal.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/bsd-user/arm/signal.c b/bsd-user/arm/signal.c index d32e3b4560..344ce69cea 100644 --- a/bsd-user/arm/signal.c +++ b/bsd-user/arm/signal.c @@ -188,3 +188,12 @@ abi_long set_mcontext(CPUARMState *env, target_mcontext_t *mcp, int srflag) return err; } + +/* Compare to arm/arm/machdep.c sys_sigreturn() */ +abi_long get_ucontext_sigreturn(CPUARMState *env, abi_ulong target_sf, + abi_ulong *target_uc) +{ + *target_uc = target_sf; + + return 0; +} diff --git a/bsd-user/arm/target_arch_signal.h b/bsd-user/arm/target_arch_signal.h index 83ecfaafef..5a4a9d5345 100644 --- a/bsd-user/arm/target_arch_signal.h +++ b/bsd-user/arm/target_arch_signal.h @@ -91,5 +91,7 @@ abi_long set_sigtramp_args(CPUARMState *regs, int sig, struct target_sigaction *ka); abi_long get_mcontext(CPUARMState *regs, target_mcontext_t *mcp, int flags); abi_long set_mcontext(CPUARMState *regs, target_mcontext_t *mcp, int srflag); +abi_long get_ucontext_sigreturn(CPUARMState *regs, abi_ulong target_sf, + abi_ulong *target_uc); #endif /* !_TARGET_ARCH_SIGNAL_H_ */ From patchwork Fri Nov 5 03:19:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551231 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=IODnI5ys; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hlmkr25wMz9sf8 for ; Fri, 5 Nov 2021 14:51:00 +1100 (AEDT) Received: from localhost ([::1]:44526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqFk-0006hK-Iv for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2021 23:50:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipmD-00057Z-Q8 for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:25 -0400 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]:43784) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipmC-0004Hf-1D for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:25 -0400 Received: by mail-io1-xd36.google.com with SMTP id b203so5836085iof.10 for ; Thu, 04 Nov 2021 20:20:23 -0700 (PDT) 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=oGGtdxP6C7IR5B/d8MtcD0XVsN4clM86GpBWW0b3ip4=; b=IODnI5ysjViDz+oiVQeSswIn9JrCWONFbSi456soCQJPsf9+4DtVbIfcflnhFj/53P 9o++fPvRll1aox1I7lwoy6wd6eq8jjcBB1dnRSIVnzdGq83FUsWdu7lxahYQQFmW20gE gOT5IyI4exKG7hMgZQoTqmOn9iTQIqdzUvfd5FewshKs0RwL7m9iwmeB2cyVAn+wSpaq LqSX9fw9FWwThCj0yyerDnwTAi5Oqhpr9YPRCwwRO3xpmyHGmwQWGWmFAHyMpZ3h4od7 GlOF+z4x+tZGyyqec45TqTJ3udu/a0OrmBGYQzH4zFv+iX+4iDlWaNuVDhvhtfi/z73r 4zHg== 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=oGGtdxP6C7IR5B/d8MtcD0XVsN4clM86GpBWW0b3ip4=; b=6h16ak9BDqCQjkdS3L/bxQSoLt2tGGO/l5dKvljhKkl2pPrqlMyHGL5/I5knN2p3uL cmSZ+je5Kr0941EUG9+Cy3PvpFgdhYiALMJQgvMAwGVi8H1yQRC5wQeU33QZiTSOg6qO bKy05YuwCKR562ioi1JJ98qIswrRuN/K1LIN4yDmer11yym9kPwjCvxXLiGuAQTFXCaq SYzx91eUBCcg9QD2lji/KgSlKJTo6bDhR2+DgU948D9CtpMB4Qi7z/mBYcsXNsCmgCfW 2uVr61Tdt3vJCaV9BnszBtQcRFwCvnhODNwHNK8Vr5iIiiEpPLZJsLvfx4m/flvoLles XeHw== X-Gm-Message-State: AOAM532mAW+NqfX/0tTRckBrNZBt/aO4000SCnE22skZZmHre9bToaEb 4VqSF2YOxxrhv4lz7nw51DpZ4uElMp7eRQ== X-Google-Smtp-Source: ABdhPJwT+u3jnAGK0lr5m/Oh9JX9OMLtgV014styqiUV1x+jxbb1ImVHcTNI28uSZwBHQU1hVzhu7w== X-Received: by 2002:a05:6638:dcc:: with SMTP id m12mr6956941jaj.143.1636082422536; Thu, 04 Nov 2021 20:20:22 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:22 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 35/36] bsd-user/freebsd/target_os_ucontext.h: Require TARGET_*CONTEXT_SIZE Date: Thu, 4 Nov 2021 21:19:16 -0600 Message-Id: <20211105031917.87837-36-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d36; envelope-from=imp@bsdimp.com; helo=mail-io1-xd36.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Now that all architecutres define TARGET_[MU]CONTEXT_SIZE, enforce requiring them and always check the sizeof target_{u,m}context_t sizes. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/target_os_ucontext.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/bsd-user/freebsd/target_os_ucontext.h b/bsd-user/freebsd/target_os_ucontext.h index 1d0c3c4e65..64ed60e583 100644 --- a/bsd-user/freebsd/target_os_ucontext.h +++ b/bsd-user/freebsd/target_os_ucontext.h @@ -27,9 +27,7 @@ typedef struct target_ucontext { int32_t __spare__[4]; } target_ucontext_t; -#ifdef TARGET_MCONTEXT_SIZE G_STATIC_ASSERT(TARGET_MCONTEXT_SIZE == sizeof(target_mcontext_t)); G_STATIC_ASSERT(TARGET_UCONTEXT_SIZE == sizeof(target_ucontext_t)); -#endif /* TARGET_MCONTEXT_SIZE */ #endif /* TARGET_OS_UCONTEXT_H */ From patchwork Fri Nov 5 03:19:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1551246 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=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=ZvuVQbhW; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hln9x3P4lz9sfG for ; Fri, 5 Nov 2021 15:11:01 +1100 (AEDT) Received: from localhost ([::1]:51000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miqZ8-0005pe-Lh for incoming@patchwork.ozlabs.org; Fri, 05 Nov 2021 00:10:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mipmE-0005Bb-Pb for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:26 -0400 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]:39701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mipmC-0004I6-SU for qemu-devel@nongnu.org; Thu, 04 Nov 2021 23:20:26 -0400 Received: by mail-il1-x130.google.com with SMTP id x9so8253459ilu.6 for ; Thu, 04 Nov 2021 20:20:24 -0700 (PDT) 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=VTdt3uC+ttB19F3HtSXrERhSxFv3zvRil3LE5812gSQ=; b=ZvuVQbhWL752TFt/HIueURSaRxw7PD9VbXJ3EwFdDCXICqP5EbSW0pGRg6LwEhJoWk QPJQuET+/yHpdf1NYLwFY/VFwqx73+3TuqIZWKhYV7rnn812gCiSkg5bXj83RiHeAqa9 T/6x2AUXgYP8t5IHJowkLCPSnpgWo5rk275Qt0HXrm2p6smhGGVXmXZkAiFes2GVe80X H9zRdk6Tth9qONYKZWs4jOK4vd4KUQFxQQHn13l3JBWODtokq/m8ifJrU96XGEmMpeYl 9ConCB1sx5o7maHT6Sm0QNT8/anJX1tDa4Zx1tSLkZ/HwaDYQr8iSPoWaajqE3cKAnrb M1tg== 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=VTdt3uC+ttB19F3HtSXrERhSxFv3zvRil3LE5812gSQ=; b=fYc+Mxk5EkI3FmnqJ1WeDcVmC1PMCXYe5ErgiR39BOKX/tPPUeDEYAgiTAzNIDPTJR vXK5xfwRjXyA4k1C2KC91wkl3ibzQgI0MP0pWL864DiupIoCKbWfLEWnHclFt5zl+7io esZ+47Z844548J7bEVws1hD4W8xWP8Lmudrg8ybc1/VioKTXW7E7pH3jNCBNOiPlIRLI 0vIugI4xhvdd7acD87gSwSWXG2pGwJkxPelMcKR4J+o/Q2QX/nZFzdu4DNjOGV9Dv/O/ yYxAvys9AxJ2CPOGen2tSaBWJEDkd0EqZMEoGwxDNUq8ZENn55yjY0bElIB97s4TWRR1 6CAA== X-Gm-Message-State: AOAM533gtEWL8JCBM3Sfmthm19Ge3IH14mUwKyPQfvtvrOPYWDsnB8IU m7lPpCX+mnpb+mIr0bKOe+YsxIJfhw8H8g== X-Google-Smtp-Source: ABdhPJw89eb2XtkOGxacss+CuxtYaCDDBtyRPbFK8CL0Cz12wSmbFe63DAP0G9HefwuVq5uZFElhLA== X-Received: by 2002:a92:6f0c:: with SMTP id k12mr31350189ilc.240.1636082423674; Thu, 04 Nov 2021 20:20:23 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id v4sm3508528ilq.57.2021.11.04.20.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 20:20:23 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v4 36/36] bsd-user: add arm target build Date: Thu, 4 Nov 2021 21:19:17 -0600 Message-Id: <20211105031917.87837-37-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105031917.87837-1-imp@bsdimp.com> References: <20211105031917.87837-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::130; envelope-from=imp@bsdimp.com; helo=mail-il1-x130.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Kyle Evans , Paolo Bonzini , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" CC: Paolo Bonzini Signed-off-by: Warner Losh Acked-by: Kyle Evans Reviewed-by: Richard Henderson --- configs/targets/arm-bsd-user.mak | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 configs/targets/arm-bsd-user.mak diff --git a/configs/targets/arm-bsd-user.mak b/configs/targets/arm-bsd-user.mak new file mode 100644 index 0000000000..cb143e6426 --- /dev/null +++ b/configs/targets/arm-bsd-user.mak @@ -0,0 +1,2 @@ +TARGET_ARCH=arm +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml