From patchwork Sat Feb 9 06:31:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 157930 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp347166jaa; Fri, 8 Feb 2019 22:32:31 -0800 (PST) X-Google-Smtp-Source: AHgI3IbDjSvp8k2jq++6ESpL2kqhCp+eoIHMTlQHSpPKtJuDC2YzPRXrxSNlrqZZKlY7dQrlbXQj X-Received: by 2002:a05:6000:1044:: with SMTP id c4mr11578097wrx.296.1549693951853; Fri, 08 Feb 2019 22:32:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549693951; cv=none; d=google.com; s=arc-20160816; b=PqHs5iFmyxOYs/1wmYFmdgRj/wuCpyp4muas99R6c7HAuXyVKvHUs/xt7yD+acUDMm 6ETVi5Fv++jjwH4mjtScE8wsr2TdZKz4LvfN5Hxk6UMHR8z7T/Ypiuncsi+uVWG7fCMX d0WT1nTP8JZtLOkv82UfheytspFckwjHx/vu3ppbk9VHsJK85D2h8nbzMDDKF2nV37zu F2P9MRbA+wBkmlTnjoRoWC5/1Mnv+O6qYt2KD+cUqZvxr387mLyRXb4o52DRhZghu0qD p/Rhgl4xQljavP9ZsA+pSTw+p2oNHP9knX8Dc5xkQwZ6WEIjVi5LOUyvvKYs/WGIXc1m RUaw== 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=YMqxhfu88Z2kP2dYHld6PH/lBGcNG05WKIQCsarEYBA=; b=ALfXVG96csiNMi9eMvh0ksEyRllmKvs5+TbnprAftRvP/ZJEqSiCYozlOxdFyHdjGn p/xu15og3WBdrL6eTmv7ZeEvkNvRCWLBAypGtihFAmnl6prDVkeAXi/1cSGMRsVrnYZg 7AcIFXzfjj8LBMqul34RNvd8ZAYlK7seHyAHa7Cxx8hw40YEDw5nhWm1QF/dqN9OZC1C wfnhLBB0X7IK5f8JBr/VVUgFonzb/7/wAkczXoYmfXaYgSjpz1wCTQrBVo+QJb9RRLqL Oc/YfFcM7ar/iBfrcDcTBfmC9xLSoM9K5+LM5wDJ1x8328bzQ1oDwX6C31qZqki8MfOH Gn4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oXmhHonT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s12si4169506wrp.99.2019.02.08.22.32.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 08 Feb 2019 22:32:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oXmhHonT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:41105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsMBi-0000UN-QZ for patch@linaro.org; Sat, 09 Feb 2019 01:32:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsMBC-0000S4-0f for qemu-devel@nongnu.org; Sat, 09 Feb 2019 01:31:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gsMBB-0007Jj-5u for qemu-devel@nongnu.org; Sat, 09 Feb 2019 01:31:57 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:41449) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gsMBB-0007Iq-0x for qemu-devel@nongnu.org; Sat, 09 Feb 2019 01:31:57 -0500 Received: by mail-pg1-x542.google.com with SMTP id m1so2538318pgq.8 for ; Fri, 08 Feb 2019 22:31:56 -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=YMqxhfu88Z2kP2dYHld6PH/lBGcNG05WKIQCsarEYBA=; b=oXmhHonTX+V7yN/V/h7M/B36FZQwsyoES9VpHUlGIg93AJpIRZfnxBgQ1QGp7wiN0j K8U/wrsNjmYC2zadNyPa6Xc7rBHQceV//n1hWx1LUU1uDYlSJxzrQ4a1Tv+dLgOXshal ST5ws2I/acsaIBfPbNMujBYvb7tZ48z5UeyGVzaIdOupTIPDMyZyXJrgkVQskYciuR/H +9P0z40aikOkCQJM7jrmcDeZQG5ITdoFpH1wI1k1FU16jYFXEAyYTB2Sljv3l+b6n4we Mg/cxmX5WmhtjB2BUUoTZj4XpjqVVcN9pgXQcXflhlw4ocagMjgODKgymxYZ/E58Kdg0 QbzQ== 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=YMqxhfu88Z2kP2dYHld6PH/lBGcNG05WKIQCsarEYBA=; b=SGSSKd9PvaSH9SFDj2riDgAEUnW9PtfPy0uNlvCl8qTUUQemEOvUqB9oaPwmAeWTJ/ ac2z6WK4IonTvnCADthzT5EkeNRUPwYkwYiOcClzQkToZCgLvtXAGeR2aj7Ed1W1Awa3 ZyhKv2rhld1KbtXAGkXlNht4DJX4yc5GUyigRw/7Ba53jYdJ5+RtJflxiC33oCElBDR8 EJ6Wvk9bawc1M8CLwXRVoXTosjCXzdy4BfB2COsl/PNcrQQ5w4yjTG441uK/jpAhFVHJ IIb8ovu9sHxGnEQ63/rfyvfu0Ztl7vqd/fi1KtrCe3KrHZsiPBlPNggLSml2Egacd/ix L94w== X-Gm-Message-State: AHQUAubCm73wBTQdgDfQM1yBO6zJ6OkWIZvdJPkTTw7rk/G1wOWit4AE Gl5KvBR6qSWbwLCNT3hF8axvLhyPIP4= X-Received: by 2002:a63:2643:: with SMTP id m64mr23624980pgm.35.1549693915614; Fri, 08 Feb 2019 22:31:55 -0800 (PST) Received: from cloudburst.twiddle.net (97-126-115-157.tukw.qwest.net. [97.126.115.157]) by smtp.gmail.com with ESMTPSA id a15sm4777426pgd.4.2019.02.08.22.31.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Feb 2019 22:31:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 8 Feb 2019 22:31:51 -0800 Message-Id: <20190209063152.9490-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190209063152.9490-1-richard.henderson@linaro.org> References: <20190209063152.9490-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH v2 1/2] target/s390x: Split out s390-tod.h 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: qemu-s390x@nongnu.org, thuth@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will need these from CONFIG_USER_ONLY as well, which cannot access include/hw/. Signed-off-by: Richard Henderson --- include/hw/s390x/tod.h | 16 +--------------- target/s390x/s390-tod.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 target/s390x/s390-tod.h -- 2.17.2 Reviewed-by: Thomas Huth Reviewed-by: David Hildenbrand diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h index 47ef9de869..9c4a6000c3 100644 --- a/include/hw/s390x/tod.h +++ b/include/hw/s390x/tod.h @@ -12,6 +12,7 @@ #define HW_S390_TOD_H #include "hw/qdev.h" +#include "s390-tod.h" typedef struct S390TOD { uint8_t high; @@ -50,21 +51,6 @@ typedef struct S390TODClass { void (*set)(S390TODState *td, const S390TOD *tod, Error **errp); } S390TODClass; -/* The value of the TOD clock for 1.1.1970. */ -#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL - -/* Converts ns to s390's clock format */ -static inline uint64_t time2tod(uint64_t ns) -{ - return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9); -} - -/* Converts s390's clock format to ns */ -static inline uint64_t tod2time(uint64_t t) -{ - return ((t >> 9) * 125) + (((t & 0x1ff) * 125) >> 9); -} - void s390_init_tod(void); S390TODState *s390_get_todstate(void); diff --git a/target/s390x/s390-tod.h b/target/s390x/s390-tod.h new file mode 100644 index 0000000000..8b74d6a6d8 --- /dev/null +++ b/target/s390x/s390-tod.h @@ -0,0 +1,29 @@ +/* + * TOD (Time Of Day) clock + * + * Copyright 2018 Red Hat, Inc. + * Author(s): David Hildenbrand + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef TARGET_S390_TOD_H +#define TARGET_S390_TOD_H + +/* The value of the TOD clock for 1.1.1970. */ +#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL + +/* Converts ns to s390's clock format */ +static inline uint64_t time2tod(uint64_t ns) +{ + return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9); +} + +/* Converts s390's clock format to ns */ +static inline uint64_t tod2time(uint64_t t) +{ + return ((t >> 9) * 125) + (((t & 0x1ff) * 125) >> 9); +} + +#endif From patchwork Sat Feb 9 06:31:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 157931 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp347207jaa; Fri, 8 Feb 2019 22:32:35 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia98Y9xfp3dVzpFjqyAQAbDLvh0pYmfteHZ95+Zu9+s2hrPPuw5zVEA82X103Cbw0ZqD18F X-Received: by 2002:a1c:f312:: with SMTP id q18mr1397175wmq.106.1549693955613; Fri, 08 Feb 2019 22:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549693955; cv=none; d=google.com; s=arc-20160816; b=DmY7iHvZdgzsebLSJtHeGEGM1DdeAlxivmL+36amZYoQK+ZIVDhLWHGQI2x4mohA3d FE/oZiHUVUU20wT/XlzQafSEsUDEbU4em/H7T0Fjv3LIOwontJIcNjpWko8zZ1jrlozr QvwUG1CXVHYs0WVqPPTNnmmqPgrTpfTpupd01xBTP3C7zEAZtqpOLQp35M4ePmL/K/+Z gbLifAjQl1oYDt/sOH9X6Hy6eNfsjQ7m1+H4LSxdyzDWaKkwW/6AUSvceAr4bpkxWaKq c/fZfT81mP6K5xuQOt2zlP29OYx86yFe5+crDsj0Wjo89pTxZ+6ak2Qqcb3vE7518/dX Xdgw== 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=G0ufu/uET53Ga4dunFZUjiJJPIATd1AW5yGKiQfmp/w=; b=CyavbrhqVmo2m4Po5ezVwkBBAdbj8eOsMDSaxqRMf+6OudFUb/M70hUbec0srz83Lh 7NL5l3+uX1j/76GtjZBJotZKZtWAEWU7w9cORXFy0Y7/rZebIm2N8PSNOF0ROYSxovbj Xu+EPZKBoO+s0jg5qUff4QWTluhy4sZjebVWWoAEmdcghWkxbp1F1ydRzg1LAAaSaEnB 0p7LDSrOF6HHGswFzr55qf+8jM7vTpwyGvKmj+yw3JTXH9s/Qlnc/TEzilO8m+UWMNNb vdHqdsDvl2eHJY2oxVtaZ9DsZ+9Q7Oq8PWTJnUl/+SGEdtvNtsbFy126zeSc/gEoEkUU jUOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MiwInWLC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e2si3016362wrv.166.2019.02.08.22.32.35 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 08 Feb 2019 22:32:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MiwInWLC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:41111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsMBm-0000YJ-HJ for patch@linaro.org; Sat, 09 Feb 2019 01:32:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsMBD-0000TA-GU for qemu-devel@nongnu.org; Sat, 09 Feb 2019 01:32:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gsMBC-0007Kw-8m for qemu-devel@nongnu.org; Sat, 09 Feb 2019 01:31:59 -0500 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:35560) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gsMBC-0007K5-34 for qemu-devel@nongnu.org; Sat, 09 Feb 2019 01:31:58 -0500 Received: by mail-pg1-x533.google.com with SMTP id s198so2551326pgs.2 for ; Fri, 08 Feb 2019 22:31:58 -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=G0ufu/uET53Ga4dunFZUjiJJPIATd1AW5yGKiQfmp/w=; b=MiwInWLC1Nu1ZeXtuDy2q3p002HZXlTwAIXB2ICMR2EmX3OGX9r/FSdA8lbR3MCqvK WHg5pNaFySqVx9MnjKGN71HIBBEhl4hhBYnm68fSOG/B3uTSbDGfgzqwblixkB7AYIlq vcVsKVUH/qI3O1nf0rIb1HvmT96zthhjB6V9u+hj81KwceGkQMF1eh/BPkwUua+X/6T+ rkRyFSSjCIlnE+GpcaQ+EHSm7S/73ivn9PV/X+NSv7dmZIJlUBK7EKo88EuabEErO2e2 AOFrBoERJshZynFxky1CIVhxMdO8uLh0438L9QL+bmDHqW3p3e0NEdRbKBWCzU+rSQ1b FJRA== 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=G0ufu/uET53Ga4dunFZUjiJJPIATd1AW5yGKiQfmp/w=; b=GBkMeKEC/hojwMkKmaY3y5GfoPDyj2ez6h9y+fXhK5A25RuavhZK3iRbfFNHXBlgTX TjZuuKnMDo+0/lmbi4BHf0ORxPmQ6soB4ydZNXLWhGFhNeLRbCzpnhw61RIXzWadnXop YBV1Pr/YqIw4T33dG07GI2PGKPcYQOGB6eQz0DYsSN+qeNARTO2iyn1V2gGhlll4x09q D5cuHU+6QGjLMrkRHEXa+9GmgvqSSadNmjDWjYnhgwVvR/Dn8+rBGOgWGQ8wLr1vQa+1 PpwcjMvemVmEn/VyOPZki3WXyaBcTzEWHQvodeezlbaePdpJsIAOXCzaX+uZt6Jw9Bzv WtIg== X-Gm-Message-State: AHQUAubBBPGsrfxWmvjV46Se2oeeKen+9C22/AyhbkhwAhHBUeHM15vi r3dIWpixfPaVB9rnlNuZjRXg1dZ800w= X-Received: by 2002:a63:f201:: with SMTP id v1mr22836267pgh.232.1549693916751; Fri, 08 Feb 2019 22:31:56 -0800 (PST) Received: from cloudburst.twiddle.net (97-126-115-157.tukw.qwest.net. [97.126.115.157]) by smtp.gmail.com with ESMTPSA id a15sm4777426pgd.4.2019.02.08.22.31.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Feb 2019 22:31:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 8 Feb 2019 22:31:52 -0800 Message-Id: <20190209063152.9490-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190209063152.9490-1-richard.henderson@linaro.org> References: <20190209063152.9490-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::533 Subject: [Qemu-devel] [PATCH v2 2/2] This is a non-privileged instruction that was only implemented for system mode. However, the stck instruction is used by glibc, so this was causing SIGILL for programs run under debian stretch. 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: qemu-s390x@nongnu.org, thuth@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/s390x/helper.h | 2 +- target/s390x/misc_helper.c | 34 ++++++++++++++++++++++------------ target/s390x/translate.c | 2 ++ target/s390x/insn-data.def | 11 ++++++----- 4 files changed, 31 insertions(+), 18 deletions(-) -- 2.17.2 Reviewed-by: Thomas Huth Reviewed-by: David Hildenbrand diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 018e9dd414..6260b50496 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -121,13 +121,13 @@ DEF_HELPER_4(cu41, i32, env, i32, i32, i32) DEF_HELPER_4(cu42, i32, env, i32, i32, i32) DEF_HELPER_5(msa, i32, env, i32, i32, i32, i32) DEF_HELPER_FLAGS_1(stpt, TCG_CALL_NO_RWG, i64, env) +DEF_HELPER_FLAGS_1(stck, TCG_CALL_NO_RWG_SE, i64, env) #ifndef CONFIG_USER_ONLY DEF_HELPER_3(servc, i32, env, i64, i64) DEF_HELPER_4(diag, void, env, i32, i32, i32) DEF_HELPER_3(load_psw, noreturn, env, i64, i64) DEF_HELPER_FLAGS_2(spx, TCG_CALL_NO_RWG, void, env, i64) -DEF_HELPER_FLAGS_1(stck, TCG_CALL_NO_RWG_SE, i64, env) DEF_HELPER_FLAGS_2(sck, TCG_CALL_NO_RWG, i32, env, i64) DEF_HELPER_FLAGS_2(sckc, TCG_CALL_NO_RWG, void, env, i64) DEF_HELPER_FLAGS_2(sckpf, TCG_CALL_NO_RWG, void, env, i64) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 52262f62df..ee67c1fa0c 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -30,6 +30,7 @@ #include "exec/cpu_ldst.h" #include "qapi/error.h" #include "tcg_s390x.h" +#include "s390-tod.h" #if !defined(CONFIG_USER_ONLY) #include "sysemu/cpus.h" @@ -76,8 +77,28 @@ uint64_t HELPER(stpt)(CPUS390XState *env) #endif } -#ifndef CONFIG_USER_ONLY +/* Store Clock */ +uint64_t HELPER(stck)(CPUS390XState *env) +{ +#ifdef CONFIG_USER_ONLY + struct timespec ts; + uint64_t ns; + clock_gettime(CLOCK_REALTIME, &ts); + ns = ts.tv_sec * NANOSECONDS_PER_SECOND + ts.tv_nsec; + + return TOD_UNIX_EPOCH + time2tod(ns); +#else + S390TODState *td = s390_get_todstate(); + S390TODClass *tdc = S390_TOD_GET_CLASS(td); + S390TOD tod; + + tdc->get(td, &tod, &error_abort); + return tod.low; +#endif +} + +#ifndef CONFIG_USER_ONLY /* SCLP service call */ uint32_t HELPER(servc)(CPUS390XState *env, uint64_t r1, uint64_t r2) { @@ -138,17 +159,6 @@ void HELPER(spx)(CPUS390XState *env, uint64_t a1) tlb_flush_page(cs, TARGET_PAGE_SIZE); } -/* Store Clock */ -uint64_t HELPER(stck)(CPUS390XState *env) -{ - S390TODState *td = s390_get_todstate(); - S390TODClass *tdc = S390_TOD_GET_CLASS(td); - S390TOD tod; - - tdc->get(td, &tod, &error_abort); - return tod.low; -} - static void update_ckc_timer(CPUS390XState *env) { S390TODState *td = s390_get_todstate(); diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 639084af07..19072efec6 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4060,6 +4060,7 @@ static DisasJumpType op_stap(DisasContext *s, DisasOps *o) tcg_gen_ld32u_i64(o->out, cpu_env, offsetof(CPUS390XState, core_id)); return DISAS_NEXT; } +#endif static DisasJumpType op_stck(DisasContext *s, DisasOps *o) { @@ -4096,6 +4097,7 @@ static DisasJumpType op_stcke(DisasContext *s, DisasOps *o) return DISAS_NEXT; } +#ifndef CONFIG_USER_ONLY static DisasJumpType op_sck(DisasContext *s, DisasOps *o) { tcg_gen_qemu_ld_i64(o->in1, o->addr1, get_mem_index(s), MO_TEQ | MO_ALIGN); diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index dab805fd90..61582372ab 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -837,6 +837,12 @@ C(0xe33e, STRV, RXY_a, Z, la2, r1_32u, new, m1_32, rev32, 0) C(0xe32f, STRVG, RXY_a, Z, la2, r1_o, new, m1_64, rev64, 0) +/* STORE CLOCK */ + C(0xb205, STCK, S, Z, la2, 0, new, m1_64, stck, 0) + C(0xb27c, STCKF, S, SCF, la2, 0, new, m1_64, stck, 0) +/* STORE CLOCK EXTENDED */ + C(0xb278, STCKE, S, Z, 0, a2, 0, 0, stcke, 0) + /* STORE FACILITY LIST EXTENDED */ C(0xb2b0, STFLE, S, SFLE, 0, a2, 0, 0, stfle, 0) /* STORE FPC */ @@ -1020,11 +1026,6 @@ F(0x8000, SSM, S, Z, 0, m2_8u, 0, 0, ssm, 0, IF_PRIV) /* SIGNAL PROCESSOR */ F(0xae00, SIGP, RS_a, Z, 0, a2, 0, 0, sigp, 0, IF_PRIV) -/* STORE CLOCK */ - C(0xb205, STCK, S, Z, la2, 0, new, m1_64, stck, 0) - C(0xb27c, STCKF, S, SCF, la2, 0, new, m1_64, stck, 0) -/* STORE CLOCK EXTENDED */ - C(0xb278, STCKE, S, Z, 0, a2, 0, 0, stcke, 0) /* STORE CLOCK COMPARATOR */ F(0xb207, STCKC, S, Z, la2, 0, new, m1_64a, stckc, 0, IF_PRIV) /* STORE CONTROL */