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

Diff of /qemu/dyngen.c

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

revision 1.37 by bellard, Sun Jan 23 20:42:06 2005 UTC revision 1.38 by bellard, Mon Feb 21 19:53:34 2005 UTC
# Line 996  static const char * get_reloc_name(EXE_R Line 996  static const char * get_reloc_name(EXE_R
996    
997          switch(rel->r_type)          switch(rel->r_type)
998          {          {
999                  case PPC_RELOC_LO16: fetch_next_pair_value(rel+1, &other_half); sectoffset = (sectoffset & 0xffff);                  case PPC_RELOC_LO16: fetch_next_pair_value(rel+1, &other_half); sectoffset |= (other_half << 16);
1000                          break;                          break;
1001                  case PPC_RELOC_HI16: fetch_next_pair_value(rel+1, &other_half); sectoffset = (other_half & 0xffff);                  case PPC_RELOC_HI16: fetch_next_pair_value(rel+1, &other_half); sectoffset = (sectoffset << 16) | (uint16_t)(other_half & 0xffff);
1002                          break;                          break;
1003                  case PPC_RELOC_HA16: fetch_next_pair_value(rel+1, &other_half); sectoffset = (other_half & 0xffff);                  case PPC_RELOC_HA16: fetch_next_pair_value(rel+1, &other_half); sectoffset = (sectoffset << 16) + (int16_t)(other_half & 0xffff);
1004                          break;                          break;
1005                  case PPC_RELOC_BR24:                  case PPC_RELOC_BR24:
1006                          sectoffset = ( *(uint32_t *)(text + rel->r_address) & 0x03fffffc );                          sectoffset = ( *(uint32_t *)(text + rel->r_address) & 0x03fffffc );
# Line 1146  int load_object(const char *filename) Line 1146  int load_object(const char *filename)
1146                    
1147          /* Now transform the symtab, to an extended version, with the sym size, and the C name */          /* Now transform the symtab, to an extended version, with the sym size, and the C name */
1148          for(i = 0, sym = symtab, syment = symtab_std; i < nb_syms; i++, sym++, syment++) {          for(i = 0, sym = symtab, syment = symtab_std; i < nb_syms; i++, sym++, syment++) {
         const char *name;  
1149          struct nlist *sym_follow, *sym_next = 0;          struct nlist *sym_follow, *sym_next = 0;
1150          unsigned int j;          unsigned int j;
         name = find_str_by_index(sym->n_un.n_strx);  
1151                  memset(sym, 0, sizeof(*sym));                  memset(sym, 0, sizeof(*sym));
1152                                    
1153                  if ( sym->n_type & N_STAB ) /* Debug symbols are skipped */                  if ( syment->n_type & N_STAB ) /* Debug symbols are skipped */
1154              continue;              continue;
1155                                                    
1156                  memcpy(sym, syment, sizeof(*syment));                  memcpy(sym, syment, sizeof(*syment));
# Line 1848  void gen_code(const char *name, host_ulo Line 1846  void gen_code(const char *name, host_ulo
1846                                                         sym_name);                                                         sym_name);
1847                                          switch(type) {                                          switch(type) {
1848                                          case PPC_RELOC_BR24:                                          case PPC_RELOC_BR24:
1849                                                  fprintf(outfile, "{\n");                                              if (!strstart(sym_name,"__op_gen_label",&p)) {
1850                                                  fprintf(outfile, "    uint32_t imm = *(uint32_t *)(gen_code_ptr + %d) & 0x3fffffc;\n", slide);                                                  fprintf(outfile, "{\n");
1851                                                  fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | ((imm + ((long)%s - (long)gen_code_ptr) + %d) & 0x03fffffc);\n",                                                  fprintf(outfile, "    uint32_t imm = *(uint32_t *)(gen_code_ptr + %d) & 0x3fffffc;\n", slide);
1852                                                    fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | ((imm + ((long)%s - (long)gen_code_ptr) + %d) & 0x03fffffc);\n",
1853                                                                                          slide, slide, name, sslide );                                                                                          slide, slide, name, sslide );
1854                                                  fprintf(outfile, "}\n");                                                  fprintf(outfile, "}\n");
1855                                            } else {
1856                                                            fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | (((long)%s - (long)gen_code_ptr - %d) & 0x03fffffc);\n",
1857                                                                                            slide, slide, final_sym_name, slide);
1858                                            }
1859                                                  break;                                                  break;
1860                                          case PPC_RELOC_HI16:                                          case PPC_RELOC_HI16:
1861                                                  fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d) >> 16;\n",                                                  fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d) >> 16;\n",

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

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