version 1.20, 1999/01/17 13:50:53
|
version 1.21, 1999/01/17 14:09:13
|
Line 346 int go_forth(Address image, int stack, C
|
Line 346 int go_forth(Address image, int stack, C
|
return((int)engine(ip0,sp0,rp0,fp0,lp0)); |
return((int)engine(ip0,sp0,rp0,fp0,lp0)); |
} |
} |
|
|
|
|
|
void print_sizes(Cell sizebyte) |
|
/* print size information */ |
|
{ |
|
static char* endianstring[]= { " big","little" }; |
|
|
|
fprintf(stderr,"%s endian, cell=%d bytes, char=%d bytes, au=%d bytes\n", |
|
endianstring[sizebyte & 1], |
|
1 << ((sizebyte >> 1) & 3), |
|
1 << ((sizebyte >> 3) & 3), |
|
1 << ((sizebyte >> 5) & 3)); |
|
} |
|
|
#ifndef INCLUDE_IMAGE |
#ifndef INCLUDE_IMAGE |
Address loader(FILE *imagefile, char* filename) |
Address loader(FILE *imagefile, char* filename) |
/* returns the address of the image proper (after the preamble) */ |
/* returns the address of the image proper (after the preamble) */ |
Line 359 Address loader(FILE *imagefile, char* fi
|
Line 372 Address loader(FILE *imagefile, char* fi
|
Label *symbols = engine(0,0,0,0,0); |
Label *symbols = engine(0,0,0,0,0); |
Cell data_offset = offset_image ? 56*sizeof(Cell) : 0; |
Cell data_offset = offset_image ? 56*sizeof(Cell) : 0; |
UCell check_sum; |
UCell check_sum; |
static char* endianstring[]= { "big","little" }; |
|
Cell ausize = ((RELINFOBITS == 8) ? 0 : |
Cell ausize = ((RELINFOBITS == 8) ? 0 : |
(RELINFOBITS == 16) ? 1 : |
(RELINFOBITS == 16) ? 1 : |
(RELINFOBITS == 32) ? 2 : 3); |
(RELINFOBITS == 32) ? 2 : 3); |
Line 369 Address loader(FILE *imagefile, char* fi
|
Line 381 Address loader(FILE *imagefile, char* fi
|
Cell cellsize = ((sizeof(Cell) == 1) ? 0 : |
Cell cellsize = ((sizeof(Cell) == 1) ? 0 : |
(sizeof(Cell) == 2) ? 1 : |
(sizeof(Cell) == 2) ? 1 : |
(sizeof(Cell) == 4) ? 2 : 3) + ausize; |
(sizeof(Cell) == 4) ? 2 : 3) + ausize; |
|
Cell sizebyte = (ausize << 5) + (charsize << 3) + (cellsize << 1) + |
|
#ifdef WORDS_BIGENDIAN |
|
0 |
|
#else |
|
1 |
|
#endif |
|
; |
|
|
#ifndef DOUBLY_INDIRECT |
#ifndef DOUBLY_INDIRECT |
check_sum = checksum(symbols); |
check_sum = checksum(symbols); |
Line 388 Address loader(FILE *imagefile, char* fi
|
Line 406 Address loader(FILE *imagefile, char* fi
|
magic7 = magic[7]; |
magic7 = magic[7]; |
if (debug) { |
if (debug) { |
magic[7]='\0'; |
magic[7]='\0'; |
fprintf(stderr,"Magic found: %s %s endian, cell=%d bytes, char=%d bytes, au=%d bytes\n", |
fprintf(stderr,"Magic found: %s ", magic); |
magic, |
print_sizes(magic7); |
endianstring[magic7 & 1], |
|
1 << ((magic7 >> 1) & 3), |
|
1 << ((magic7 >> 3) & 3), |
|
1 << ((magic7 >> 5) & 3)); |
|
} |
} |
|
|
if(magic7 != (ausize << 5) + (charsize << 3) + (cellsize << 1) + |
if (magic7 != sizebyte) |
#ifdef WORDS_BIGENDIAN |
{ |
0 |
fprintf(stderr,"This image is: "); |
#else |
print_sizes(magic7); |
1 |
fprintf(stderr,"whereas the machine is "); |
#endif |
print_sizes(sizebyte); |
) |
|
{ fprintf(stderr,"This image is %d bit cell, %d bit char, %d bit address unit %s-endian,\n" |
|
"whereas the machine is %d bit cell, %d bit char, %d bit address unit, %s-endian.\n", |
|
(1<<((magic7>>1)&3))*8, |
|
(1<<((magic7>>3)&3))*8, |
|
(1<<((magic7>>5)&3))*8, |
|
endianstring[magic7&1], |
|
(1<<cellsize)*8, |
|
(1<<charsize)*8, |
|
(1<<ausize)*8, |
|
endianstring[ |
|
#ifdef WORDS_BIGENDIAN |
|
0 |
|
#else |
|
1 |
|
#endif |
|
]); |
|
exit(-2); |
exit(-2); |
}; |
}; |
|
|