Hi, On Sat, 5 Nov 2005, [EMAIL PROTECTED] 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 _______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel