|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] Properly ensure that every write to GS is followed by a
ChangeSet 1.1283, 2005/04/07 09:19:23+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx
Properly ensure that every write to GS is followed by a serialising
instruction before the next SWAPGS (AMD erratum #88). We only resort
to adding an otherwise unnecessary mfence in two cases.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
domain.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c 2005-04-07 05:04:11 -04:00
+++ b/xen/arch/x86/domain.c 2005-04-07 05:04:11 -04:00
@@ -585,22 +585,21 @@
n->arch.user_ctxt.fs_base,
n->arch.user_ctxt.fs_base>>32);
+ /* Most kernels have non-zero GS base, so don't bother testing. */
+ /* (This is also a serialising instruction, avoiding AMD erratum #88.) */
+ wrmsr(MSR_SHADOW_GS_BASE,
+ n->arch.user_ctxt.gs_base_kernel,
+ n->arch.user_ctxt.gs_base_kernel>>32);
+
/* This can only be non-zero if selector is NULL. */
if ( n->arch.user_ctxt.gs_base_user )
wrmsr(MSR_GS_BASE,
n->arch.user_ctxt.gs_base_user,
n->arch.user_ctxt.gs_base_user>>32);
- /* This can only be non-zero if selector is NULL. */
- if ( p->arch.user_ctxt.gs_base_kernel |
- n->arch.user_ctxt.gs_base_kernel )
- wrmsr(MSR_SHADOW_GS_BASE,
- n->arch.user_ctxt.gs_base_kernel,
- n->arch.user_ctxt.gs_base_kernel>>32);
-
/* If in kernel mode then switch the GS bases around. */
if ( n->arch.flags & TF_kernel_mode )
- __asm__ __volatile__ ( safe_swapgs );
+ __asm__ __volatile__ ( "swapgs" );
if ( unlikely(!all_segs_okay) )
{
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] Properly ensure that every write to GS is followed by a serialising,
BitKeeper Bot <=
|
|
|
|
|