return -1;
}
- if ( ihdr.version != IHDR_VERSION )
+ if ( ihdr.version != 2 )
{
- ERROR("Invalid Version: Expected %d, Got %d",
- IHDR_VERSION, ihdr.version);
+ ERROR("Invalid Version: Expected 2, Got %d",
+ ihdr.version);
return -1;
}
struct xc_sr_ihdr ihdr = {
.marker = IHDR_MARKER,
.id = htonl(IHDR_ID),
- .version = htonl(IHDR_VERSION),
+ .version = htonl(2),
.options = htons(IHDR_OPT_LITTLE_ENDIAN),
};
struct xc_sr_dhdr dhdr = {
#define IHDR_MARKER 0xffffffffffffffffULL
#define IHDR_ID 0x58454E46U
-#define IHDR_VERSION 2
#define _IHDR_OPT_ENDIAN 0
#define IHDR_OPT_LITTLE_ENDIAN (0 << _IHDR_OPT_ENDIAN)
stream_write(pack(libxc.IHDR_FORMAT,
libxc.IHDR_MARKER, # Marker
libxc.IHDR_IDENT, # Ident
- libxc.IHDR_VERSION, # Version
+ 2, # Version
libxc.IHDR_OPT_LE, # Options
0, 0)) # Reserved
usage = ("%prog [options] -i INPUT -o OUTPUT"
" -w WIDTH -g GUEST"),
description =
- "Convert a legacy stream to a v2 stream")
+ "Convert a legacy stream to a v2 (or later) stream")
# Required options
parser.add_option("-i", "--in", dest = "fin", metavar = "<FD or FILE>",
help = "Legacy input to convert")
parser.add_option("-o", "--out", dest = "fout", metavar = "<FD or FILE>",
- help = "v2 format output")
+ help = "v2 (or later) format output")
parser.add_option("-w", "--width", dest = "twidth",
metavar = "<32/64>", choices = ["32", "64"],
help = "Legacy toolstack bitness")
parser = OptionParser(usage = "%prog [options]",
description =
- "Verify a stream according to the v2 spec")
+ "Verify a stream according to the v2 (or later) spec")
# Optional options
parser.add_option("-i", "--in", dest = "fin", metavar = "<FD or FILE>",
IHDR_MARKER = 0xffffffffffffffff
IHDR_IDENT = 0x58454E46 # "XENF" in ASCII
-IHDR_VERSION = 2
IHDR_OPT_BIT_ENDIAN = 0
IHDR_OPT_LE = (0 << IHDR_OPT_BIT_ENDIAN)
HVM_PARAMS_FORMAT = "II"
class VerifyLibxc(VerifyBase):
- """ Verify a Libxc v2 stream """
+ """ Verify a Libxc v2 (or later) stream """
def __init__(self, info, read):
VerifyBase.__init__(self, info, read)
raise StreamError("Bad image id: Expected 0x%x, got 0x%x" %
(IHDR_IDENT, ident))
- if version != IHDR_VERSION:
- raise StreamError("Unknown image version: Expected %d, got %d" %
- (IHDR_VERSION, version))
+ if version != 2:
+ raise StreamError("Unknown image version: Expected 2, got %d" %
+ (version, ))
if options & IHDR_OPT_RESZ_MASK:
raise StreamError("Reserved bits set in image options field: 0x%x" %