From: Thiemo Seufer <ths@networkno.de>
To: Atif Hashmi <atifhashmi@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: Detecting an assembly instruction in QEMU
Date: Wed, 11 Apr 2007 17:05:16 +0100 [thread overview]
Message-ID: <20070411160515.GA31609@networkno.de> (raw)
In-Reply-To: <d5f3bd2b0704081438k176fb70aqc47cbe51f7d32590@mail.gmail.com>
Atif Hashmi wrote:
> Hi Eduardo,
>
> Thanks a lot for your help. I really appreciate it. I have added the
> functionality that I wanted.
Just in case it might help somebody reading this list, I use the appended
patch to detect a special instruction pattern as pass/fail condition and
shut down qemu with the appropriate message.
Thiemo
Index: qemu-cvs/target-mips/exec.h
===================================================================
--- qemu-cvs.orig/target-mips/exec.h
+++ qemu-cvs/target-mips/exec.h
@@ -140,6 +140,9 @@
uint64_t do_sdr_kernel (uint64_t);
#endif
#endif
+void do_avp_ok (void);
+void do_avp_fail (void);
+
void do_pmon (int function);
void dump_sc (void);
Index: qemu-cvs/target-mips/op.c
===================================================================
--- qemu-cvs.orig/target-mips/op.c
+++ qemu-cvs/target-mips/op.c
@@ -954,6 +954,16 @@
OP_COND(lez, (int32_t)T0 <= 0);
OP_COND(ltz, (int32_t)T0 < 0);
+//
+void op_avp_ok (void) {
+ CALL_FROM_TB0(do_avp_ok);
+ RETURN();
+}
+void op_avp_fail (void) {
+ CALL_FROM_TB0(do_avp_fail);
+ RETURN();
+}
+
/* Branches */
//#undef USE_DIRECT_JUMP
Index: qemu-cvs/target-mips/op_helper.c
===================================================================
--- qemu-cvs.orig/target-mips/op_helper.c
+++ qemu-cvs/target-mips/op_helper.c
@@ -535,6 +535,18 @@
fputs("\n", logfile);
}
+void do_avp_ok (void)
+{
+ puts("ok");
+ qemu_system_shutdown_request();
+}
+
+void do_avp_fail (void)
+{
+ puts("fail");
+ qemu_system_shutdown_request();
+}
+
void do_pmon (int function)
{
function /= 2;
Index: qemu-cvs/target-mips/translate.c
===================================================================
--- qemu-cvs.orig/target-mips/translate.c
+++ qemu-cvs/target-mips/translate.c
@@ -881,6 +881,14 @@
uint32_t uimm;
const char *opn = "unk";
+if (opc == OPC_SLTIU && rs == 0 && rt == 0 && (((uint16_t)imm == 0xabc2) | ((uint16_t)imm == 0xabc1))) {
+ if ((uint16_t)imm == 0xabc2)
+ gen_op_avp_ok();
+ else
+ gen_op_avp_fail();
+ ctx->bstate = BS_STOP;
+ return;
+}
if (rt == 0 && opc != OPC_ADDI && opc != OPC_DADDI) {
/* if no destination, treat it as a NOP
* For addi, we must generate the overflow exception when needed.
prev parent reply other threads:[~2007-04-11 16:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-04 4:57 [Qemu-devel] Detecting an assembly instruction in QEMU Atif Hashmi
2007-04-05 17:37 ` [Qemu-devel] " Atif Hashmi
2007-04-06 12:15 ` Eduardo Felipe
2007-04-07 21:06 ` Atif Hashmi
2007-04-08 14:13 ` Eduardo Felipe
2007-04-08 21:38 ` Atif Hashmi
2007-04-08 22:14 ` Eduardo Felipe
2007-04-17 0:17 ` Atif Hashmi
2007-04-17 0:22 ` Atif Hashmi
2007-04-17 9:49 ` Eduardo Felipe
2007-04-17 20:33 ` Atif Hashmi
2007-04-22 13:09 ` Eduardo Felipe
2007-04-24 7:30 ` Atif Hashmi
2007-04-24 9:34 ` Eduardo Felipe
2007-04-25 16:21 ` Atif Hashmi
2007-04-25 16:50 ` Atif Hashmi
2007-04-26 14:03 ` Eduardo Felipe
2007-04-26 21:26 ` Atif Hashmi
2007-04-27 10:16 ` Eduardo Felipe
2007-05-01 20:28 ` Atif Hashmi
2007-04-11 16:05 ` Thiemo Seufer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070411160515.GA31609@networkno.de \
--to=ths@networkno.de \
--cc=atifhashmi@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).