| 115 | return self.__kb.KbResetIopl() |
| 116 | |
| 117 | class CPU: |
| 118 | class CpuidInfo(Structure): |
| 119 | _fields_ = [("EAX", c_uint), |
| 120 | ("EBX", c_uint), |
| 121 | ("ECX", c_uint), |
| 122 | ("EDX", c_uint)] |
| 123 | |
| 124 | def __init__(self, kb): |
| 125 | self.__kb = kb |
| 126 | |
| 127 | def cli(self): |
| 128 | return self.__kb.KbCli() |
| 129 | |
| 130 | def sti(self): |
| 131 | return self.__kb.KbSti() |
| 132 | |
| 133 | def hlt(self): |
| 134 | return self.__kb.KbHlt() |
| 135 | |
| 136 | def rdmsr(self, index): |
| 137 | value = c_uint64() |
| 138 | status = self.__kb.KbReadMsr(c_uint(index), byref(value)) |
| 139 | return status, value |
| 140 | |
| 141 | def wrmsr(self, index, value): |
| 142 | return self.__kb.KbWriteMsr(c_uint(index), c_uint64(value)) |
| 143 | |
| 144 | def cpuid(self, function_id_eax): |
| 145 | info = self.CpuidInfo() |
| 146 | status = self.__kb.KbCpuid(c_uint(function_id_eax), byref(info)) |
| 147 | return status, info |
| 148 | |
| 149 | def cpuidex(self, function_id_eax, subfunction_id_ecx): |
| 150 | info = self.CpuidInfo() |
| 151 | status = self.__kb.KbCpuidEx(c_uint(function_id_eax), c_uint(subfunction_id_ecx), byref(info)) |
| 152 | return status, info |
| 153 | |
| 154 | def rdpmc(self, index): |
| 155 | value = c_uint64() |
| 156 | status = self.__kb.KbReadPmc(c_uint(index), byref(value)) |
| 157 | return status, value |
| 158 | |
| 159 | def rdtsc(self): |
| 160 | value = c_uint64() |
| 161 | status = self.__kb.KbReadTsc(byref(value)) |
| 162 | return status, value |
| 163 | |
| 164 | def rdtscp(self): |
| 165 | value = c_uint64() |
| 166 | aux = c_uint() |
| 167 | status = self.__kb.KbReadTsc(byref(value), byref(aux)) |
| 168 | return status, value, aux |
| 169 | |
| 170 | class VirtualMemory: |
| 171 | def __init__(self, kb): |
nothing calls this directly
no outgoing calls
no test coverage detected