Received: from eggs.gnu.org ([140.186.70.92]:55610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrxPp-0006xB-CU for qemu-devel@nongnu.org; Fri, 12 Aug 2011 15:29:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrxPo-0001sY-DA for qemu-devel@nongnu.org; Fri, 12 Aug 2011 15:29:09 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:40933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrxPo-0001sT-Aa for qemu-devel@nongnu.org; Fri, 12 Aug 2011 15:29:08 -0400 Received: by gwb19 with SMTP id 19so2558535gwb.4 for ; Fri, 12 Aug 2011 12:29:07 -0700 (PDT) Received: from [136.162.34.1] ([136.162.34.1]) by shadowfax.no-ip.com for qemu-devel@nongnu.org; Fri, 12 Aug 2011 14:29:05 -0500 From: "Adnan Khaleel" Message-ID: <20110812192905.0a118dba@shadowfax.no-ip.com> Date: Fri, 12 Aug 2011 14:29:05 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-----------69a492e2c5d13da6dfb4ae0fe2893234" Subject: [Qemu-devel] Calling a function every N instructions or simulated cpu cycles Reply-To: adnan@khaleel.us List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. -------------69a492e2c5d13da6dfb4ae0fe2893234 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I'm using Qemu along with a network simulator and I need to perform a sy= nchronization every N cycles. What is the best way to do this in Qemu so= that I can call a function periodically say every N instructions or sim= ulated cpu cycles=3F Currently I have a routine in main=5Floop() in vl.c but it seems like my= synchronization routine is not called consistently. I'm showing the cod= e snippet below to give you a better idea. #define NETWORK=5FSYNC=5FCPU=5FCYCLES 100000 static void main=5Floop(void) { int r; #ifdef NETWORK=5FCOSIM =20 int check=5Fcounter =3D NETWORK=5FSYNC=5FCPU=5FCYCLES; //=20 #endif =20 qemu=5Fmain=5Floop=5Fstart(); for (;;) { do { bool nonblocking =3D false; #ifdef NETWORK=5FCOSIM if (--check=5Fcounter =3D=3D 0) network=5Fsync(); #endif : : } Thanks Adnan=20 -------------69a492e2c5d13da6dfb4ae0fe2893234 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I'm using Qemu along with a network simulator and I need to perform a sy= nchronization every N cycles. What is the best way to do this in Qemu so= that I can call a function periodically say every N instructions or sim= ulated cpu cycles=3F

Currently I have a routine in main=5Floop() = in vl.c but it seems like my synchronization routine is not called consi= stently. I'm showing the code snippet below to give you a better idea.
#define NETWORK=5FSYNC=5FCPU=5FCYCLES 100000
static void main= =5Floop(void)
{
    int r;
#ifdef NETWORK=5FCOSI= M   
    int check=5Fcounter =3D NETWORK=5F= SYNC=5FCPU=5FCYCLES; //
#endif   

  = ;  qemu=5Fmain=5Floop=5Fstart();

    for (;;)= {
        do {
  &nb= sp;         bool nonblocking =3D= false;
#ifdef NETWORK=5FCOSIM
      = ;     if (--check=5Fcounter =3D=3D 0)
  = ;            = ;   network=5Fsync();
#endif
     :<= br>     :
}

Thanks

Adnan
-------------69a492e2c5d13da6dfb4ae0fe2893234--