On Thu, Mar 8, 2012 at 6:05 AM, Stefan Neumann <
[email protected]> wrote:

> Hi guys,
>
> I just figured out why the simulation always starts at a different rip
> when receiving the "-run" command via ptlcalls while running in qemu
> emulation mode.
> As we know the MMIO access of the ptlcall will queue the incoming command
> and interrupt the emulation by running cpu_exit() function.
>
> The queue is then checked inside the main_loop and 'start_simulation' is
> set.
> The evaluation of the start_simulation is also done in the main_loop, and
> here is the reason for the unpredictable behavior.
>
> The start_simulation is evaluated before the queue is checked, which will
> cause the emulation to proceed until eventually another exit_request will
> finally start the simulation.
>
> If we put the queue check in front of the evaluation of the
> start_simulation, then we get a fully predictable switch to simulation mode.
> The first executed instruction in simulation mode will be the instruction
> after the smsw command.
>
> So I guess this should be changed.
>
> See in vl.c:
>
> if (start_simulation) {
>    cpu_set_sim_ticks();
>    in_simulation = 1;
>    start_simulation = 0;
>    tb_flush(first_cpu);
> }
>
> ptl_check_ptlcall_queue();
>
> vs.
>
> ptl_check_ptlcall_queue();
>
> if (start_simulation) {
>    cpu_set_sim_ticks();
>    in_simulation = 1;
>    start_simulation = 0;
>    tb_flush(first_cpu);
> }
>
> Maybe this is also another step forward to a more deterministic behavior
> of the simulation/emulation.
>
> Thanks for pointing this out. If you have signed patch or if you can send
me git pull request then send it to me.
Else I'll add this to features branch and merge to masters on next release.

- Avadh

Regards,
> Stefan
> _______________________________________________
> http://www.marss86.org
> Marss86-Devel mailing list
> [email protected]
> https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel
>
>
_______________________________________________
http://www.marss86.org
Marss86-Devel mailing list
[email protected]
https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel

Reply via email to