From patchwork Mon Mar 21 11:33:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 8631901 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5BEEFC0553 for ; Mon, 21 Mar 2016 11:33:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C83020204 for ; Mon, 21 Mar 2016 11:33:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA028202B8 for ; Mon, 21 Mar 2016 11:33:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755215AbcCULdy (ORCPT ); Mon, 21 Mar 2016 07:33:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42319 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754901AbcCULdw (ORCPT ); Mon, 21 Mar 2016 07:33:52 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 7A551711D0; Mon, 21 Mar 2016 11:33:52 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-112-39.ams2.redhat.com [10.36.112.39]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2LBXeLj024562; Mon, 21 Mar 2016 07:33:50 -0400 From: Laurent Vivier To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Cc: drjones@redhat.com, thuth@redhat.com, dgibson@redhat.com, pbonzini@redhat.com, Laurent Vivier Subject: [kvm-unit-tests PATCH v2 3/5] powerpc: check 64bit mode Date: Mon, 21 Mar 2016 12:33:32 +0100 Message-Id: <1458560014-28862-4-git-send-email-lvivier@redhat.com> In-Reply-To: <1458560014-28862-1-git-send-email-lvivier@redhat.com> References: <1458560014-28862-1-git-send-email-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 21 Mar 2016 11:33:52 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check in MSR if the SF bit is set (64bit mode is enabled) Signed-off-by: Laurent Vivier Reviewed-by: Thomas Huth Reviewed-by: David Gibson --- powerpc/emulator.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/powerpc/emulator.c b/powerpc/emulator.c index 1d4f164..d97090c 100644 --- a/powerpc/emulator.c +++ b/powerpc/emulator.c @@ -43,6 +43,19 @@ static void test_illegal(void) report_prefix_pop(); } +static void test_64bit(void) +{ + uint64_t msr; + + report_prefix_push("64bit"); + + asm("mfmsr %[msr]": [msr] "=r" (msr)); + + report("detected", msr & 0x8000000000000000UL); + + report_prefix_pop(); +} + int main(int argc, char **argv) { int i; @@ -57,6 +70,7 @@ int main(int argc, char **argv) report_prefix_push("emulator"); + test_64bit(); test_illegal(); report_prefix_pop();