| /* printf("relocating %x[%x]\n", image, size); */ |
/* printf("relocating %x[%x]\n", image, size); */ |
| |
|
| for(k=0; k<=steps; k++) |
for(k=0; k<=steps; k++) |
| for(j=0, bits=bitstring[k]; j<8; j++, i++, bits<<=1) |
for(j=0, bits=bitstring[k]; j<8; j++, i++, bits<<=1) { |
| if(bits & 0x80) |
/* fprintf(stderr,"relocate: image[%d]\n", i);*/ |
| |
if(bits & 0x80) { |
| |
/* fprintf(stderr,"relocate: image[%d]=%d\n", i, image[i]);*/ |
| if(image[i]<0) |
if(image[i]<0) |
| switch(image[i]) |
switch(image[i]) |
| { |
{ |
| else |
else |
| image[i]+=(Cell)image; |
image[i]+=(Cell)image; |
| } |
} |
| |
} |
| |
} |
| |
|
| UCell checksum(Label symbols[]) |
UCell checksum(Label symbols[]) |
| { |
{ |
| fprintf(stderr,"try mmap($%lx, $%lx, ..., MAP_ANON, ...); ", (long)next_address, (long)size); |
fprintf(stderr,"try mmap($%lx, $%lx, ..., MAP_ANON, ...); ", (long)next_address, (long)size); |
| r=mmap(next_address, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); |
r=mmap(next_address, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); |
| #else /* !defined(MAP_ANON) */ |
#else /* !defined(MAP_ANON) */ |
| |
/* Ultrix (at least does not define MAP_FILE and MAP_PRIVATE (both are |
| |
apparently defaults*/ |
| |
#ifndef MAP_FILE |
| |
# define MAP_FILE 0 |
| |
#endif |
| |
#ifndef MAP_PRIVATE |
| |
# define MAP_PRIVATE 0 |
| |
#endif |
| static int dev_zero=-1; |
static int dev_zero=-1; |
| |
|
| if (dev_zero == -1) |
if (dev_zero == -1) |
| {"help", no_argument, NULL, 'h'}, |
{"help", no_argument, NULL, 'h'}, |
| /* put something != 0 into offset_image */ |
/* put something != 0 into offset_image */ |
| {"offset-image", no_argument, &offset_image, 1}, |
{"offset-image", no_argument, &offset_image, 1}, |
| |
{"no-offset-im", no_argument, &offset_image, 0}, |
| {"clear-dictionary", no_argument, &clear_dictionary, 1}, |
{"clear-dictionary", no_argument, &clear_dictionary, 1}, |
| {"debug", no_argument, &debug, 1}, |
{"debug", no_argument, &debug, 1}, |
| {0,0,0,0} |
{0,0,0,0} |