Changeset 9459


Ignore:
Timestamp:
May 13, 2008, 2:05:33 AM (11 years ago)
Author:
rme
Message:

dnode_forwarding_address for x8632 (copied from ppc32), other x8632 hacking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ia32/lisp-kernel/x86-gc.c

    r9380 r9459  
    5050#endif
    5151
    52 int
    53 function_code_words(LispObj *f)
    54 {
    55 #ifdef X8664
    56   return (int)f[1];
    57 #else
    58   return (unsigned short)f[1];
    59 #endif
    60 }
    61 
    6252void
    6353comma_output_decimal(char *buf, int len, natural n)
     
    155145      LispObj fun;
    156146
    157       if (*((unsigned char *)n) == RECOVER_FN_OPCODE) {
    158         fun = (LispObj)(*((natural *)(n + 1)));
    159       }
     147      if (*(unsigned char *)n == RECOVER_FN_OPCODE)
     148        fun = *(LispObj *)(n + 1);
    160149      if (fun == 0 ||
    161150         (header_subtag(header_of(fun)) != subtag_function) ||
     
    368357#ifdef X8632
    369358  if (tag_n == fulltag_tra) {
    370     unsigned char *p = (unsigned char *)n;
    371 
    372     if (*p == RECOVER_FN_OPCODE) {
    373       n = *(LispObj *)(p + 1);
     359    if (*(unsigned char *)n == RECOVER_FN_OPCODE) {
     360      n = *(LispObj *)(n + 1);
    374361      tag_n = fulltag_misc;
    375362    } else
     
    495482        prefix_nodes = (natural) ((int) deref(base,1));
    496483#endif
    497         prefix_nodes = (natural)function_code_words(base);
    498484        if (prefix_nodes > element_count) {
    499485          Bug(NULL, "Function 0x%lx trashed",n);
     
    575561#ifdef X8632
    576562  if (tag_n == fulltag_tra) {
    577     unsigned char *p = (unsigned char *)n;
    578 
    579     if (*p == RECOVER_FN_OPCODE) {
    580       n = *(LispObj *)(p + 1);
     563    if (*(unsigned char *)n == RECOVER_FN_OPCODE) {
     564      n = *(LispObj *)(n + 1);
    581565      tag_n = fulltag_misc;
    582     } else
     566    } else {
    583567      return;
     568    }
    584569  }
    585570#endif
     
    720705    }
    721706  } else {
     707#ifdef X8632
     708    fprintf(stderr, "probably in trouble here\n");
     709#endif
    722710    /* This is all a bit more complicated than the PPC version:
    723711
     
    910898#else
    911899    if (tag_n == fulltag_tra) {
    912       unsigned char *p = (unsigned char *)n;
    913       LispObj fn = *(LispObj *)(p + 1);
     900      LispObj fn = *(LispObj *)(n + 1);
    914901
    915902      base = (LispObj *)untag(fn);
     
    17391726  int i;
    17401727
    1741   for (i = 0; i < 8; i ++) {
    1742     if (node_regs_mask & (1<<i)) {
     1728  for (i = 0; i < 8; i++)
     1729    if (node_regs_mask & (1<<i))
    17431730      mark_root(regs[i]);
    1744     }
    1745   }
     1731
    17461732  /* If the EIP isn't pointing into a marked function, we're probably
    17471733     in trouble.  We can -maybe- recover from that if it's tagged as a
     
    17551741    } else if ((fulltag_of(eip) == fulltag_misc) &&
    17561742               (header_subtag(header_of(eip)) == subtag_function) &&
    1757                (*((unsigned char *)(eip)) == RECOVER_FN_OPCODE) &&
    1758                ((LispObj)(*((natural *)(eip + 1))) == eip)) {
     1743               (*(unsigned char *)eip == RECOVER_FN_OPCODE) &&
     1744               (*(LispObj *)(eip + 1)) == eip) {
    17591745      mark_root(eip);
    17601746    } else {
    1761       Bug(NULL, "Can't find function for eip 0x%8x", eip);
     1747      Bug(NULL, "Can't find function for eip 0x%4x", eip);
    17621748    }
    17631749  }
     
    18031789#endif
    18041790  }
     1791#ifdef X8632
     1792  mark_root(tcr->save0);
     1793  mark_root(tcr->save1);
     1794  mark_root(tcr->save2);
     1795  mark_root(tcr->save3);
     1796  mark_root(tcr->next_method_context);
     1797#endif
    18051798 
    18061799  for (xframes = (xframe_list *) tcr->xframe;
     
    18101803      mark_xp(xframes->curr);
    18111804#else
    1812       mark_xp(xframes->curr, tcr->node_regs_mask);
    1813 #endif
    1814   }
    1815 
    1816 #ifdef X8632
    1817   mark_root(tcr->save0);
    1818   mark_root(tcr->save1);
    1819   mark_root(tcr->save2);
    1820   mark_root(tcr->save3);
    1821   mark_root(tcr->next_method_context);
    1822 #endif
     1805      mark_xp(xframes->curr, xframes->node_regs_mask);
     1806#endif
     1807  }
    18231808}
    18241809     
     
    20502035}
    20512036#else
    2052 
     2037#ifdef X8664
    20532038/* Quicker, dirtier */
    20542039LispObj
     
    20762061  return new;
    20772062}
     2063#endif
     2064#ifdef X8632
     2065LispObj
     2066dnode_forwarding_address(natural dnode, int tag_n)
     2067{
     2068  natural pagelet, nbits;
     2069  unsigned short near_bits;
     2070  LispObj new;
     2071
     2072  if (GCDebug) {
     2073    if (! ref_bit(GCdynamic_markbits, dnode)) {
     2074      Bug(NULL, "unmarked object being forwarded!\n");
     2075    }
     2076  }
     2077
     2078  pagelet = dnode >> 5;
     2079  nbits = dnode & 0x1f;
     2080  near_bits = ((unsigned short *)GCdynamic_markbits)[dnode>>4];
     2081
     2082  if (nbits < 16) {
     2083    new = GCrelocptr[pagelet] + tag_n;;
     2084    /* Increment "new" by the count of 1 bits which precede the dnode */
     2085    if (near_bits == 0xffff) {
     2086      return (new + (nbits << 3));
     2087    } else {
     2088      near_bits &= (0xffff0000 >> nbits);
     2089      if (nbits > 7) {
     2090        new += one_bits(near_bits & 0xff);
     2091      }
     2092      return (new + (one_bits(near_bits >> 8)));
     2093    }
     2094  } else {
     2095    new = GCrelocptr[pagelet+1] + tag_n;
     2096    nbits = 32-nbits;
     2097
     2098    if (near_bits == 0xffff) {
     2099      return (new - (nbits << 3));
     2100    } else {
     2101      near_bits &= (1<<nbits)-1;
     2102      if (nbits > 7) {
     2103        new -= one_bits(near_bits >> 8);
     2104      }
     2105      return (new - one_bits(near_bits & 0xff));
     2106    }
     2107  }
     2108}
     2109#endif
    20782110#endif
    20792111
     
    23382370}
    23392371
    2340 
    23412372void
    23422373forward_xp(ExceptionInformation *xp)
     
    23572388  update_noderef(&(regs[Itemp2]));
    23582389  update_locref(&(regs[Iip]));
    2359 #endif
    2360 }
     2390#else
     2391  update_noderef(&(regs[Iarg_z]));
     2392  update_noderef(&(regs[Iarg_y]));
     2393  update_noderef(&(regs[Ifn]));
     2394  update_noderef(&(regs[Itemp0]));
     2395  update_noderef(&(regs[Itemp1]));
     2396  update_locref(&(regs[Iip]));
     2397#endif
     2398}
     2399
    23612400
    23622401void
     
    26202659        }
    26212660      }
    2622  
    2623     }
    2624 
     2661    }
    26252662  }
    26262663  return ptr_to_lispobj(dest);
     
    33393376          if (header_subtag(header) == subtag_function) {
    33403377#ifdef X8632
    3341             int skip = (int)((unsigned short*)start[2]);
     3378            int skip = (unsigned short)(start[1]);
    33423379#else
    33433380            int skip = (int)(start[1]);
Note: See TracChangeset for help on using the changeset viewer.