On Mon, 21 Mar 2016 12:33:32 +0100 Laurent Vivier <lvivier@xxxxxxxxxx> wrote: > Check in MSR if the SF bit is set (64bit mode is enabled) > > Signed-off-by: Laurent Vivier <lvivier@xxxxxxxxxx> > Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx> Reviewed-by: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> > --- > 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(); > -- > 2.5.0 > -- David Gibson <dgibson@xxxxxxxxxx> Senior Software Engineer, Virtualization, Red Hat
Attachment:
pgpJcv7vKfBm0.pgp
Description: OpenPGP digital signature