-
Notifications
You must be signed in to change notification settings - Fork 3
/
vcpurun.go
97 lines (81 loc) · 1.65 KB
/
vcpurun.go
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
package kvm
type ExitReason int
const (
ExitReasonUnknown ExitReason = iota
ExitReasonException
ExitReasonIO
ExitReasonHypercall
ExitReasonDebug
ExitReasonHlt
ExitReasonMmio
ExitReasonIrqWindowOpen
ExitReasonShutdown
ExitReasonFailEntry
ExitReasonIntr
ExitReasonSetTpr
ExitReasonTprAccess
ExitReasonS390Sieic
ExitReasonS390Reset
ExitReasonDcr
ExitReasonNmi
ExitReasonInternalError
ExitReasonOsi
ExitReasonPaprHcall
ExitReasonS390Ucontrol
ExitReasonWatchdog
ExitReasonS390Tsch
ExitReasonEpr
ExitReasonSystemEvent
ExitReasonS390Stsi
ExitReasonIoapicEoi
ExitReasonHyperv
)
type IODirection uint8
const (
IODirectionIn IODirection = 0
IODirectionOut IODirection = 1
)
type ExitIO struct {
Direction IODirection
Size uint8
Port uint16
Count uint32
DataOffset uint64
}
type ExitUnknown struct {
HardwareExitReason uint64
}
type ExitFailEntry struct {
HardwareEntryFailureReason uint64
}
type ExitException struct {
Exception uint32
ErrorCode uint32
}
type ExitInternalError struct {
Suberror uint32
Ndata uint32
Data [16]uint64
}
func (c *VCPU) Run() (ExitReason, error) {
_, err := osIoctl.ioctl(c.Fd, ioctlKVMRun, 0)
return ExitReason(c.run.exitReason), err
}
func (c *VCPU) ExitUnknown() ExitUnknown {
return c.run.exitUnknown()
}
func (c *VCPU) ExitException() ExitException {
return c.run.exitException()
}
func (c *VCPU) ExitIO() ExitIO {
return c.run.exitIO()
}
func (c *VCPU) ExitIOData() []byte {
return c.run.exitIOData()
}
func (c *VCPU) ExitFailEntry() ExitFailEntry {
return c.run.exitFailEntry()
}
func (c *VCPU) ExitInternalError() ExitInternalError {
return c.run.exitInternalError()
}