/root/src/xen/xen/arch/x86/x86_emulate.c
Line | Count | Source (jump to first uncovered line) |
1 | | /****************************************************************************** |
2 | | * x86_emulate.c |
3 | | * |
4 | | * Wrapper for generic x86 instruction decoder and emulator. |
5 | | * |
6 | | * Copyright (c) 2008, Citrix Systems, Inc. |
7 | | * |
8 | | * Authors: |
9 | | * Keir Fraser <keir@xen.org> |
10 | | */ |
11 | | |
12 | | #include <xen/domain_page.h> |
13 | | #include <asm/x86_emulate.h> |
14 | | #include <asm/asm_defns.h> /* mark_regs_dirty() */ |
15 | | #include <asm/processor.h> /* current_cpu_info */ |
16 | | #include <asm/xstate.h> |
17 | | #include <asm/amd.h> /* cpu_has_amd_erratum() */ |
18 | | |
19 | | /* Avoid namespace pollution. */ |
20 | | #undef cmpxchg |
21 | | #undef cpuid |
22 | | #undef wbinvd |
23 | | |
24 | 58 | #define r(name) r ## name |
25 | | |
26 | | #define cpu_has_amd_erratum(nr) \ |
27 | | cpu_has_amd_erratum(¤t_cpu_data, AMD_ERRATUM_##nr) |
28 | | |
29 | 0 | #define get_stub(stb) ({ \ |
30 | 0 | BUILD_BUG_ON(STUB_BUF_SIZE / 2 < MAX_INST_LEN + 1); \ |
31 | 0 | ASSERT(!(stb).ptr); \ |
32 | 0 | (stb).addr = this_cpu(stubs.addr) + STUB_BUF_SIZE / 2; \ |
33 | 0 | memset(((stb).ptr = map_domain_page(_mfn(this_cpu(stubs.mfn)))) + \ |
34 | 0 | ((stb).addr & ~PAGE_MASK), 0xcc, STUB_BUF_SIZE / 2); \ |
35 | 0 | }) |
36 | 60.1k | #define put_stub(stb) ({ \ |
37 | 60.1k | if ( (stb).ptr ) \ |
38 | 0 | { \ |
39 | 0 | unmap_domain_page((stb).ptr); \ |
40 | 0 | (stb).ptr = NULL; \ |
41 | 0 | } \ |
42 | 60.1k | }) |
43 | | |
44 | | #include "x86_emulate/x86_emulate.c" |