[Vm-dev] Issue 101 in cog: Snapshot primitive with 512byte image header

David T. Lewis lewis at mail.msen.com
Sun Oct 14 16:50:49 UTC 2012

On Sun, Oct 14, 2012 at 11:09:25AM +0000, cog at googlecode.com wrote:
> Status: Accepted
> Owner: camillob... at gmail.com
> Labels: Type-Defect Priority-Medium
> New issue 101 by camillob... at gmail.com: Snapshot primitive with 512byte  
> image header
> http://code.google.com/p/cog/issues/detail?id=101
> I would like to add proper shebang support to our image files.
> Hence I need a proper primitive which allows me to inject the 512bytes  
> header with a proper shebang (or other user data..)
> This could be handled the same way as the quit primitive by checking for an 
> optional argument, the header, and pass it along to #writeImageFile:

FYI, the hook for this is a macro in platforms/Cross/vm/sq.h:

  #define sqImageFileStartLocation(fileRef, fileName, size)  0

If you implement this as a function that writes the shebang line followed
by <lf>, and pads with null for the first 512 bytes, then answers 512 as
the result, you will have what you want. You should probably set the image
file writable while you're at it.


More information about the Vm-dev mailing list