From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E9D7C433EF for ; Sat, 8 Jan 2022 08:28:40 +0000 (UTC) Received: from localhost ([::1]:34600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n675b-0003Na-6o for qemu-devel@archiver.kernel.org; Sat, 08 Jan 2022 03:28:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n66Ie-0005K0-I8 for qemu-devel@nongnu.org; Sat, 08 Jan 2022 02:38:11 -0500 Received: from [2607:f8b0:4864:20::134] (port=35612 helo=mail-il1-x134.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n66Ia-0003O5-D8 for qemu-devel@nongnu.org; Sat, 08 Jan 2022 02:38:04 -0500 Received: by mail-il1-x134.google.com with SMTP id b1so6516983ilj.2 for ; Fri, 07 Jan 2022 23:37:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dGk1mYR+ompm1xLOR0KlYLZIRg9T3SJe9aFkUo7qUu4=; b=wmlIVybvJUbsOoVR96K7OED2nZ1tfRqeux+dLGSv0kC1xfM09erl/Gn4PgrBok5/P/ GUY13Ss247fCHaUDNzW413lka65fzdvnRZiCgYhi0HnnTXrkUGsn8d2sSvledw0u0kdC qGoLPY9RRrdDvxh1Lr9z0c+RPudIb2jMHiOX0nD7LqsbkptHOysMDj4lQAl5mlGEpO73 15u6BbqtXSOsvIgqZ/WPfFuPhBRdCRj2s5OGT43jDWeIl4ddej8MHe3ugZY9swPdJSOx LBaJTUia33EC5IUnZDN6C+Y+zGSepazySgZhwBihwUycD3qbhvIbAF3DoA88S/R7e337 aJ7A== 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=dGk1mYR+ompm1xLOR0KlYLZIRg9T3SJe9aFkUo7qUu4=; b=Ndw1qcNde7GBCZSZ94IClUK4fMXPx2C6BdFd1UXJe+ZMxAptkzJXDdibG69f+OZsdO DrOfR7np3iPU+PHzrzNppCA7qurxvH+i2dXXHuf6jb+iGYVwc/8JzD8PlqJg7Xrv4lKo DNq4Z9vFKGrfOG4izHOt3L7L6em/26bryTEki2LhiFmYTbAAAu9x3jEKbM1ohhjcRydB cyp6oQ/emLeGotmNiIcuIzj/YVnlNGWhKtCAF8dvpqH6GjnhKwFn1mgxxDOrzWfERzxC GDD7WQ5SCHl30hRVgGD8YOH3M59xyozanNzRVkWvphfiMghoOkvxB1MYYEtIfz/j7s8Z jjlA== X-Gm-Message-State: AOAM532ku3K3BgPLUeYehysGZ/sZgs5++HcWdbEjSOULk9D0RiuNYMAG bgZJMY6aSI7ZiRC0owKDZqt57PE78LZ+ea54 X-Google-Smtp-Source: ABdhPJyu9uu+FLYhxyBiRuXFuSAlHui2GVSQ5AA67MbiRvecRt4N04KxF4irbqaIIvnDJ+n+IBTBuA== X-Received: by 2002:a05:6e02:1c85:: with SMTP id w5mr27470309ill.27.1641627477738; Fri, 07 Jan 2022 23:37:57 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id w19sm613022iov.12.2022.01.07.23.37.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 23:37:57 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL 15/37] bsd-user/arm/target_arch_cpu.c: Target specific TLS routines Date: Sat, 8 Jan 2022 00:37:15 -0700 Message-Id: <20220108073737.5959-16-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220108073737.5959-1-imp@bsdimp.com> References: <20220108073737.5959-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::134 (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::134; envelope-from=imp@bsdimp.com; helo=mail-il1-x134.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stacey Son , qemu-trivial@nongnu.org, Kyle Evans , Michael Tokarev , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , Richard Henderson , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.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 00000000000..93cfaea0986 --- /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 00000000000..02bf9149d54 --- /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]; +} -- 2.33.1