> > 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

Reply via email to