From 01eff2d388cdde7dfa4f4ef020a97c67638b8363 Mon Sep 17 00:00:00 2001 From: Alexander Ivanov Date: Wed, 9 Aug 2023 12:48:20 +0200 Subject: [PATCH 1/2] Add configuration section handling Signed-off-by: Alexander Ivanov --- lqs2mem.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lqs2mem.c b/lqs2mem.c index 1b6524a..62b7e8a 100644 --- a/lqs2mem.c +++ b/lqs2mem.c @@ -578,6 +578,7 @@ int main(int argc, char *argv[]) uint32_t instance_id; uint32_t version_id; int done; + uint32_t name_len, i; while (1) { opt = getopt(argc, argv, "d:lw:"); @@ -699,6 +700,12 @@ int main(int argc, char *argv[]) DEBUG(SECTION_INFO, "section_id : %u (%s)\n", section_id, secinfo ? secinfo->idstr : "NULL"); + } else if (section_type == QEMU_VM_CONFIGURATION) { + name_len = qemu_get_be32(infp); + for (i = 0; i < name_len; i++) { + qemu_get_byte(infp); + } + continue; } else { printf("Invalid section type: %d\n", section_type); return -1; From b9e2b65d3efb37b3af0585cb716655a6b336e210 Mon Sep 17 00:00:00 2001 From: Alexander Ivanov Date: Wed, 9 Aug 2023 12:49:06 +0200 Subject: [PATCH 2/2] Add sections footers handling Signed-off-by: Alexander Ivanov --- lqs2mem.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lqs2mem.c b/lqs2mem.c index 62b7e8a..900131c 100644 --- a/lqs2mem.c +++ b/lqs2mem.c @@ -573,6 +573,7 @@ int main(int argc, char *argv[]) uint64_t offset; uint8_t section_type; uint32_t section_id; + uint32_t footer_section_id; uint8_t idstr_len; char idstr[256]; uint32_t instance_id; @@ -706,6 +707,13 @@ int main(int argc, char *argv[]) qemu_get_byte(infp); } continue; + } else if (section_type == QEMU_VM_SECTION_FOOTER) { + footer_section_id = qemu_get_be32(infp); + if (footer_section_id != section_id) { + printf("Incorrect section footer: %x != %x\n", footer_section_id, section_id); + return -1; + } + continue; } else { printf("Invalid section type: %d\n", section_type); return -1;