* [Qemu-devel] cpu_x86() ?
@ 2011-11-01 10:45 Jun Koi
2011-11-01 10:58 ` Max Filippov
0 siblings, 1 reply; 5+ messages in thread
From: Jun Koi @ 2011-11-01 10:45 UTC (permalink / raw)
To: qemu-devel
hi,
the way cpu_exec() is defined is really confused to me.
in cpu-exec.c, we define cpu_exec() function.
however, each architecture seems to redefine cpu_exec(), like we have
in target-i386/cpu.h
#define cpu_exec cpu_x86_exec
so which cpu_exec() is executed in case of tcg/x86?
also, i cannot find the definition of cpu_x86_exec() anywhere.
somebody please help?
thanks,
Jun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] cpu_x86() ?
2011-11-01 10:45 [Qemu-devel] cpu_x86() ? Jun Koi
@ 2011-11-01 10:58 ` Max Filippov
2011-11-01 14:34 ` Jun Koi
0 siblings, 1 reply; 5+ messages in thread
From: Max Filippov @ 2011-11-01 10:58 UTC (permalink / raw)
To: Jun Koi; +Cc: qemu-devel
> the way cpu_exec() is defined is really confused to me.
>
> in cpu-exec.c, we define cpu_exec() function.
>
> however, each architecture seems to redefine cpu_exec(), like we have
> in target-i386/cpu.h
>
> #define cpu_exec cpu_x86_exec
>
> so which cpu_exec() is executed in case of tcg/x86?
>
> also, i cannot find the definition of cpu_x86_exec() anywhere.
cpu_exec definition in cpu-exec.c takes place after #include "cpu.h"
which contains #define cpu_exec whatever.
In case of x86 cpu_x86_exec is actually defined by the cpu-exec.c.
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] cpu_x86() ?
2011-11-01 10:58 ` Max Filippov
@ 2011-11-01 14:34 ` Jun Koi
2011-11-01 14:46 ` Andreas Färber
2011-11-01 14:47 ` Max Filippov
0 siblings, 2 replies; 5+ messages in thread
From: Jun Koi @ 2011-11-01 14:34 UTC (permalink / raw)
To: Max Filippov; +Cc: qemu-devel
On Tue, Nov 1, 2011 at 6:58 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
>> the way cpu_exec() is defined is really confused to me.
>>
>> in cpu-exec.c, we define cpu_exec() function.
>>
>> however, each architecture seems to redefine cpu_exec(), like we have
>> in target-i386/cpu.h
>>
>> #define cpu_exec cpu_x86_exec
>>
>> so which cpu_exec() is executed in case of tcg/x86?
>>
>> also, i cannot find the definition of cpu_x86_exec() anywhere.
>
> cpu_exec definition in cpu-exec.c takes place after #include "cpu.h"
> which contains #define cpu_exec whatever.
> In case of x86 cpu_x86_exec is actually defined by the cpu-exec.c.
>
ok, so which means cpu_exec is redefined accordingly to each architecture.
why do we need to do this weird thing? as there is no namespace
collision it seems between architectures, why dont we just let
cpu_exec() be cpu_exec()?
is this a trick? i cannot figure out why.
thanks,
Jun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] cpu_x86() ?
2011-11-01 14:34 ` Jun Koi
@ 2011-11-01 14:46 ` Andreas Färber
2011-11-01 14:47 ` Max Filippov
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2011-11-01 14:46 UTC (permalink / raw)
To: Jun Koi; +Cc: Max Filippov, qemu-devel
Am 01.11.2011 15:34, schrieb Jun Koi:
> On Tue, Nov 1, 2011 at 6:58 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
>>> the way cpu_exec() is defined is really confused to me.
>>>
>>> in cpu-exec.c, we define cpu_exec() function.
>>>
>>> however, each architecture seems to redefine cpu_exec(), like we have
>>> in target-i386/cpu.h
>>>
>>> #define cpu_exec cpu_x86_exec
>>>
>>> so which cpu_exec() is executed in case of tcg/x86?
>>>
>>> also, i cannot find the definition of cpu_x86_exec() anywhere.
>>
>> cpu_exec definition in cpu-exec.c takes place after #include "cpu.h"
>> which contains #define cpu_exec whatever.
>> In case of x86 cpu_x86_exec is actually defined by the cpu-exec.c.
>>
>
> ok, so which means cpu_exec is redefined accordingly to each architecture.
>
> why do we need to do this weird thing? as there is no namespace
> collision it seems between architectures, why dont we just let
> cpu_exec() be cpu_exec()?
See the recent discussion about heterogeneous system emulation.
Such redefinitions are a handy way to avoid name collisions across
architectures.
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] cpu_x86() ?
2011-11-01 14:34 ` Jun Koi
2011-11-01 14:46 ` Andreas Färber
@ 2011-11-01 14:47 ` Max Filippov
1 sibling, 0 replies; 5+ messages in thread
From: Max Filippov @ 2011-11-01 14:47 UTC (permalink / raw)
To: Jun Koi; +Cc: qemu-devel
> > cpu_exec definition in cpu-exec.c takes place after #include "cpu.h"
> > which contains #define cpu_exec whatever.
> > In case of x86 cpu_x86_exec is actually defined by the cpu-exec.c.
> >
>
> ok, so which means cpu_exec is redefined accordingly to each architecture.
>
> why do we need to do this weird thing? as there is no namespace
> collision it seems between architectures, why dont we just let
> cpu_exec() be cpu_exec()?
>
> is this a trick? i cannot figure out why.
One theory about it is the following (quoted from http://lists.nongnu.org/archive/html/qemu-devel/2011-05/msg02921.html):
One of the long standing goals for QEMU has been to be able to use a
single executable to emulate multiple architectures. I think for
example the lines like
#define cpu_init cpu_sparc_init
#define cpu_exec cpu_sparc_exec
etc. stand for this purpose, so there has been some consideration for this.
Thanks.
-- Max
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-11-01 14:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-01 10:45 [Qemu-devel] cpu_x86() ? Jun Koi
2011-11-01 10:58 ` Max Filippov
2011-11-01 14:34 ` Jun Koi
2011-11-01 14:46 ` Andreas Färber
2011-11-01 14:47 ` Max Filippov
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).