All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Question about do_interrupt (target-i386/op_helper.c)
@ 2012-01-19  8:24 陳韋任
  2012-01-19 18:33 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: 陳韋任 @ 2012-01-19  8:24 UTC (permalink / raw)
  To: qemu-devel

Hi all,

  I am looking at do_interrupt (target-i386/op_helper.c) and find something
strange. Code sinpt below,

void do_interrupt(CPUState *env1)
{
    CPUState *saved_env;

    saved_env = env;
    env = env1;

    ...
}

In i386-linux-user, cpu_exec (cpu-exec.c) calls do_interrupt like this,

  do_interrupt(env);

My questions are: 1) It seems to me the parameter of do_interrupt (envl) should
be the same as env inside do_interrupt (which comes from dyngen-exec.h's #define).
Why we need to assign envl to env here? Is it redundant, or I miss something? 2)
In target-i386/op_helper.c, some functions use the global env, while others use
function parameter env. Is it necessary? Or we can unify how they use env?

  Thanks.

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] Question about do_interrupt (target-i386/op_helper.c)
  2012-01-19  8:24 [Qemu-devel] Question about do_interrupt (target-i386/op_helper.c) 陳韋任
@ 2012-01-19 18:33 ` Peter Maydell
  2012-01-20  6:17   ` 陳韋任
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2012-01-19 18:33 UTC (permalink / raw)
  To: 陳韋任; +Cc: qemu-devel

On 19 January 2012 08:24, 陳韋任 <chenwj@iis.sinica.edu.tw> wrote:
> My questions are: 1) It seems to me the parameter of do_interrupt (envl) should
> be the same as env inside do_interrupt (which comes from dyngen-exec.h's #define).

In cpu_exec() env is a local variable. In do_interrupt() it is the global
variable (held in a specific register via "asm(AREG0)"). The two aren't
necessarily the same value, hence the fiddling about.

> In target-i386/op_helper.c, some functions use the global env, while others use
> function parameter env. Is it necessary? Or we can unify how they use env?

There have been some recent patch series attempting to reduce the use of
global env, but it's not a trivial changeover.

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] Question about do_interrupt (target-i386/op_helper.c)
  2012-01-19 18:33 ` Peter Maydell
@ 2012-01-20  6:17   ` 陳韋任
  0 siblings, 0 replies; 3+ messages in thread
From: 陳韋任 @ 2012-01-20  6:17 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, 陳韋任

> In cpu_exec() env is a local variable. In do_interrupt() it is the global
> variable (held in a specific register via "asm(AREG0)"). The two aren't
> necessarily the same value, hence the fiddling about.

  Do you mean we sync env with envl at this point?

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-20  6:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-19  8:24 [Qemu-devel] Question about do_interrupt (target-i386/op_helper.c) 陳韋任
2012-01-19 18:33 ` Peter Maydell
2012-01-20  6:17   ` 陳韋任

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.