From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Huth Date: Fri, 18 Mar 2016 08:28:33 +0000 Subject: Re: [kvm-unit-tests PATCH 3/5] powerpc: check 64bit mode Message-Id: <56EBBC31.6010301@redhat.com> List-Id: References: <1458141183-27207-1-git-send-email-lvivier@redhat.com> <1458141183-27207-4-git-send-email-lvivier@redhat.com> In-Reply-To: <1458141183-27207-4-git-send-email-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Laurent Vivier , kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Cc: drjones@redhat.com, dgibson@redhat.com, pbonzini@redhat.com On 16.03.2016 16:13, Laurent Vivier wrote: > Check in MSR if the SF bit is set (64bit mode is enabled) > > Signed-off-by: Laurent Vivier > --- > 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(); Reviewed-by: Thomas Huth But I still wonder how kvm-unit-tests worked at all before the 64-bit mode has been fixed in QEMU ... I mean kvm-unit-tests is compiled with 64-bit code, but it's still working when run in 32-bit? Something really strange was going on here... Thomas