qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] opc.h and gen-op.h
@ 2005-11-05 13:01 space-wizard
  2005-11-05 14:48 ` Jim C. Brown
  2005-11-05 15:37 ` Johannes Schindelin
  0 siblings, 2 replies; 3+ messages in thread
From: space-wizard @ 2005-11-05 13:01 UTC (permalink / raw)
  To: qemu-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 607 bytes --]

Hello!

What is the job of the two files gen-op.h and opc.h? They were created by
dyngen -c / -g 

I don't understand their content.

opc.h contains something like:
DEF(movl_A0_EAX, 0, 3)
DEF(addl_A0_EAX, 0, 5)
DEF(addl_A0_EAX_s1, 0, 6)

gen-op.h contains:
static inline void gen_op_movl_A0_EAX(void)
{
    *gen_opc_ptr++ = INDEX_op_movl_A0_EAX;
}

static inline void gen_op_addl_A0_EAX(void)
{
    *gen_opc_ptr++ = INDEX_op_addl_A0_EAX;
}


Can you help me?

Chris




-- 
Highspeed-Freiheit. Bei GMX supergünstig, z.B. GMX DSL_Cityflat,
DSL-Flatrate für nur 4,99 Euro/Monat*  http://www.gmx.net/de/go/dsl

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

* Re: [Qemu-devel] opc.h and gen-op.h
  2005-11-05 13:01 [Qemu-devel] opc.h and gen-op.h space-wizard
@ 2005-11-05 14:48 ` Jim C. Brown
  2005-11-05 15:37 ` Johannes Schindelin
  1 sibling, 0 replies; 3+ messages in thread
From: Jim C. Brown @ 2005-11-05 14:48 UTC (permalink / raw)
  To: space-wizard; +Cc: qemu-devel

I don't know the exact purpose, but they are part of the code that forms the
intermediate language qemu uses when it performs dynamic translating.

On Sat, Nov 05, 2005 at 02:01:13PM +0100, space-wizard@gmx.de wrote:
> Hello!
> 
> What is the job of the two files gen-op.h and opc.h? They were created by
> dyngen -c / -g 
> 
> I don't understand their content.
> 
> opc.h contains something like:
> DEF(movl_A0_EAX, 0, 3)
> DEF(addl_A0_EAX, 0, 5)
> DEF(addl_A0_EAX_s1, 0, 6)
> 
> gen-op.h contains:
> static inline void gen_op_movl_A0_EAX(void)
> {
>     *gen_opc_ptr++ = INDEX_op_movl_A0_EAX;
> }
> 
> static inline void gen_op_addl_A0_EAX(void)
> {
>     *gen_opc_ptr++ = INDEX_op_addl_A0_EAX;
> }
> 
> 
> Can you help me?
> 
> Chris
> 
> 
> 
> 
> -- 
> Highspeed-Freiheit. Bei GMX superg?nstig, z.B. GMX DSL_Cityflat,
> DSL-Flatrate f?r nur 4,99 Euro/Monat*  http://www.gmx.net/de/go/dsl
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
> 

-- 
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.

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

* Re: [Qemu-devel] opc.h and gen-op.h
  2005-11-05 13:01 [Qemu-devel] opc.h and gen-op.h space-wizard
  2005-11-05 14:48 ` Jim C. Brown
@ 2005-11-05 15:37 ` Johannes Schindelin
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2005-11-05 15:37 UTC (permalink / raw)
  To: qemu-devel

Hi,

On Sat, 5 Nov 2005, space-wizard@gmx.de wrote:

> What is the job of the two files gen-op.h and opc.h? They were created 
> by dyngen -c / -g

> opc.h contains something like:
> DEF(movl_A0_EAX, 0, 3)
> DEF(addl_A0_EAX, 0, 5)
> DEF(addl_A0_EAX_s1, 0, 6)

These are definitions of the oplets. For example, movl_A0_EAX takes 0 
arguments, and its implementation is 3 bytes long.

Remember, QEmu is not an emulator but translator: every assembler opcode 
is translated into a short assembler sequence (in the machine language 
of the host) implementing the function of the opcode.

> gen-op.h contains:
> static inline void gen_op_movl_A0_EAX(void)
> {
>     *gen_opc_ptr++ = INDEX_op_movl_A0_EAX;
> }
> 
> static inline void gen_op_addl_A0_EAX(void)
> {
>     *gen_opc_ptr++ = INDEX_op_addl_A0_EAX;
> }

This is the first step of translating: In order to translate a block of 
code, kind of a P-code is generated with the gen_op* functions. This 
step is responsible to fill in the arguments (movl_A0_EAX is one of 
the simpler functions which do not take an argument).

This P-code is then turned into working machine code by filling in the 
corresponding snippets (the compiled code of the op_* functions) and the 
arguments are put into the correct place.

I've written a document a while ago, where I wrote what I understood to be 
the process used by QEmu. Maybe it helps you:

	http://libvncserver.sourceforge.net/qemu/qemu-porting.html

The section about portable dynamic translation should be of special 
interest to you.

Ciao,
Dscho

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

end of thread, other threads:[~2005-11-05 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-05 13:01 [Qemu-devel] opc.h and gen-op.h space-wizard
2005-11-05 14:48 ` Jim C. Brown
2005-11-05 15:37 ` Johannes Schindelin

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