/[qemu]/qemu/translate-i386.c
ViewVC logotype

Diff of /qemu/translate-i386.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.33 by bellard, Tue May 13 00:25:15 2003 UTC revision 1.34 by bellard, Wed May 14 18:58:05 2003 UTC
# Line 32  Line 32 
32  #define IN_OP_I386  #define IN_OP_I386
33  #include "cpu-i386.h"  #include "cpu-i386.h"
34    
 #ifndef offsetof  
 #define offsetof(type, field) ((size_t) &((type *)0)->field)  
 #endif  
   
35  /* XXX: move that elsewhere */  /* XXX: move that elsewhere */
36  static uint16_t *gen_opc_ptr;  static uint16_t *gen_opc_ptr;
37  static uint32_t *gen_opparam_ptr;  static uint32_t *gen_opparam_ptr;
# Line 3721  static uint16_t gen_opc_buf[OPC_BUF_SIZE Line 3717  static uint16_t gen_opc_buf[OPC_BUF_SIZE
3717  static uint32_t gen_opparam_buf[OPPARAM_BUF_SIZE];  static uint32_t gen_opparam_buf[OPPARAM_BUF_SIZE];
3718    
3719  /* return non zero if the very first instruction is invalid so that  /* return non zero if the very first instruction is invalid so that
3720     the virtual CPU can trigger an exception. */     the virtual CPU can trigger an exception.
3721    
3722       '*code_size_ptr' contains the target code size including the
3723       instruction which triggered an exception, except in case of invalid
3724       illegal opcode. It must never exceed one target page.
3725      
3726       '*gen_code_size_ptr' contains the size of the generated code (host
3727       code).
3728    */
3729  int cpu_x86_gen_code(uint8_t *gen_code_buf, int max_code_size,  int cpu_x86_gen_code(uint8_t *gen_code_buf, int max_code_size,
3730                       int *gen_code_size_ptr,                       int *gen_code_size_ptr,
3731                       uint8_t *pc_start,  uint8_t *cs_base, int flags)                       uint8_t *pc_start,  uint8_t *cs_base, int flags,
3732                         int *code_size_ptr)
3733  {  {
3734      DisasContext dc1, *dc = &dc1;      DisasContext dc1, *dc = &dc1;
3735      uint8_t *pc_ptr;      uint8_t *pc_ptr;
# Line 3767  int cpu_x86_gen_code(uint8_t *gen_code_b Line 3772  int cpu_x86_gen_code(uint8_t *gen_code_b
3772             generate an exception */             generate an exception */
3773          if (dc->tf)          if (dc->tf)
3774              break;              break;
3775      } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end);      } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end &&
3776                 (pc_ptr - pc_start) < (TARGET_PAGE_SIZE - 32));
3777      /* we must store the eflags state if it is not already done */      /* we must store the eflags state if it is not already done */
3778      if (dc->cc_op != CC_OP_DYNAMIC)      if (dc->cc_op != CC_OP_DYNAMIC)
3779          gen_op_set_cc_op(dc->cc_op);          gen_op_set_cc_op(dc->cc_op);
# Line 3810  int cpu_x86_gen_code(uint8_t *gen_code_b Line 3816  int cpu_x86_gen_code(uint8_t *gen_code_b
3816      gen_code_size = dyngen_code(gen_code_buf, gen_opc_buf, gen_opparam_buf);      gen_code_size = dyngen_code(gen_code_buf, gen_opc_buf, gen_opparam_buf);
3817      flush_icache_range((unsigned long)gen_code_buf, (unsigned long)(gen_code_buf + gen_code_size));      flush_icache_range((unsigned long)gen_code_buf, (unsigned long)(gen_code_buf + gen_code_size));
3818      *gen_code_size_ptr = gen_code_size;      *gen_code_size_ptr = gen_code_size;
3819        *code_size_ptr = pc_ptr - pc_start;
3820  #ifdef DEBUG_DISAS  #ifdef DEBUG_DISAS
3821      if (loglevel) {      if (loglevel) {
3822          fprintf(logfile, "OUT: [size=%d]\n", *gen_code_size_ptr);          fprintf(logfile, "OUT: [size=%d]\n", *gen_code_size_ptr);

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26