On 25/09/2015 01:26, Bill Paul wrote:
> The result of this is that if the CPU was in long mode and you do an INIT
> IPI,
> the CPU still has the EFER.LMA and EFER.LME bits set, even though it's not
> actually running in long mode anymore. It doesn't seem possible for the guest
> to get the CPU out of this state, and one nasty side-effect is that trying to
> set the CR0 to enable paging never succeeds.
>
> I added the following code at line 1240 above as a workaround:
>
> #ifdef TARGET_X86_64
> /*
> * The initial state of the CPU is not 64-bit mode. This being
> * the case, don't leave the EFER.LME or EFER.LME bits set.
> */
>
> cpu_load_efer(env, 0);
> #endif
>
> This seemed to fix the problem I was having, however I'm not certain this is
> the correct fix.
I think a better fix is to move the "uint64_t efer;" field to some place
before the dummy "struct {} start_init_save;" marker in
target-i386/cpu.h. Can you test it and send a patch if it works?
Thanks,
Paolo