From patchwork Fri Nov 23 14:45:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 151906 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2238812ljp; Fri, 23 Nov 2018 07:11:01 -0800 (PST) X-Google-Smtp-Source: AJdET5dZV/piOAsinl/jEgb2IuHeiJyhoG2vExPiaJgaoTqQCS67PwdyFuVz3+xOzW88ELc3GYBj X-Received: by 2002:a0d:dc42:: with SMTP id f63-v6mr16994887ywe.62.1542985861405; Fri, 23 Nov 2018 07:11:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542985861; cv=none; d=google.com; s=arc-20160816; b=QrCurDaD4zwjSsWQRIkklyM9TnWTZeQW8/D7UWwrivkfYAtvMB2xrEOtqLUGJvKU+F 5wUOk2lK2ydzCTV79MZltN5lfb37NtlbVTdGMifgZrpRiUzb/lJb5fZohuQDa7vS7fS9 TiAHqgEv2sKedqUdcHsXNVZUvxeB1lbF8aarnPIxb8KdhcMrpT980dj9Qa+6Ksk0gIRD j5yGxTBxK2OjvQoql3YKaxgrYldoxPUDBfEnDKeBTG7k7UJOFCVf6zWFYx8el/6Rga23 Amc8AqG7Z2/pLOiJwfePCfdVdIldA4KIEmExxm6Rkb7oZ1QF+Ep1utbmGS3rL7aTBKlk yVrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=pjRtmlyYSb1VLkGjhaHARmsTCgNRA8M6YYDKvLblOwM=; b=U5tnjpjRcE1wtk+0rN4xD2KAmJNCBfeJh9kErpmtniPIrsY++ZYiKVf0/+FODELyh1 4pmx6T/66dl0uJBoCuWDXaQf8HQLrncmdXvdxfG8BJK4uCdsm6sf/QbEy5lzQ5nCnGL4 UHZPFsn9ysA9k5tUR+2F4IbvCEcJWi0vUUgBgnJZk9CKE2d630HnZaBaOxkXgSiJGhPo TX9BJ3O/mnMUSLtky+XYlcnhRWXJPr+gyt84PRFE0QpoercYuPb/BxyuMYSTZYFLiJYl 4p+hZU98EHzh4Ee5E0TZQODlGAst4Ez5ec3jdMIcHfCRzcK+67gpTgVP0gy0NXe3UT4C 0ToA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IW95SJNH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id m25-v6si24496924ybj.422.2018.11.23.07.11.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Nov 2018 07:11:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IW95SJNH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52895 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQD6i-0007Kz-Lp for patch@linaro.org; Fri, 23 Nov 2018 10:11:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQCj9-0000LQ-CR for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQCj5-0003nL-O8 for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:39 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:36618) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gQCj5-0003ly-HF for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:35 -0500 Received: by mail-wr1-x444.google.com with SMTP id t3so12596704wrr.3 for ; Fri, 23 Nov 2018 06:46:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pjRtmlyYSb1VLkGjhaHARmsTCgNRA8M6YYDKvLblOwM=; b=IW95SJNHj/hYK6QwjfgzZrgLVDyCnmkfrgdwyb1qV6tFKdoc7v7BTc9HQ18wWPxIAA WFFyKf3DyV1uRZrEFzQTBpc8kALNMWyqWIe3lcYq1vzktTPISxiIKXaoOESKjo/Ufgqn p70MHi3Eg18+IQN24sSrTZ3OzIXC6rP89RbYk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pjRtmlyYSb1VLkGjhaHARmsTCgNRA8M6YYDKvLblOwM=; b=FHeOHzNfgxMYDMxKBkd43VRwfgYlw72H/qlnCSdT+PG9CRWWmD0T5fyz4WVAl4GPD9 vUhf1qEawwnDpMQVBv/R54slFeDbny+t+sm143ZeQ3Q44pjOdiAV76h+/H0YfkXI9w/z lAlTKBSxvHyMF2yONJYNFa2Q3D6YgYeJFXt4VGS16xLxGBuOxh6HzyU8L8CjzC5G3xNU nlwbStzlCaRhp+mPAa8l7bhMX4m4StvDsPMZ43ZKB8Eylcudnv3o5DQ2t16Bndh7qxtZ m7c1/XCP6tkMCqJK9gfR4d1rwgrOt5vh2qFpuDWweXjouEwIGbjBmomJel8Mk2Mbek+m XuPA== X-Gm-Message-State: AA+aEWY2lO8vc7DWGMRxwwptmrDzIslWDgEqHWV+9FDHzxgI8J4fRJRB uG7zW4IYkj9UgJf7Q+RHdHvam9tUNYZCsA== X-Received: by 2002:adf:b30f:: with SMTP id j15mr11189970wrd.46.1542984394121; Fri, 23 Nov 2018 06:46:34 -0800 (PST) Received: from cloudburst.twiddle.net ([195.77.246.50]) by smtp.gmail.com with ESMTPSA id p74sm10339630wmd.29.2018.11.23.06.46.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Nov 2018 06:46:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 23 Nov 2018 15:45:56 +0100 Message-Id: <20181123144558.5048-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181123144558.5048-1-richard.henderson@linaro.org> References: <20181123144558.5048-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH for-4.0 v2 35/37] tcg/i386: Add setup_guest_base_seg for FreeBSD X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair.Francis@wdc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.inc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.17.2 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 79de8d0cd2..55c5a8516c 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -1818,6 +1818,16 @@ static inline void setup_guest_base_seg(void) guest_base_flags = P_GS; } } +#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__) +# include + +static int guest_base_flags; +static inline void setup_guest_base_seg(void) +{ + if (sysarch(AMD64_SET_GSBASE, &guest_base) == 0) { + guest_base_flags = P_GS; + } +} #else # define guest_base_flags 0 static inline void setup_guest_base_seg(void) { }