* [Qemu-devel] [patch] use gen_update_cc_op()
@ 2010-07-25 3:30 Jun Koi
2010-07-25 15:14 ` Aurelien Jarno
0 siblings, 1 reply; 2+ messages in thread
From: Jun Koi @ 2010-07-25 3:30 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 146 bytes --]
this patch simplifies target-i386/translate.c a bit by replacing some
code with gen_update_cc_op()
Signed-off-by: Jun Koi <junkoi2004@gmail.com>
[-- Attachment #2: patch2.diff --]
[-- Type: text/x-patch, Size: 4070 bytes --]
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 9543298..7b6e3c2 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -2310,10 +2310,7 @@ static inline void gen_jcc(DisasContext *s, int b,
int l1, l2, cc_op;
cc_op = s->cc_op;
- if (s->cc_op != CC_OP_DYNAMIC) {
- gen_op_set_cc_op(s->cc_op);
- s->cc_op = CC_OP_DYNAMIC;
- }
+ gen_update_cc_op(s);
if (s->jmp_opt) {
l1 = gen_new_label();
gen_jcc1(s, cc_op, b, l1);
@@ -2724,10 +2721,7 @@ static void gen_eob(DisasContext *s)
static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num)
{
if (s->jmp_opt) {
- if (s->cc_op != CC_OP_DYNAMIC) {
- gen_op_set_cc_op(s->cc_op);
- s->cc_op = CC_OP_DYNAMIC;
- }
+ gen_update_cc_op(s);
gen_goto_tb(s, tb_num, eip);
s->is_jmp = DISAS_TB_JUMP;
} else {
@@ -6901,10 +6895,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
if (!s->pe) {
gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
} else {
- if (s->cc_op != CC_OP_DYNAMIC) {
- gen_op_set_cc_op(s->cc_op);
- s->cc_op = CC_OP_DYNAMIC;
- }
+ gen_update_cc_op(s);
gen_jmp_im(pc_start - s->cs_base);
gen_helper_sysenter();
gen_eob(s);
@@ -6917,10 +6908,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
if (!s->pe) {
gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
} else {
- if (s->cc_op != CC_OP_DYNAMIC) {
- gen_op_set_cc_op(s->cc_op);
- s->cc_op = CC_OP_DYNAMIC;
- }
+ gen_update_cc_op(s);
gen_jmp_im(pc_start - s->cs_base);
gen_helper_sysexit(tcg_const_i32(dflag));
gen_eob(s);
@@ -6929,10 +6917,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
#ifdef TARGET_X86_64
case 0x105: /* syscall */
/* XXX: is it usable in real mode ? */
- if (s->cc_op != CC_OP_DYNAMIC) {
- gen_op_set_cc_op(s->cc_op);
- s->cc_op = CC_OP_DYNAMIC;
- }
+ gen_update_cc_op(s);
gen_jmp_im(pc_start - s->cs_base);
gen_helper_syscall(tcg_const_i32(s->pc - pc_start));
gen_eob(s);
@@ -6941,10 +6926,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
if (!s->pe) {
gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
} else {
- if (s->cc_op != CC_OP_DYNAMIC) {
- gen_op_set_cc_op(s->cc_op);
- s->cc_op = CC_OP_DYNAMIC;
- }
+ gen_update_cc_op(s);
gen_jmp_im(pc_start - s->cs_base);
gen_helper_sysret(tcg_const_i32(s->dflag));
/* condition codes are modified only in long mode */
@@ -7085,10 +7067,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
if (!(s->cpuid_ext_features & CPUID_EXT_MONITOR) ||
s->cpl != 0)
goto illegal_op;
- if (s->cc_op != CC_OP_DYNAMIC) {
- gen_op_set_cc_op(s->cc_op);
- s->cc_op = CC_OP_DYNAMIC;
- }
+ gen_update_cc_op(s);
gen_jmp_im(pc_start - s->cs_base);
gen_helper_mwait(tcg_const_i32(s->pc - pc_start));
gen_eob(s);
@@ -7613,10 +7592,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
gen_svm_check_intercept(s, pc_start, SVM_EXIT_RSM);
if (!(s->flags & HF_SMM_MASK))
goto illegal_op;
- if (s->cc_op != CC_OP_DYNAMIC) {
- gen_op_set_cc_op(s->cc_op);
- s->cc_op = CC_OP_DYNAMIC;
- }
+ gen_update_cc_op(s);
gen_jmp_im(s->pc - s->cs_base);
gen_helper_rsm();
gen_eob(s);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [patch] use gen_update_cc_op()
2010-07-25 3:30 [Qemu-devel] [patch] use gen_update_cc_op() Jun Koi
@ 2010-07-25 15:14 ` Aurelien Jarno
0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2010-07-25 15:14 UTC (permalink / raw)
To: Jun Koi; +Cc: qemu-devel
On Sun, Jul 25, 2010 at 12:30:03PM +0900, Jun Koi wrote:
> this patch simplifies target-i386/translate.c a bit by replacing some
> code with gen_update_cc_op()
>
> Signed-off-by: Jun Koi <junkoi2004@gmail.com>
Thanks, applied.
> diff --git a/target-i386/translate.c b/target-i386/translate.c
> index 9543298..7b6e3c2 100644
> --- a/target-i386/translate.c
> +++ b/target-i386/translate.c
> @@ -2310,10 +2310,7 @@ static inline void gen_jcc(DisasContext *s, int b,
> int l1, l2, cc_op;
>
> cc_op = s->cc_op;
> - if (s->cc_op != CC_OP_DYNAMIC) {
> - gen_op_set_cc_op(s->cc_op);
> - s->cc_op = CC_OP_DYNAMIC;
> - }
> + gen_update_cc_op(s);
> if (s->jmp_opt) {
> l1 = gen_new_label();
> gen_jcc1(s, cc_op, b, l1);
> @@ -2724,10 +2721,7 @@ static void gen_eob(DisasContext *s)
> static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num)
> {
> if (s->jmp_opt) {
> - if (s->cc_op != CC_OP_DYNAMIC) {
> - gen_op_set_cc_op(s->cc_op);
> - s->cc_op = CC_OP_DYNAMIC;
> - }
> + gen_update_cc_op(s);
> gen_goto_tb(s, tb_num, eip);
> s->is_jmp = DISAS_TB_JUMP;
> } else {
> @@ -6901,10 +6895,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
> if (!s->pe) {
> gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
> } else {
> - if (s->cc_op != CC_OP_DYNAMIC) {
> - gen_op_set_cc_op(s->cc_op);
> - s->cc_op = CC_OP_DYNAMIC;
> - }
> + gen_update_cc_op(s);
> gen_jmp_im(pc_start - s->cs_base);
> gen_helper_sysenter();
> gen_eob(s);
> @@ -6917,10 +6908,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
> if (!s->pe) {
> gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
> } else {
> - if (s->cc_op != CC_OP_DYNAMIC) {
> - gen_op_set_cc_op(s->cc_op);
> - s->cc_op = CC_OP_DYNAMIC;
> - }
> + gen_update_cc_op(s);
> gen_jmp_im(pc_start - s->cs_base);
> gen_helper_sysexit(tcg_const_i32(dflag));
> gen_eob(s);
> @@ -6929,10 +6917,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
> #ifdef TARGET_X86_64
> case 0x105: /* syscall */
> /* XXX: is it usable in real mode ? */
> - if (s->cc_op != CC_OP_DYNAMIC) {
> - gen_op_set_cc_op(s->cc_op);
> - s->cc_op = CC_OP_DYNAMIC;
> - }
> + gen_update_cc_op(s);
> gen_jmp_im(pc_start - s->cs_base);
> gen_helper_syscall(tcg_const_i32(s->pc - pc_start));
> gen_eob(s);
> @@ -6941,10 +6926,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
> if (!s->pe) {
> gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
> } else {
> - if (s->cc_op != CC_OP_DYNAMIC) {
> - gen_op_set_cc_op(s->cc_op);
> - s->cc_op = CC_OP_DYNAMIC;
> - }
> + gen_update_cc_op(s);
> gen_jmp_im(pc_start - s->cs_base);
> gen_helper_sysret(tcg_const_i32(s->dflag));
> /* condition codes are modified only in long mode */
> @@ -7085,10 +7067,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
> if (!(s->cpuid_ext_features & CPUID_EXT_MONITOR) ||
> s->cpl != 0)
> goto illegal_op;
> - if (s->cc_op != CC_OP_DYNAMIC) {
> - gen_op_set_cc_op(s->cc_op);
> - s->cc_op = CC_OP_DYNAMIC;
> - }
> + gen_update_cc_op(s);
> gen_jmp_im(pc_start - s->cs_base);
> gen_helper_mwait(tcg_const_i32(s->pc - pc_start));
> gen_eob(s);
> @@ -7613,10 +7592,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
> gen_svm_check_intercept(s, pc_start, SVM_EXIT_RSM);
> if (!(s->flags & HF_SMM_MASK))
> goto illegal_op;
> - if (s->cc_op != CC_OP_DYNAMIC) {
> - gen_op_set_cc_op(s->cc_op);
> - s->cc_op = CC_OP_DYNAMIC;
> - }
> + gen_update_cc_op(s);
> gen_jmp_im(s->pc - s->cs_base);
> gen_helper_rsm();
> gen_eob(s);
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-25 15:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-25 3:30 [Qemu-devel] [patch] use gen_update_cc_op() Jun Koi
2010-07-25 15:14 ` Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).