diff --git a/common/ffsparser.cpp b/common/ffsparser.cpp index 2ac2969..dc7cd60 100644 --- a/common/ffsparser.cpp +++ b/common/ffsparser.cpp @@ -1540,7 +1540,7 @@ continue_searching: {} if (restSize < fdmHeader->Size) continue; - if (fdmHeader->Revision > 3) { + if (fdmHeader->Revision > 4) { msg(usprintf("%s: Insyde Flash Device Map candidate with unknown revision %u", __FUNCTION__, fdmHeader->Revision), index); continue; } diff --git a/common/generated/insyde_fdm.cpp b/common/generated/insyde_fdm.cpp index 4306965..e5942d0 100644 --- a/common/generated/insyde_fdm.cpp +++ b/common/generated/insyde_fdm.cpp @@ -1,7 +1,6 @@ // This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild #include "insyde_fdm.h" -#include "../kaitai/exceptions.h" insyde_fdm_t::insyde_fdm_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, insyde_fdm_t* p__root) : kaitai::kstruct(p__io) { m__parent = p__parent; @@ -16,29 +15,23 @@ insyde_fdm_t::insyde_fdm_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, i void insyde_fdm_t::_read() { m_signature = m__io->read_u4le(); - if (!(signature() == 1296320072)) { - throw kaitai::validation_not_equal_error(1296320072, signature(), _io(), std::string("/seq/0")); - } m_store_size = m__io->read_u4le(); m_data_offset = m__io->read_u4le(); m_entry_size = m__io->read_u4le(); m_entry_format = m__io->read_u1(); m_revision = m__io->read_u1(); - if (!( ((revision() == 1) || (revision() == 2) || (revision() == 3)) )) { - throw kaitai::validation_not_any_of_error(revision(), _io(), std::string("/seq/5")); - } m_num_extensions = m__io->read_u1(); m_checksum = m__io->read_u1(); m_fd_base_address = m__io->read_u8le(); n_extensions = true; - if (revision() == 3) { + if (revision() > 2) { n_extensions = false; m__raw_extensions = m__io->read_bytes((num_extensions() * 4)); m__io__raw_extensions = std::unique_ptr(new kaitai::kstream(m__raw_extensions)); m_extensions = std::unique_ptr(new fdm_extensions_t(m__io__raw_extensions.get(), this, m__root)); } n_board_ids = true; - if ( ((revision() == 3) && (extensions()->extensions()->at(1)->count() > 0)) ) { + if ( ((revision() > 2) && (extensions()->extensions()->at(1)->count() > 0)) ) { n_board_ids = false; m_board_ids = std::unique_ptr(new fdm_board_ids_t(m__io, this, m__root)); } diff --git a/common/ksy/insyde_fdm.ksy b/common/ksy/insyde_fdm.ksy index 168f6ee..50e06b4 100644 --- a/common/ksy/insyde_fdm.ksy +++ b/common/ksy/insyde_fdm.ksy @@ -12,7 +12,6 @@ meta: seq: - id: signature type: u4 - valid: 0x4D444648 # HFDM - id: store_size type: u4 - id: data_offset @@ -23,8 +22,6 @@ seq: type: u1 - id: revision type: u1 - valid: - any-of: [1, 2, 3] - id: num_extensions type: u1 - id: checksum @@ -34,10 +31,11 @@ seq: - id: extensions type: fdm_extensions size: num_extensions * sizeof - if: revision == 3 + if: revision > 2 - id: board_ids type: fdm_board_ids - if: revision == 3 and extensions.extensions[1].count > 0 + if: revision > 2 and extensions.extensions[1].count > 0 +#TODO: need to find a sample with revision == 4 and extensions.extensions[2].count > 0 - id: entries type: fdm_entries size: store_size - data_offset