Re: multi core implementation

"Stanislav" <[email protected]> Tue, 13 Aug 2013 11:26:05 +0300
Newsgroups gmane.comp.emulators.bochs.devel
Message-ID <[email protected]>
For each emulated core you mean ?

main.cc:

      // SMP simulation: do a few instructions on each processor, then
switch
      // to another.  Increasing quantum speeds up overall performance, but
      // reduces granularity of synchronization between processors.
      // Current implementation uses dynamic quantum, each processor will
      // execute exactly one trace then quit the cpu_loop and switch to
      // the next processor.

      static int quantum = SIM->get_param_num(BXPN_SMP_QUANTUM)->get();
      Bit32u executed = 0, processor = 0;

      while (1) {
         // do some instructions in each processor
         Bit64u icount = BX_CPU(processor)->icount_last_sync =
BX_CPU(processor)->get_icount();
         BX_CPU(processor)->cpu_run_trace();

         // see how many instruction it was able to run
         Bit32u n = (Bit32u)(BX_CPU(processor)->get_icount() - icount);
         if (n == 0) n = quantum; // the CPU was halted
         executed += n;

         if (++processor == BX_SMP_PROCESSORS) {
           processor = 0;
           BX_TICKN(executed / BX_SMP_PROCESSORS);
           executed %= BX_SMP_PROCESSORS;
         }

         if (bx_pc_system.kill_bochs_request)
           break;
      }

-----Original Message-----
From: dacian [mailto:[email protected]] 
Sent: Tuesday, August 13, 2013 10:06 AM
To: Stanislav
Cc: <[email protected]>
Subject: Re: multi core implementation


great cause that what I'm doing all day at work.
where is the code that allocates running slots for each core?
dacian

Trimis de pe iPad-ul meu

Pe 13.08.2013, la 07:23, "Stanislav" <[email protected]> a scris:

> Bochs already supports SMP and multi-core emulation but all cores run 
> on the same HW thread.
> Supporting running of multiple cores on different HW threads is 
> actually more complicated because requires syncronisation.
> 
> Stanislav
> 
> -----Original Message-----
> From: dacian [mailto:[email protected]]
> Sent: Tuesday, August 13, 2013 1:13 AM
> To: Stanislav
> Cc: <[email protected]>
> Subject: multi core implementation
> 
> 
> any suggestions if one would try to implement a multi core 
> implementation of the emulator?
> lets assume that in the beginning the cores are virtual represented by 
> processes on the host framework.
> dacian=
> 


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk