Xen Test Framework
Data Structures | Typedefs | Functions
msr.h File Reference

Model Specific Register mnemonics and bit definitions. More...

#include <xtf/extable.h>
#include <xtf/types.h>
#include <xen/arch-x86/xen.h>
#include <arch/msr-index.h>
+ Include dependency graph for msr.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  msr_feature_control
 
union  msr_vmx_basic
 
struct  xtf_msr_consistency_test_data
 
struct  xtf_msr_consistency_test_data::xtf_msr_consistency_test_vals
 

Typedefs

typedef union msr_feature_control msr_feature_control_t
 
typedef union msr_vmx_basic msr_vmx_basic_t
 

Functions

static uint64_t rdmsr (uint32_t idx)
 Thin wrapper around an rdmsr instruction. More...
 
static bool rdmsr_safe (uint32_t idx, uint64_t *val)
 Wrapper around rdmsr which safely catches #GP[0]. More...
 
static void wrmsr (uint32_t idx, uint64_t val)
 Thin wrapper around an wrmsr instruction. More...
 
static bool wrmsr_safe (uint32_t idx, uint64_t val)
 Wrapper around wrmsr which safely catches #GP[0]. More...
 
void xtf_msr_consistency_test (const struct xtf_msr_consistency_test_data *t)
 Run consistency tests as described by t. More...
 

Detailed Description

Model Specific Register mnemonics and bit definitions.

Misc C-level infrastructure for MSRs.

Definition in file msr.h.

Typedef Documentation

◆ msr_feature_control_t

◆ msr_vmx_basic_t

Function Documentation

◆ rdmsr()

static uint64_t rdmsr ( uint32_t  idx)
inlinestatic

Thin wrapper around an rdmsr instruction.

May crash with #GP[0].

Definition at line 19 of file msr.h.

+ Here is the caller graph for this function:

◆ rdmsr_safe()

static bool rdmsr_safe ( uint32_t  idx,
uint64_t val 
)
inlinestatic

Wrapper around rdmsr which safely catches #GP[0].

Parameters
idxMSR to read
[out]valValue, if no fault occurred.
Returns
boolean indicating whether the read faulted.

Definition at line 35 of file msr.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wrmsr()

static void wrmsr ( uint32_t  idx,
uint64_t  val 
)
inlinestatic

Thin wrapper around an wrmsr instruction.

May crash with #GP[0].

Definition at line 55 of file msr.h.

+ Here is the caller graph for this function:

◆ wrmsr_safe()

static bool wrmsr_safe ( uint32_t  idx,
uint64_t  val 
)
inlinestatic

Wrapper around wrmsr which safely catches #GP[0].

Parameters
idxMSR to write
valValue to write
Returns
boolean indicating whether the write faulted.

Definition at line 69 of file msr.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xtf_msr_consistency_test()

void xtf_msr_consistency_test ( const struct xtf_msr_consistency_test_data t)

Run consistency tests as described by t.

Some MSRs may be passed directly through to guests for performance reasons. This introduces an extra level of complexity for context switching an emulation purposes.

To check that synchronisation is working properly, t describes an MSR and an array of predicated values. For each value where the predicate is true, mix regular and forced reads and writes to check that values written via one mechanism become visible via the other.

This logic is only applicable to read/write MSRs which expect to retain their written values on subsequent reads, and for values which will succeed when written.

Definition at line 29 of file msr.c.

+ Here is the call graph for this function: