/[qemu]/qemu/dyngen.c
ViewVC logotype

Diff of /qemu/dyngen.c

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

revision 1.35 by bellard, Sat Jul 10 16:22:18 2004 UTC revision 1.36 by bellard, Mon Jan 3 23:40:55 2005 UTC
# Line 54  Line 54 
54  #define elf_check_arch(x) ( ((x) == EM_386) || ((x) == EM_486) )  #define elf_check_arch(x) ( ((x) == EM_386) || ((x) == EM_486) )
55  #undef ELF_USES_RELOCA  #undef ELF_USES_RELOCA
56    
57  #elif defined(HOST_AMD64)  #elif defined(HOST_X86_64)
58    
59  #define ELF_CLASS       ELFCLASS64  #define ELF_CLASS       ELFCLASS64
60  #define ELF_ARCH        EM_X86_64  #define ELF_ARCH        EM_X86_64
# Line 1307  void gen_code(const char *name, host_ulo Line 1307  void gen_code(const char *name, host_ulo
1307      p_start = text + offset;      p_start = text + offset;
1308      p_end = p_start + size;      p_end = p_start + size;
1309      start_offset = offset;      start_offset = offset;
1310  #if defined(HOST_I386) || defined(HOST_AMD64)  #if defined(HOST_I386) || defined(HOST_X86_64)
1311  #ifdef CONFIG_FORMAT_COFF  #ifdef CONFIG_FORMAT_COFF
1312      {      {
1313          uint8_t *p;          uint8_t *p;
# Line 1482  void gen_code(const char *name, host_ulo Line 1482  void gen_code(const char *name, host_ulo
1482              sym_name = get_rel_sym_name(rel);              sym_name = get_rel_sym_name(rel);
1483              if(!sym_name)              if(!sym_name)
1484                  continue;                  continue;
1485              if (strstart(sym_name, "__op_param", &p)) {              if (strstart(sym_name, "__op_param", &p) ||
1486                    strstart(sym_name, "__op_gen_label", &p)) {
1487                  n = strtoul(p, NULL, 10);                  n = strtoul(p, NULL, 10);
1488                  if (n > MAX_ARGS)                  if (n > MAX_ARGS)
1489                      error("too many arguments in %s", name);                      error("too many arguments in %s", name);
# Line 1525  void gen_code(const char *name, host_ulo Line 1526  void gen_code(const char *name, host_ulo
1526                      continue;                      continue;
1527                  if (*sym_name &&                  if (*sym_name &&
1528                      !strstart(sym_name, "__op_param", NULL) &&                      !strstart(sym_name, "__op_param", NULL) &&
1529                      !strstart(sym_name, "__op_jmp", NULL)) {                      !strstart(sym_name, "__op_jmp", NULL) &&
1530                        !strstart(sym_name, "__op_gen_label", NULL)) {
1531  #if defined(HOST_SPARC)  #if defined(HOST_SPARC)
1532                      if (sym_name[0] == '.') {                      if (sym_name[0] == '.') {
1533                          fprintf(outfile,                          fprintf(outfile,
# Line 1604  void gen_code(const char *name, host_ulo Line 1606  void gen_code(const char *name, host_ulo
1606                          }                          }
1607                      }                      }
1608  #endif                      #endif                    
1609                        if (val >= start_offset && val <= start_offset + copy_size) {
                     if (val >= start_offset && val < start_offset + copy_size) {  
1610                          n = strtol(p, NULL, 10);                          n = strtol(p, NULL, 10);
1611                          fprintf(outfile, "    label_offsets[%d] = %ld + (gen_code_ptr - gen_code_buf);\n", n, val - start_offset);                          fprintf(outfile, "    label_offsets[%d] = %ld + (gen_code_ptr - gen_code_buf);\n", n, val - start_offset);
1612                      }                      }
# Line 1642  void gen_code(const char *name, host_ulo Line 1643  void gen_code(const char *name, host_ulo
1643                                                    
1644                      if (strstart(sym_name, "__op_param", &p)) {                      if (strstart(sym_name, "__op_param", &p)) {
1645                          snprintf(name, sizeof(name), "param%s", p);                          snprintf(name, sizeof(name), "param%s", p);
1646                        } else if (strstart(sym_name, "__op_gen_label", &p)) {
1647                            snprintf(name, sizeof(name), "gen_labels[param%s]", p);
1648                      } else {                      } else {
1649                          snprintf(name, sizeof(name), "(long)(&%s)", sym_name);                          snprintf(name, sizeof(name), "(long)(&%s)", sym_name);
1650                      }                      }
# Line 1693  void gen_code(const char *name, host_ulo Line 1696  void gen_code(const char *name, host_ulo
1696                  }                  }
1697                  }                  }
1698              }              }
1699  #elif defined(HOST_AMD64)  #elif defined(HOST_X86_64)
1700              {              {
1701                  char name[256];                  char name[256];
1702                  int type;                  int type;
# Line 1723  void gen_code(const char *name, host_ulo Line 1726  void gen_code(const char *name, host_ulo
1726                                  rel->r_offset - start_offset, name, rel->r_offset - start_offset, addend);                                  rel->r_offset - start_offset, name, rel->r_offset - start_offset, addend);
1727                          break;                          break;
1728                      default:                      default:
1729                          error("unsupported AMD64 relocation (%d)", type);                          error("unsupported X86_64 relocation (%d)", type);
1730                      }                      }
1731                  }                  }
1732                  }                  }
# Line 2232  int gen_file(FILE *outfile, int out_type Line 2235  int gen_file(FILE *outfile, int out_type
2235          }          }
2236      } else if (out_type == OUT_GEN_OP) {      } else if (out_type == OUT_GEN_OP) {
2237          /* generate gen_xxx functions */          /* generate gen_xxx functions */
2238            fprintf(outfile, "#include \"dyngen-op.h\"\n");
2239          for(i = 0, sym = symtab; i < nb_syms; i++, sym++) {          for(i = 0, sym = symtab; i < nb_syms; i++, sym++) {
2240              const char *name;              const char *name;
2241              name = get_sym_name(sym);              name = get_sym_name(sym);
# Line 2250  int gen_file(FILE *outfile, int out_type Line 2253  int gen_file(FILE *outfile, int out_type
2253  fprintf(outfile,  fprintf(outfile,
2254  "int dyngen_code(uint8_t *gen_code_buf,\n"  "int dyngen_code(uint8_t *gen_code_buf,\n"
2255  "                uint16_t *label_offsets, uint16_t *jmp_offsets,\n"  "                uint16_t *label_offsets, uint16_t *jmp_offsets,\n"
2256  "                const uint16_t *opc_buf, const uint32_t *opparam_buf)\n"  "                const uint16_t *opc_buf, const uint32_t *opparam_buf, const long *gen_labels)\n"
2257  "{\n"  "{\n"
2258  "    uint8_t *gen_code_ptr;\n"  "    uint8_t *gen_code_ptr;\n"
2259  "    const uint16_t *opc_ptr;\n"  "    const uint16_t *opc_ptr;\n"

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

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