Classes | |
struct | Descriptor |
Defines | |
#define | MOVE2(operand_size, DST, SRC) |
#define | helper_LOOPS(NAME, X) |
#define | helper_LDT(NAME, VAR, MTD) |
#define | helper_SDT(NAME, VAR, MTD) |
#define | NCHECK(X) { if (X) break; } |
#define | FEATURE(X, Y) { if (feature & (X)) Y; } |
#define | MOVE2(operand_size, DST, SRC) |
Move. | |
#define | helper_LOOPS(NAME, X) |
#define | helper_LDT(NAME, VAR, MTD) |
#define | helper_SDT(NAME, VAR, MTD) |
#define | NCHECK(X) { if (X) break; } |
#define | FEATURE(X, Y) { if (feature & (X)) Y; } |
Functions | |
int | cpl0_test () |
Instruction helper. | |
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) |
#define FEATURE | ( | X, | ||
Y | ||||
) | { if (feature & (X)) Y; } |
#define FEATURE | ( | X, | ||
Y | ||||
) | { if (feature & (X)) Y; } |
#define helper_LDT | ( | NAME, | ||
VAR, | ||||
MTD | ||||
) |
template<unsigned operand_size> \ void __attribute__((regparm(3))) \ helper_##NAME() \ { \ void *addr; \ if (!modrm2mem(addr, 6, user_access(TYPE_R))) \ { \ unsigned base; \ move<1>(&_cpu->VAR.limit, addr); \ move<2>(&base, reinterpret_cast<char *>(addr)+2); \ if (operand_size == 1) base &= 0x00ffffff; \ _cpu->VAR.base = base; \ _mtr_out |= MTD; \ } \ }
#define helper_LDT | ( | NAME, | ||
VAR, | ||||
MTD | ||||
) |
template<unsigned operand_size> \ void __attribute__((regparm(3))) \ helper_##NAME() \ { \ void *addr; \ if (!modrm2mem(addr, 6, user_access(TYPE_R))) \ { \ unsigned base; \ move<1>(&_cpu->VAR.limit, addr); \ move<2>(&base, reinterpret_cast<char *>(addr)+2); \ if (operand_size == 1) base &= 0x00ffffff; \ _cpu->VAR.base = base; \ _mtr_out |= MTD; \ } \ }
#define helper_LOOPS | ( | NAME, | ||
X | ||||
) |
template<unsigned operand_size> \ void __attribute__((regparm(3))) __attribute__((noinline)) \ helper_##NAME(void *tmp_src) \ { \ unsigned ecx = 0; \ MOVE2(operand_size, ecx, _cpu->ecx); \ if (X != 3) --ecx; \ if ((ecx && (X==0 || (X==1 && _cpu->efl & 0x40) || (X==2 && ~_cpu->efl & 0x40))) || (!ecx && X == 3)) \ if (helper_JMP<operand_size>(tmp_src)) \ return; \ MOVE2(operand_size, _cpu->ecx, ecx); \ }
#define helper_LOOPS | ( | NAME, | ||
X | ||||
) |
template<unsigned operand_size> \ void __attribute__((regparm(3))) __attribute__((noinline)) \ helper_##NAME(void *tmp_src) \ { \ unsigned ecx = 0; \ MOVE2(operand_size, ecx, _cpu->ecx); \ if (X != 3) --ecx; \ if ((ecx && (X==0 || (X==1 && _cpu->efl & 0x40) || (X==2 && ~_cpu->efl & 0x40))) || (!ecx && X == 3)) \ if (helper_JMP<operand_size>(tmp_src)) \ return; \ MOVE2(operand_size, _cpu->ecx, ecx); \ }
#define helper_SDT | ( | NAME, | ||
VAR, | ||||
MTD | ||||
) |
template<unsigned operand_size> \ void __attribute__((regparm(3))) \ helper_##NAME() \ { \ _mtr_in |= MTD; \ void *addr; \ if (!modrm2mem(addr, 6, user_access(TYPE_W))) \ { \ unsigned base = _cpu->VAR.base; \ if (operand_size == 1) base &= 0x00ffffff; \ move<1>(addr, &_cpu->VAR.limit); \ move<2>(reinterpret_cast<char *>(addr)+2, &base); \ } \ }
#define helper_SDT | ( | NAME, | ||
VAR, | ||||
MTD | ||||
) |
template<unsigned operand_size> \ void __attribute__((regparm(3))) \ helper_##NAME() \ { \ _mtr_in |= MTD; \ void *addr; \ if (!modrm2mem(addr, 6, user_access(TYPE_W))) \ { \ unsigned base = _cpu->VAR.base; \ if (operand_size == 1) base &= 0x00ffffff; \ move<1>(addr, &_cpu->VAR.limit); \ move<2>(reinterpret_cast<char *>(addr)+2, &base); \ } \ }
#define MOVE2 | ( | operand_size, | ||
DST, | ||||
SRC | ||||
) |
{ \ if (operand_size == 0) DST = (DST & ~0xff) | (SRC & 0xff); \ if (operand_size == 1) DST = (DST & ~0xffff) | (SRC & 0xffff); \ if (operand_size == 2) DST = SRC; \ }
#define MOVE2 | ( | operand_size, | ||
DST, | ||||
SRC | ||||
) |
{ \ if (operand_size == 0) DST = (DST & ~0xff) | (SRC & 0xff); \ if (operand_size == 1) DST = (DST & ~0xffff) | (SRC & 0xffff); \ if (operand_size == 2) DST = SRC; \ }
Move.
#define NCHECK | ( | X | ) | { if (X) break; } |
#define NCHECK | ( | X | ) | { if (X) break; } |
int __attribute__ | ( | (regparm(3)) | ) |
int cpl0_test | ( | ) |
Instruction helper.
Copyright (C) 2009-2010, Bernhard Kauer <bk@vmmon.org> Economic rights: Technische Universitaet Dresden (Germany)
This file is part of Vancouver.
Vancouver is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
Vancouver is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details. Check whether CPL0 is required.
int desc_get_base | ( | unsigned short | selector, | |
unsigned long & | base, | |||
bool | ext | |||
) |
int desc_set_flag | ( | Descriptor & | desc, | |
unsigned short | selector, | |||
unsigned char | flag, | |||
bool | ext | |||
) |
int handle_segment | ( | CpuState::Descriptor * | desc, | |
unsigned & | virt, | |||
unsigned | length, | |||
bool | write, | |||
bool | stackop | |||
) |
Add base and check segment type and limit.
void helper_AAD | ( | unsigned char | imm | ) |
void helper_AAM | ( | unsigned char | imm | ) |
void helper_ENTER | ( | unsigned * | imm | ) |
int helper_far_jmp | ( | unsigned | tmp_cs, | |
unsigned | tmp_eip, | |||
unsigned | tmp_flag | |||
) |
int helper_FRSTOR | ( | ) |
int helper_FWAIT | ( | ) |
int helper_FXSAVE | ( | ) |
fxsave.
Missing: AC for unaligned access
int helper_INT | ( | unsigned char | vector | ) |
int helper_INVLPG | ( | ) |
int helper_IRET | ( | ) |
int helper_JMP_absolute | ( | unsigned | nrip | ) |
Perform an absolute JMP.
int helper_lcall | ( | void * | tmp_src | ) |
int helper_LCALL | ( | void * | tmp_src | ) |
int helper_LJMP | ( | void * | tmp_src | ) |
int helper_LLDT | ( | unsigned short | selector | ) |
int helper_LMSW | ( | unsigned short | value | ) |
int helper_LTR | ( | unsigned short | selector | ) |
int helper_MOV__CR0__EDX | ( | ) |
Move from control register.
int helper_MOV__DB0__EDX | ( | ) |
int helper_MOV__EDX__CR0 | ( | ) |
Move to control register.
int helper_MOV__EDX__DB0 | ( | ) |
void helper_XLAT | ( | ) |
int idt_traversal | ( | unsigned | event, | |
unsigned | error_code | |||
) |
int load_gdt_descriptor | ( | Descriptor & | desc, | |
unsigned short | selector, | |||
bool | ext | |||
) |
int load_idt_descriptor | ( | Descriptor & | desc, | |
unsigned | event | |||
) |
int logical_mem | ( | CpuState::Descriptor * | desc, | |
unsigned | virt, | |||
bool | write, | |||
void *& | res, | |||
bool | stackop = false | |||
) |
int set_segment | ( | CpuState::Descriptor * | seg, | |
unsigned short | sel, | |||
bool | cplcheck = true | |||
) |