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: 600078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qTDHS407jz9sD3 for ; Mon, 21 Mar 2016 22:33:56 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755192AbcCULdx (ORCPT ); Mon, 21 Mar 2016 07:33:53 -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-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org 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();