NOVA User-Level Environment  Version testbox/changed-memory-timing-317-g320d8b5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InstructionCache Class Reference

An instruction cache that keeps decoded instructions. More...

#include <instcache.h>

Inheritance diagram for InstructionCache:
MemTlb MemCache Halifax

Classes

struct  Descriptor

Private Types

enum  EFLAGS {
  EFL_ZF = 1 << 6, EFL_TF = 1 << 8, EFL_IF = 1 << 9, EFL_OF = 1 << 11,
  EFL_IOPL = 3 << 12, EFL_NT = 1 << 14, EFL_RF = 1 << 16, EFL_VM = 1 << 17,
  EFL_AC = 1 << 18, EFL_VIF = 1 << 19, EFL_VIP = 1 << 20
}
enum  {
  IC_ASM = 1 << 0, IC_SAVEFLAGS = 1 << 1, IC_LOADFLAGS = 1 << 2, IC_MODRM = 1 << 3,
  IC_DIRECTION = 1 << 4, IC_READONLY = 1 << 5, IC_BYTE = 1 << 6, IC_LOCK = 1 << 7,
  IC_BITS = 1 << 8, IC_RMW = 1 << 9, IC_MOFS = 1 << 10
}
enum  { SIZE = 64, ASSOZ = 4 }

Private Member Functions

unsigned slot (unsigned tag)
unsigned _fpustate[512/sizeof(unsigned)] __attribute__ ((aligned(16)))
int send_message (CpuMessage::Type type)
int event_injection ()
int fetch_code (InstructionCacheEntry *entry, unsigned len)
 Fetch code.
bool find_entry (unsigned &index)
 Find a cache entry for the given state and checks whether it is still valid.
int get_modrm ()
 Fetch the modrm byte including sib byte and displacement.
int cpl0_test ()
 Check whether CPL0 is required.
int handle_segment (CpuState::Descriptor *desc, unsigned &virt, unsigned length, bool write, bool stackop)
 Add base and check segment type and limit.
template<unsigned operand_size>
int logical_mem (CpuState::Descriptor *desc, unsigned virt, bool write, void *&res, bool stackop=false)
template<unsigned operand_size>
int helper_JMP_absolute (unsigned nrip)
 Perform an absolute JMP.
template<unsigned feature, unsigned operand_size>
int __attribute__ ((regparm(3))) string_helper()
int helper_MOV__CR0__EDX ()
 Move from control register.
int helper_MOV__EDX__CR0 ()
 Move to control register.
int helper_LMSW (unsigned short value)
int desc_get_base (unsigned short selector, unsigned long &base, bool ext)
int load_gdt_descriptor (Descriptor &desc, unsigned short selector, bool ext)
int load_idt_descriptor (Descriptor &desc, unsigned event)
int desc_set_flag (Descriptor &desc, unsigned short selector, unsigned char flag, bool ext)
int helper_LTR (unsigned short selector)
int helper_LLDT (unsigned short selector)
int set_segment (CpuState::Descriptor *seg, unsigned short sel, bool cplcheck=true)
int helper_far_jmp (unsigned tmp_cs, unsigned tmp_eip, unsigned tmp_flag)
template<unsigned operand_size, bool lcall>
int helper_lcall (void *tmp_src)
template<unsigned operand_size>
int helper_LJMP (void *tmp_src)
template<unsigned operand_size>
int helper_LCALL (void *tmp_src)
template<unsigned operand_size>
int helper_IRET ()
int idt_traversal (unsigned event, unsigned error_code)
int helper_INT (unsigned char vector)
int helper_INVLPG ()
int helper_FWAIT ()
int helper_MOV__DB0__EDX ()
int helper_MOV__EDX__DB0 ()
int helper_FXSAVE ()
 fxsave.
int helper_FRSTOR ()
void helper_AAM (unsigned char imm)
void helper_AAD (unsigned char imm)
void helper_XLAT ()
template<unsigned operand_size>
void helper_ENTER (unsigned *imm)
int helper_SYSENTER ()
 sysenter.
int helper_SYSEXIT ()
 sysexit.
int helper_CLI ()
 cli.
int helper_STI ()
 sti.
template<unsigned operand_size>
void __attribute__ ((regparm(3))) helper_LEA()
 lea.
template<unsigned operand_size>
int helper_loadsegment (CpuState::Descriptor *desc)
 lds, les, lfs, lgs, lss.
 _values ()
 _vcpu (vcpu)

Static Private Member Functions

