opc.h and gen-op.h
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
Signature · 2 lines
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
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.
Quoted 41 lines · On Sat, Nov 05, 2005 at 02:01:13PM +0100, [email protected] wrote:
Hello!
What is the job of the two files
gen-op.handopc.h? They were created by dyngen -c / -gI don't understand their content.
opc.hcontains something like:DEF(movl_A0_EAX, 0, 3)DEF(addl_A0_EAX, 0, 5)DEF(addl_A0_EAX_s1, 0, 6)
gen-op.hcontains:
static inline voidgen_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
Signature · 8 lines
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 [email protected] http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
Hi,
Quoted 7 lines · On Sat, 5 Nov 2005, [email protected] wrote:
What is the job of the two files
gen-op.handopc.h? They were created by dyngen -c / -g
opc.hcontains 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.
Quoted 10 lines
gen-op.hcontains:
static inline voidgen_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