1 #include <asm/paravirt.h>
3 DEF_NATIVE(pv_irq_ops
, irq_disable
, "cli");
4 DEF_NATIVE(pv_irq_ops
, irq_enable
, "sti");
5 DEF_NATIVE(pv_irq_ops
, restore_fl
, "push %eax; popf");
6 DEF_NATIVE(pv_irq_ops
, save_fl
, "pushf; pop %eax");
7 DEF_NATIVE(pv_cpu_ops
, iret
, "iret");
8 DEF_NATIVE(pv_cpu_ops
, irq_enable_sysexit
, "sti; sysexit");
9 DEF_NATIVE(pv_mmu_ops
, read_cr2
, "mov %cr2, %eax");
10 DEF_NATIVE(pv_mmu_ops
, write_cr3
, "mov %eax, %cr3");
11 DEF_NATIVE(pv_mmu_ops
, read_cr3
, "mov %cr3, %eax");
12 DEF_NATIVE(pv_cpu_ops
, clts
, "clts");
13 DEF_NATIVE(pv_cpu_ops
, read_tsc
, "rdtsc");
15 unsigned native_patch(u8 type
, u16 clobbers
, void *ibuf
,
16 unsigned long addr
, unsigned len
)
18 const unsigned char *start
, *end
;
21 #define PATCH_SITE(ops, x) \
22 case PARAVIRT_PATCH(ops.x): \
23 start = start_##ops##_##x; \
24 end = end_##ops##_##x; \
27 PATCH_SITE(pv_irq_ops
, irq_disable
);
28 PATCH_SITE(pv_irq_ops
, irq_enable
);
29 PATCH_SITE(pv_irq_ops
, restore_fl
);
30 PATCH_SITE(pv_irq_ops
, save_fl
);
31 PATCH_SITE(pv_cpu_ops
, iret
);
32 PATCH_SITE(pv_cpu_ops
, irq_enable_sysexit
);
33 PATCH_SITE(pv_mmu_ops
, read_cr2
);
34 PATCH_SITE(pv_mmu_ops
, read_cr3
);
35 PATCH_SITE(pv_mmu_ops
, write_cr3
);
36 PATCH_SITE(pv_cpu_ops
, clts
);
37 PATCH_SITE(pv_cpu_ops
, read_tsc
);
40 ret
= paravirt_patch_insns(ibuf
, len
, start
, end
);
44 ret
= paravirt_patch_default(type
, clobbers
, ibuf
, addr
, len
);