diff --git a/src/arch/x86/transitions/librm.S b/src/arch/x86/transitions/librm.S index e91ede37..c31daad8 100644 --- a/src/arch/x86/transitions/librm.S +++ b/src/arch/x86/transitions/librm.S @@ -7,6 +7,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ) +/* Drag in general configuration */ +#include + /* Drag in local definitions */ #include "librm.h" @@ -207,7 +210,9 @@ VC_TMP_CR3: .space 4 VC_TMP_CR4: .space 4 VC_TMP_EMER: .space 8 .endif +#ifdef TIVOLI_VMM_WORKAROUND VC_TMP_FXSAVE: .space 512 +#endif VC_TMP_END: .previous @@ -1000,11 +1005,12 @@ virt_call: /* Claim ownership of temporary static buffer */ cli - - /* Preserve FPU, MMX and SSE state in temporary static buffer */ movw %cs:rm_ds, %ds - fxsave ( rm_tmpbuf + VC_TMP_FXSAVE ) +#ifdef TIVOLI_VMM_WORKAROUND + /* Preserve FPU, MMX and SSE state in temporary static buffer */ + fxsave ( rm_tmpbuf + VC_TMP_FXSAVE ) +#endif /* Preserve GDT and IDT in temporary static buffer */ sidt ( rm_tmpbuf + VC_TMP_IDT ) sgdt ( rm_tmpbuf + VC_TMP_GDT ) @@ -1070,9 +1076,11 @@ vc_rmode: movl $MSR_EFER, %ecx wrmsr .endif + +#ifdef TIVOLI_VMM_WORKAROUND /* Restore FPU, MMX and SSE state from temporary static buffer */ fxrstor ( rm_tmpbuf + VC_TMP_FXSAVE ) - +#endif /* Restore registers and flags and return */ popl %eax /* skip %cs and %ss */ popw %ds diff --git a/src/config/general.h b/src/config/general.h index d2bbeb06..be0845f6 100644 --- a/src/config/general.h +++ b/src/config/general.h @@ -190,6 +190,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #undef GDBUDP /* Remote GDB debugging over UDP * (both may be set) */ //#define EFI_DOWNGRADE_UX /* Downgrade UEFI user experience */ +#define TIVOLI_VMM_WORKAROUND /* Work around the Tivoli VMM's garbling of SSE + * registers when iPXE traps to it due to + * privileged instructions */ #include #include NAMED_CONFIG(general.h)