Skip to contentSkip to conversation

pae: cmpxchg8b emulation

PATCH New Gerd Knorr 1 participant 1 message Jun 22, 2005 x86

lore
Share & tools
lore

Gerd Knorr

author
#0 lore raw

PATCH 1/1 pae: cmpxchg8b emulation

Hi,

The patch below adds cmpxchg8b support for writable page tables (emulation code path), which is needed to make atomic pae l1 page table updates work.

Originally by Scott Parish, pulled from list archive ;)

Gerd

arch/x86/mm.c +19 -1
Index: xen/arch/x86/mm.c
===================================================================
@@ -2792,12 +2792,30 @@ static int ptwr_emulated_cmpxchg(
     return ptwr_emulated_update(addr, old, new, bytes, 1);
 }
 
+#if CONFIG_X86_PAE
+static int ptwr_emulated_cmpxchg8b(
+    unsigned long addr,
+    unsigned long old,
+    unsigned long old_hi,
+    unsigned long new,
+    unsigned long new_hi)
+{
+    return ptwr_emulated_update(addr,
+				(u64)old_hi << sizeof(old_hi)*8 | old,
+				(u64)new_hi << sizeof(new_hi)*8 | new,
+				sizeof(u64), 1);
+}
+#endif
+
 static struct x86_mem_emulator ptwr_mem_emulator = {
     .read_std         = x86_emulate_read_std,
     .write_std        = x86_emulate_write_std,
     .read_emulated    = x86_emulate_read_std,
     .write_emulated   = ptwr_emulated_write,
-    .cmpxchg_emulated = ptwr_emulated_cmpxchg
+    .cmpxchg_emulated = ptwr_emulated_cmpxchg,
+#if CONFIG_X86_PAE
+    .cmpxchg8b_emulated = ptwr_emulated_cmpxchg8b,
+#endif
 };
 
 /* Write page fault handler: check if guest is trying to modify a PTE. */