|
libintrovirt v0.57.4
IntroVirt introspection library
|
A class representing a single virtual processor. More...
#include <Vcpu.hh>
Public Member Functions | |
| virtual Registers & | registers ()=0 |
| Get the processor's registers. | |
| virtual const Registers & | registers () const =0 |
| Get the processor's registers. | |
| virtual bool | long_mode () const =0 |
| Check if the processor is in long mode. | |
| virtual bool | long_compatibility_mode () const =0 |
| Check if the processor is currently in long compatibility mode. | |
| virtual void | pause ()=0 |
| Pause this vcpu. | |
| virtual void | resume ()=0 |
| Resume this vcpu. | |
| virtual void | intercept_system_calls (bool enabled)=0 |
| Toggle system call interception for this VCPU. | |
| virtual bool | intercept_system_calls () const =0 |
| Check if system call interception is enabled. | |
| virtual void | intercept_cr_writes (int cr, bool enabled)=0 |
| Toggle control register write interception. | |
| virtual bool | intercept_cr_writes (int cr) const =0 |
| Check if writes to the control register are being intercepted. | |
| virtual void | inject_exception (x86::Exception vector)=0 |
| Inject an exception for this vcpu. | |
| virtual void | inject_exception (x86::Exception vector, int64_t error_code)=0 |
| Inject an exception for this vcpu. | |
| virtual void | inject_exception (x86::Exception vector, int64_t error_code, uint64_t cr2)=0 |
| Inject an exception for this vcpu. | |
| virtual void | inject_syscall ()=0 |
| Inject a SYSCALL instruction into the VCPU. | |
| virtual void | inject_sysenter ()=0 |
| Inject a SYSCALL instruction into the VCPU. | |
| virtual std::unique_ptr< Vcpu > | clone () const =0 |
| Create a clone of this VCPU. | |
| virtual bool | handling_event () const =0 |
| Check if the vcpu is currently being used by an active event. | |
| virtual SystemCallFilter & | system_call_filter ()=0 |
| Get the system call filter for this vcpu. | |
| virtual const SystemCallFilter & | system_call_filter () const =0 |
| Get the system call filter for this vcpu. | |
| virtual uint32_t | id () const =0 |
| Get the number of this Vcpu. | |
| virtual Domain & | domain ()=0 |
| Get the domain associated with this Vcpu. | |
| virtual const Domain & | domain () const =0 |
| Get the domain associated with this Vcpu. | |
| virtual x86::Segment | segment (x86::SegmentSelector selector) const =0 |
| Get a segement descriptor given the current selector. | |
| virtual x86::SegmentDescriptorTable | global_descriptor_table () const =0 |
| Gets the Global Descriptor Table (GDT) for this VCPU. | |
| virtual x86::SegmentDescriptorTable | local_descriptor_table () const =0 |
| Gets the active Local Descriptor Table (LDT) for this VCPU. | |
| virtual std::unique_ptr< const x86::Idt > | interrupt_descriptor_table () const =0 |
| Gets the Interrupt Descriptor Table (IDT) for this VCPU. | |
| virtual const x86::Tss & | task_state_segment () const =0 |
| Get the x86 Task State Segment (TSS) | |
| virtual void | os_data (void *data)=0 |
| Set OS-specific data for address translation. | |
| virtual void * | os_data () const =0 |
| Get OS-specific data for address translation. | |
| virtual | ~Vcpu ()=default |
| Destroy the instance. | |
A class representing a single virtual processor.
It is subclassed for specific hypervisors, such as the KvmVcpu and the XenVcpu.
|
virtualdefault |
Destroy the instance.
|
pure virtual |
Create a clone of this VCPU.
A cloned VCPU will not be able to change guest state. It is mainly used when a copy is necessary for address translation.
|
pure virtual |
|
pure virtual |
|
pure virtual |
Gets the Global Descriptor Table (GDT) for this VCPU.
|
pure virtual |
Check if the vcpu is currently being used by an active event.
|
pure virtual |
|
pure virtual |
Inject an exception for this vcpu.
| vector | The exception type to inject |
| CommandFailedException | If the hypervisor reports an error |
|
pure virtual |
Inject an exception for this vcpu.
| vector | The exception type to inject |
| CommandFailedException | If the hypervisor reports an error |
| error_code | The error code to deliver |
|
pure virtual |
Inject an exception for this vcpu.
| vector | The exception type to inject |
| CommandFailedException | If the hypervisor reports an error |
| error_code | The error code to deliver |
| cr2 | The cr2 value to set (only for x86::Exception::PAGE_FAULT) |
|
pure virtual |
Inject a SYSCALL instruction into the VCPU.
You probably don't want to call this yourself.
|
pure virtual |
Inject a SYSCALL instruction into the VCPU.
You probably don't want to call this yourself.
|
pure virtual |
Check if writes to the control register are being intercepted.
| cr | The control register to check |
|
pure virtual |
Toggle control register write interception.
| cr | The control register to toggle interception for |
| enabled | If set to true, writes to the given control register will be intercepted |
| NotImplementedException | if writes to the given CR cannot be intercepted |
| CommandFailedException | If the hypervisor reports an error |
|
pure virtual |
Check if system call interception is enabled.
|
pure virtual |
Toggle system call interception for this VCPU.
Enables events of type EVENT_FAST_SYSCALL and EVENT_FAST_SYSCALL_RET.
When system call interception is enabled, SYSCALL/SYSENTER instructions are intercepted by the hypervisor. If the call number matches our SystemCallFilter (or the filter is disabled), a EVENT_FAST_SYSCALL event will be delivered.
While enabled, the hypervisor also intercept all SYSRET/SYSEXIT instructions.
| enabled | If set to true, system calls and returns that match our filters will be intercepted. |
| NotImplementedException | if system call hooking is not supported |
| CommandFailedException | If the hypervisor reports an error |
|
pure virtual |
Gets the Interrupt Descriptor Table (IDT) for this VCPU.
|
pure virtual |
Gets the active Local Descriptor Table (LDT) for this VCPU.
|
pure virtual |
Check if the processor is currently in long compatibility mode.
This occurs when the processor is in 64-bit mode, but in a 32-bit code segment.
|
pure virtual |
Check if the processor is in long mode.
|
pure virtual |
Get OS-specific data for address translation.
|
pure virtual |
Set OS-specific data for address translation.
| data | The OS-specific data to set |
|
pure virtual |
Pause this vcpu.
This is implemented by tracking pause count. Every pause() increments the value, and resume() decrements.
The vcpu is paused when the count goes from 0 to 1. The vcpu is unpaused when the count reaches 0.
| CommandFailedException | If the hypervisor reports an error |
|
pure virtual |
Get the processor's registers.
|
pure virtual |
Get the processor's registers.
|
pure virtual |
Resume this vcpu.
This is implemented by tracking pause count. Every pause() increments the value, and resume() decrements.
The vcpu is paused when the count goes from 0 to 1. The vcpu is unpaused when the count reaches 0.
| CommandFailedException | If the hypervisor reports an error |
|
pure virtual |
Get a segement descriptor given the current selector.
Check the GDT or LDT for the correct segment descriptor
| selector |
|
pure virtual |
Get the system call filter for this vcpu.
This is the vcpu-level system call filter.
If enabled, it will be checked first for a system call match. If a match occurs, the event is delivered.
If no match occurs, the domain-level filter will be checked if it is enabled.
|
pure virtual |
Get the system call filter for this vcpu.
This is the vcpu-level system call filter.
If enabled, it will be checked first for a system call match. If a match occurs, the event is delivered.
If no match occurs, the domain-level filter will be checked if it is enabled.
|
pure virtual |