Diff for /gforth/engine/main.c between versions 1.45 and 1.46

version 1.45, 2001/09/12 14:45:10 version 1.46, 2001/09/16 08:59:48
Line 126  int gforth_memcmp(const char * s1, const Line 126  int gforth_memcmp(const char * s1, const
  * If the word is <CF(DOESJUMP), it's a primitive   * If the word is <CF(DOESJUMP), it's a primitive
  */   */
   
 void relocate(Cell *image, const char *bitstring, int size, int base, Label symbols[])  void relocate(Cell *image, const char *bitstring, 
                 int size, int base, Label symbols[])
 {  {
   int i=0, j, k, steps=(size/sizeof(Cell))/RELINFOBITS;    int i=0, j, k, steps=(size/sizeof(Cell))/RELINFOBITS;
   Cell token;    Cell token;
   char bits;    char bits;
   Cell max_symbols;    Cell max_symbols;
   /** A virtial start address that's the real start address minus the one in the image */    /* 
      * A virtial start address that's the real start address minus 
      * the one in the image 
      */
   Cell *start = (Cell * ) (((void *) image) - ((void *) base));    Cell *start = (Cell * ) (((void *) image) - ((void *) base));
   
   /* printf("relocating to %x[%x] start=%x base=%x\n", image, size, start, base); */    
   /* printf("relocating to %x[%x] start=%x base=%x\n", image, size, start, base); */
       
   for (max_symbols=DOESJUMP+1; symbols[max_symbols]!=0; max_symbols++)    for (max_symbols=DOESJUMP+1; symbols[max_symbols]!=0; max_symbols++)
     ;      ;
Line 171  void relocate(Cell *image, const char *b Line 176  void relocate(Cell *image, const char *b
               else                else
                 fprintf(stderr,"Primitive %d used in this image at $%lx is not implemented by this\n engine (%s); executing this code will crash.\n",CF(token),(long)&image[i],VERSION);                  fprintf(stderr,"Primitive %d used in this image at $%lx is not implemented by this\n engine (%s); executing this code will crash.\n",CF(token),(long)&image[i],VERSION);
             }              }
         else          else {
           // if base is > 0: 0 is a null reference so don't adjust            // if base is > 0: 0 is a null reference so don't adjust
           if (token>=base) {            if (token>=base) {
             image[i]+=(Cell)start;              image[i]+=(Cell)start;
           }            }
           }
       }        }
     }      }
   }    }
Line 499  Address loader(FILE *imagefile, char* fi Line 505  Address loader(FILE *imagefile, char* fi
   imp=image+preamblesize;    imp=image+preamblesize;
   if (clear_dictionary)    if (clear_dictionary)
     memset(imp+header.image_size, 0, dictsize-header.image_size);      memset(imp+header.image_size, 0, dictsize-header.image_size);
   {    if(header.base==0 || header.base  == 0x100) {
     Cell reloc_size=((header.image_size-1)/sizeof(Cell))/8+1;      Cell reloc_size=((header.image_size-1)/sizeof(Cell))/8+1;
     char reloc_bits[reloc_size];      char reloc_bits[reloc_size];
     fseek(imagefile, preamblesize+header.image_size, SEEK_SET);      fseek(imagefile, preamblesize+header.image_size, SEEK_SET);
Line 513  Address loader(FILE *imagefile, char* fi Line 519  Address loader(FILE *imagefile, char* fi
     }      }
 #endif  #endif
   }    }
     else if(header.base!=imp) {
       fprintf(stderr,"%s: Cannot load nonrelocatable image (compiled for address $%lx) at address $%lx\n",
               progname, (unsigned long)header.base, (unsigned long)imp);
       exit(1);
     }
   if (header.checksum==0)    if (header.checksum==0)
     ((ImageHeader *)imp)->checksum=check_sum;      ((ImageHeader *)imp)->checksum=check_sum;
   else if (header.checksum != check_sum) {    else if (header.checksum != check_sum) {

Removed from v.1.45  
changed lines
  Added in v.1.46


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>