summaryrefslogtreecommitdiff
path: root/pc-bios/s390-ccw/bootmap.h
diff options
context:
space:
mode:
authorMaxim Samoylov <max7255@linux.vnet.ibm.com>2015-10-12 17:50:20 +0200
committerCornelia Huck <cornelia.huck@de.ibm.com>2015-11-11 17:21:39 +0100
commit869648e87eeb998cc0ede230f3b7aabfdf0eb2dd (patch)
tree2a2d75a4c23ec8ac747defaf0ddad4d4b686454a /pc-bios/s390-ccw/bootmap.h
parentba21f0cca8165c5b284274edd12dc955cf4fb248 (diff)
downloadqemu-869648e87eeb998cc0ede230f3b7aabfdf0eb2dd.tar.gz
pc-bios/s390-ccw: El Torito 16-bit boot image size field workaround
Because of El Torito spec flaw boot image size needs to be verified. Boot catalog entry size field has 16-bit width, and specifies size in 512-byte units. Thus, boot image size cannot exceed 32M. We actually search for the file to get the file size. This is done by scanning the ISO directory tree for the ISO block number and reading the file size from the directory entry. Signed-off-by: Maxim Samoylov <max7255@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'pc-bios/s390-ccw/bootmap.h')
-rw-r--r--pc-bios/s390-ccw/bootmap.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h
index cc77fd753c..f98765b841 100644
--- a/pc-bios/s390-ccw/bootmap.h
+++ b/pc-bios/s390-ccw/bootmap.h
@@ -381,6 +381,11 @@ static inline uint64_t bswap64(uint64_t x)
((x & 0xff00000000000000ULL) >> 56);
}
+static inline uint32_t iso_733_to_u32(uint64_t x)
+{
+ return (uint32_t)x;
+}
+
#define ISO_SECTOR_SIZE 2048
/* El Torito specifies boot image size in 512 byte blocks */
#define ET_SECTOR_SHIFT 2
@@ -407,6 +412,8 @@ static inline void read_iso_boot_image(uint32_t block_offset, void *load_addr,
const uint8_t el_torito_magic[] = "EL TORITO SPECIFICATION"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
+#define ISO9660_MAX_DIR_DEPTH 8
+
typedef struct IsoDirHdr {
uint8_t dr_len;
uint8_t ear_len;