1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
#include "config.h"
#include "config-host.h"
#include <string.h>
#include "hw/hw.h"
#include "qemu-kvm.h"
#include "libkvm-all.h"
#include <pthread.h>
#include <sys/utsname.h>
#include <sys/io.h>
int kvm_arch_qemu_create_context(void)
{
return 0;
}
void kvm_arch_load_regs(CPUState *env)
{
}
void kvm_arch_save_regs(CPUState *env)
{
}
int kvm_arch_qemu_init_env(CPUState *cenv)
{
return 0;
}
int kvm_arch_halt(void *opaque, kvm_vcpu_context_t vcpu)
{
CPUState *env = cpu_single_env;
env->hflags |= HF_HALTED_MASK;
env->exception_index = EXCP_HLT;
return 1;
}
void kvm_arch_pre_kvm_run(void *opaque, CPUState *env)
{
}
void kvm_arch_post_kvm_run(void *opaque, CPUState *env)
{
}
int kvm_arch_has_work(CPUState *env)
{
return 1;
}
int kvm_arch_try_push_interrupts(void *opaque)
{
return 1;
}
void kvm_arch_update_regs_for_sipi(CPUState *env)
{
}
int kvm_arch_insert_sw_breakpoint(CPUState *current_env,
struct kvm_sw_breakpoint *bp)
{
return -EINVAL;
}
int kvm_arch_remove_sw_breakpoint(CPUState *current_env,
struct kvm_sw_breakpoint *bp)
{
return -EINVAL;
}
int kvm_arch_insert_hw_breakpoint(target_ulong addr,
target_ulong len, int type)
{
return -ENOSYS;
}
int kvm_arch_remove_hw_breakpoint(target_ulong addr,
target_ulong len, int type)
{
return -ENOSYS;
}
void kvm_arch_remove_all_hw_breakpoints(void)
{
}
int kvm_arch_debug(struct kvm_debug_exit_arch *arch_info)
{
return 0;
}
void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg)
{
}
void kvm_save_mpstate(CPUState *env)
{
#ifdef KVM_CAP_MP_STATE
int r;
struct kvm_mp_state mp_state;
r = kvm_get_mpstate(env->kvm_cpu_state.vcpu_ctx, &mp_state);
if (r < 0)
env->mp_state = -1;
else
env->mp_state = mp_state.mp_state;
#endif
}
void kvm_load_mpstate(CPUState *env)
{
#ifdef KVM_CAP_MP_STATE
struct kvm_mp_state mp_state = { .mp_state = env->mp_state };
/*
* -1 indicates that the host did not support GET_MP_STATE ioctl,
* so don't touch it.
*/
if (env->mp_state != -1)
kvm_set_mpstate(env->kvm_cpu_state.vcpu_ctx, &mp_state);
#endif
}
void kvm_arch_cpu_reset(CPUState *env)
{
if (kvm_irqchip_in_kernel(kvm_context)) {
#ifdef KVM_CAP_MP_STATE
kvm_reset_mpstate(env->kvm_cpu_state.vcpu_ctx);
#endif
} else {
env->interrupt_request &= ~CPU_INTERRUPT_HARD;
env->halted = 1;
env->exception_index = EXCP_HLT;
}
}
void kvm_arch_do_ioperm(void *_data)
{
struct ioperm_data *data = _data;
ioperm(data->start_port, data->num, data->turn_on);
}
|