[Vm-dev] magic decode for image files

David T. Lewis lewis at mail.msen.com
Wed Apr 12 00:37:31 UTC 2017


On Tue, Apr 11, 2017 at 07:34:41PM +0530, K K Subbu wrote:
> 
> On Tuesday 11 April 2017 05:33 PM, David T. Lewis wrote:
> >Thanks, I added it to ImageFormat. One thing needed changing for 64-bit
> >formats on little-endian, where the format number is written to the second
> >four bytes (offset 4).
> 
> Is that in addition to the magic numbers in the first 4b? Then we need 
> to modify the match pattern.

Sorry, I said that backwards. It is the big endian versions that offset
the format number by four bytes. That was an artifact of the way that image
file headers were written in the original 64-bit image (circa 2005) and
is true of 64-bit V3 images since then. The original 64-bit distribution
was done on a big-endian machine, and those files are still on line at 
http://squeakvm.org/squeak64/dist3/.

The 64-bit Spur image changes this, so the image format number is in the
first 4 bytes as you would expect. That would be true on a big-endian
machine also (although I do not know of any such implementation).

For Spur, the 64-bit magic decode should probably be this:

0	lelong	68021	Smalltalk image Spur 64-bit closure native float (68021)
0	belong	68021	Smalltalk image Spur 64-bit closure native float (68021)


> 
> Thank you very much. Each of these lines can be followed by:
> 
> !:mime application/squeak-image
> 
> or appropriate mime type for cog and spur. They can be used to generate 
> *.desktop files for launching the right VMs.
> 
> Which vm and base image do you use for your work?

My working image in 64-bit Spur, Squeak trunk.

I use various Spur, Cog, and interpreter VMs, and various images. I regularly
use interpreter VMs in addition to Spur.

On my machine /usr/local/bin/squeak is always the standard interpreter VM
start script, which runs 32-bit and 64-bit V3 images. The Cog/Spur VMs are
/usr/local/bin/cog, /usr/local/bin/spur, and /usr/local/bin/spur64. The
/usr/local/bin/run script selects from these based on image format.

> 
> I am on Ubuntu 16.04 (64-bit). Its squeak-vm package is very old 
> (4.10.2).

I always compile the interprer VM locally, which produces a 64-bit VM
for the 32-bit V3 image (no 32-bit libraries). Google "squeak interpreter
vm recipe" for the instructions (http://wiki.squeak.org/squeak/6354).

> I also have the Squeak 5 (5.0-3397) but that is also old I 
> guess. I tried buildspurtrunkvmmakerimage.sh from opensmalltalk-vm git 
> but it takes ages throws up errors in ClassBuilder while building 
> SpurVMMaker.image :-(. The image got built but I am not sure if I got 
> all the stuff in.
> 
> Regards .. Subbu

I sometimes compile Spur VMs locally, but it is a bit of a trick to get
all the libraries set up, and the old autotools build system is no fun.
I usually use VMs from squeak.org or the latest from the bintray site
instead.

Dave



More information about the Vm-dev mailing list