Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215795
b: refs/heads/master
c: f6b3597
h: refs/heads/master
i:
  215793: 7af094e
  215791: 36af777
v: v3
  • Loading branch information
Avi Kivity committed Oct 24, 2010
1 parent e9a0230 commit dd8d629
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 739ae406068211b235b488f247aab349e486c382
refs/heads/master: f6b3597bded9ed261b42fdcb5e741489cb5ccbfe
43 changes: 43 additions & 0 deletions trunk/arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,27 @@ struct group_dual {
"a" (_rax), "d" (_rdx)); \
} while (0)

#define __emulate_1op_rax_rdx_ex(_op, _src, _rax, _rdx, _eflags, _suffix, _ex) \
do { \
unsigned long _tmp; \
\
__asm__ __volatile__ ( \
_PRE_EFLAGS("0", "5", "1") \
"1: \n\t" \
_op _suffix " %6; " \
"2: \n\t" \
_POST_EFLAGS("0", "5", "1") \
".pushsection .fixup,\"ax\" \n\t" \
"3: movb $1, %4 \n\t" \
"jmp 2b \n\t" \
".popsection \n\t" \
_ASM_EXTABLE(1b, 3b) \
: "=m" (_eflags), "=&r" (_tmp), \
"+a" (_rax), "+d" (_rdx), "+qm"(_ex) \
: "i" (EFLAGS_MASK), "m" ((_src).val), \
"a" (_rax), "d" (_rdx)); \
} while (0)

/* instruction has only one source operand, destination is implicit (e.g. mul, div, imul, idiv) */
#define emulate_1op_rax_rdx(_op, _src, _rax, _rdx, _eflags) \
do { \
Expand All @@ -342,6 +363,28 @@ struct group_dual {
} \
} while (0)

#define emulate_1op_rax_rdx_ex(_op, _src, _rax, _rdx, _eflags, _ex) \
do { \
switch((_src).bytes) { \
case 1: \
__emulate_1op_rax_rdx_ex(_op, _src, _rax, _rdx, \
_eflags, "b", _ex); \
break; \
case 2: \
__emulate_1op_rax_rdx_ex(_op, _src, _rax, _rdx, \
_eflags, "w", _ex); \
break; \
case 4: \
__emulate_1op_rax_rdx_ex(_op, _src, _rax, _rdx, \
_eflags, "l", _ex); \
break; \
case 8: ON64( \
__emulate_1op_rax_rdx_ex(_op, _src, _rax, _rdx, \
_eflags, "q", _ex)); \
break; \
} \
} while (0)

/* Fetch next part of the instruction being emulated. */
#define insn_fetch(_type, _size, _eip) \
({ unsigned long _x; \
Expand Down

0 comments on commit dd8d629

Please sign in to comment.