From patchwork Wed Mar 16 15:13:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 8601741 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4826C9F6E1 for ; Wed, 16 Mar 2016 15:14:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79B3F2034B for ; Wed, 16 Mar 2016 15:14:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AAECA20304 for ; Wed, 16 Mar 2016 15:14:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966805AbcCPPOU (ORCPT ); Wed, 16 Mar 2016 11:14:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41421 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966715AbcCPPOT (ORCPT ); Wed, 16 Mar 2016 11:14:19 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id E93361E27; Wed, 16 Mar 2016 15:14:18 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-112-23.ams2.redhat.com [10.36.112.23]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2GFE6kj016192; Wed, 16 Mar 2016 11:14:16 -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 3/5] powerpc: check 64bit mode Date: Wed, 16 Mar 2016 16:13:01 +0100 Message-Id: <1458141183-27207-4-git-send-email-lvivier@redhat.com> In-Reply-To: <1458141183-27207-1-git-send-email-lvivier@redhat.com> References: <1458141183-27207-1-git-send-email-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 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 --- powerpc/emulator.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/powerpc/emulator.c b/powerpc/emulator.c index 1215c4f..b66c1d7 100644 --- a/powerpc/emulator.c +++ b/powerpc/emulator.c @@ -32,12 +32,26 @@ 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(void) { handle_exception(0x700, program_check_handler, (void *)&is_invalid); report_prefix_push("emulator"); + test_64bit(); test_illegal(); report_prefix_pop();