static void move (void *tmp_dst, void *tmp_src, unsigned order)
template<unsigned operand_size>
static void move (void *tmp_dst, void *tmp_src)
template<unsigned operand_size>
static int __attribute__ ((regparm(3))) helper_JMP_static(InstructionCache *cache
static void set_realmode_segment (CpuState::Descriptor *seg, unsigned short sel, bool v86mode)
static void __attribute__ ((regparm(3))) exec_00_add_0(InstructionCache *cache

Private Attributes

unsigned _pos
unsigned _tags [SIZE *ASSOZ]
InstructionCacheEntry _values [SIZE *ASSOZ]
VCpu_vcpu
InstructionCacheEntry_entry
unsigned _oeip
unsigned _oesp
unsigned _ointr_state
unsigned _dr6
unsigned _dr [4]
static void void * tmp_src

Additional Inherited Members

- Public Types inherited from MemCache
enum  Type {
  TYPE_R = 1u << 0, TYPE_W = 1u << 1, TYPE_RMW = TYPE_R | TYPE_W, TYPE_U = 1u << 2,
  TYPE_RES = 1u << 3, TYPE_X = 1u << 4
}
- Public Member Functions inherited from MemCache
CacheEntryget (unsigned long phys1, unsigned long phys2, unsigned len, Type type)
 Get an entry from the cache or fetch one from memory.
void invalidate (bool writeback)
 Invalidate the cache, thus writeback the buffers.
 MemCache (DBus< MessageMem > &mem, DBus< MessageMemRegion > &memregion)
- Public Attributes inherited from MemCache
bool debug
CacheEntry _values [ASSOZ]
unsigned _newest
- Protected Member Functions inherited from MemTlb
Type user_access (Type type)
int init ()
int read_code (unsigned long virt, unsigned len, void *buffer)
 Read the len instruction-bytes at the given address into a buffer.
int prepare_virtual (unsigned virt, unsigned len, Type type, void *&ptr)
 MemTlb (DBus< MessageMem > &mem, DBus< MessageMemRegion > &memregion)
- Protected Attributes inherited from MemTlb
CpuState_cpu

Detailed Description

An instruction cache that keeps decoded instructions.

Member Enumeration Documentation

anonymous enum
private
Enumerator:
IC_ASM 
IC_SAVEFLAGS 
IC_LOADFLAGS 
IC_MODRM 
IC_DIRECTION 
IC_READONLY 
IC_BYTE 
IC_LOCK 
IC_BITS 
IC_RMW 
IC_MOFS 
anonymous enum
private
Enumerator:
SIZE 
ASSOZ 
Enumerator:
EFL_ZF 
EFL_TF 
EFL_IF 
EFL_OF 
EFL_IOPL 
EFL_NT 
EFL_RF 
EFL_VM 
EFL_AC 
EFL_VIF 
EFL_VIP 

Member Function Documentation

static void InstructionCache::__attribute__ ( (regparm(3))  )
staticprivate
template<unsigned operand_size>
void InstructionCache::__attribute__ ( (regparm(3))  )
inlineprivate

lea.

state: stable doc: intel

template<unsigned operand_size>
static int InstructionCache::__attribute__ ( (regparm(3))  )
staticprivate
unsigned _fpustate [512/sizeof(unsigned)] InstructionCache::__attribute__ ( (aligned(16))  )
private
template<unsigned feature, unsigned operand_size>
int InstructionCache::__attribute__ ( (regparm(3))  )
inlineprivate
InstructionCache::_values ( )
private
InstructionCache::_vcpu ( vcpu  )
inlineprivate
int InstructionCache::cpl0_test ( )
inlineprivate

Check whether CPL0 is required.

int InstructionCache::desc_get_base ( unsigned short  selector,
unsigned long &  base,
bool  ext 
)
inlineprivate
int InstructionCache::desc_set_flag ( Descriptor desc,
unsigned short  selector,
unsigned char  flag,
bool  ext 
)
inlineprivate
int InstructionCache::event_injection ( )
inlineprivate
int InstructionCache::fetch_code ( InstructionCacheEntry entry,
unsigned  len 
)
inlineprivate

Fetch code.

bool InstructionCache::find_entry ( unsigned &  index)
inlineprivate

Find a cache entry for the given state and checks whether it is still valid.

int InstructionCache::get_modrm ( )
inlineprivate

Fetch the modrm byte including sib byte and displacement.

int InstructionCache::handle_segment ( CpuState::Descriptor desc,
unsigned &  virt,
unsigned  length,
bool  write,
bool  stackop 
)
inlineprivate

Add base and check segment type and limit.

void InstructionCache::helper_AAD ( unsigned char  imm)
inlineprivate
void InstructionCache::helper_AAM ( unsigned char  imm)
inlineprivate
int InstructionCache::helper_CLI ( )
inlineprivate

cli.

state: stable doc: intel, amd

template<unsigned operand_size>
void InstructionCache::helper_ENTER ( unsigned *  imm)
inlineprivate
int InstructionCache::helper_far_jmp ( unsigned  tmp_cs,
unsigned  tmp_eip,
unsigned  tmp_flag 
)
inlineprivate
int InstructionCache::helper_FRSTOR ( )
inlineprivate
int InstructionCache::helper_FWAIT ( )
inlineprivate
int InstructionCache::helper_FXSAVE ( )
inlineprivate

fxsave.

Missing: #AC for unaligned access

int InstructionCache::helper_INT ( unsigned char  vector)
inlineprivate
int InstructionCache::helper_INVLPG ( )
inlineprivate
template<unsigned operand_size>
int InstructionCache::helper_IRET ( )
inlineprivate
template<unsigned operand_size>
int InstructionCache::helper_JMP_absolute ( unsigned  nrip)
inlineprivate

Perform an absolute JMP.

template<unsigned operand_size, bool lcall>
int InstructionCache::helper_lcall ( void *  tmp_src)
inlineprivate
template<unsigned operand_size>
int InstructionCache::helper_LCALL ( void *  tmp_src)
inlineprivate
template<unsigned operand_size>
int InstructionCache::helper_LJMP ( void *  tmp_src)
inlineprivate
int InstructionCache::helper_LLDT ( unsigned short  selector)
inlineprivate
int InstructionCache::helper_LMSW ( unsigned short  value)
inlineprivate
template<unsigned operand_size>
int InstructionCache::helper_loadsegment ( CpuState::Descriptor desc)
inlineprivate

lds, les, lfs, lgs, lss.

state: testing doc: intel

int InstructionCache::helper_LTR ( unsigned short  selector)
inlineprivate
int InstructionCache::helper_MOV__CR0__EDX ( )
inlineprivate

Move from control register.

int InstructionCache::helper_MOV__DB0__EDX ( )
inlineprivate
int InstructionCache::helper_MOV__EDX__CR0 ( )
inlineprivate

Move to control register.

int InstructionCache::helper_MOV__EDX__DB0 ( )
inlineprivate
int InstructionCache::helper_STI ( )
inlineprivate

sti.

state: stable doc: intel, amd

int InstructionCache::helper_SYSENTER ( )
inlineprivate

sysenter.

state: stable doc: intel

int InstructionCache::helper_SYSEXIT ( )
inlineprivate

sysexit.

state: stable doc: intel

void InstructionCache::helper_XLAT ( )
inlineprivate
int InstructionCache::idt_traversal ( unsigned  event,
unsigned  error_code 
)
inlineprivate
int InstructionCache::load_gdt_descriptor ( Descriptor desc,
unsigned short  selector,
bool  ext 
)
inlineprivate
int InstructionCache::load_idt_descriptor ( Descriptor desc,
unsigned  event 
)
inlineprivate
template<unsigned operand_size>
int InstructionCache::logical_mem ( CpuState::Descriptor desc,
unsigned  virt,
bool  write,
void *&  res,
bool  stackop = false 
)
inlineprivate
static void InstructionCache::move ( void *  tmp_dst,
void *  tmp_src,
unsigned  order 
)
inlinestaticprivate
template<unsigned operand_size>
static void InstructionCache::move ( void *  tmp_dst,
void *  tmp_src 
)
inlinestaticprivate
int InstructionCache::send_message ( CpuMessage::Type  type)
inlineprivate
static void InstructionCache::set_realmode_segment ( CpuState::Descriptor seg,
unsigned short  sel,
bool  v86mode 
)
inlinestaticprivate
int InstructionCache::set_segment ( CpuState::Descriptor seg,
unsigned short  sel,
bool  cplcheck = true 
)
inlineprivate
unsigned InstructionCache::slot ( unsigned  tag)
inlineprivate

Member Data Documentation

unsigned InstructionCache::_dr[4]
private
unsigned InstructionCache::_dr6
private
InstructionCacheEntry* InstructionCache::_entry
private
unsigned InstructionCache::_oeip
private
unsigned InstructionCache::_oesp
private
unsigned InstructionCache::_ointr_state
private
unsigned InstructionCache::_pos
private
unsigned InstructionCache::_tags[SIZE *ASSOZ]
private
InstructionCacheEntry InstructionCache::_values[SIZE *ASSOZ]
private
VCpu* InstructionCache::_vcpu
private
void void* InstructionCache::tmp_src
private

The documentation for this class was generated from the following files: