From 982d724f3fc21c78e33f65e2fe3d2cce6482a4f9 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Mon, 22 Dec 2014 15:06:08 -0500 Subject: ich9deblob: reduce compatibility checks to a single function call --- (limited to 'resources/utilities/ich9deblob/ich9deblob.c') diff --git a/resources/utilities/ich9deblob/ich9deblob.c b/resources/utilities/ich9deblob/ich9deblob.c index 32c2f1f..ad4960c 100644 --- a/resources/utilities/ich9deblob/ich9deblob.c +++ b/resources/utilities/ich9deblob/ich9deblob.c @@ -65,6 +65,7 @@ int systemIsBigEndian(); int structBitfieldWrongOrder(); int structMembersWrongOrder(); struct GBEREGIONRECORD_8K deblobbedGbeStructFromFactory(struct GBEREGIONRECORD_8K factoryGbeStruct8k); +int systemOrCompilerIncompatible(struct DESCRIPTORREGIONRECORD descriptorStruct, struct GBEREGIONRECORD_8K gbeStruct8k); int main(int argc, char *argv[]) { @@ -101,10 +102,7 @@ int main(int argc, char *argv[]) // ----------------------------------------------------------------------------------------------- // Compatibility checks. This version of ich9deblob is not yet porable. - if (structSizesIncorrect(factoryDescriptorStruct, factoryGbeStruct8k)) return 1; - if (systemIsBigEndian()) return 1; - if (structBitfieldWrongOrder()) return 1; - if (structMembersWrongOrder()) return 1; + if (systemOrCompilerIncompatible(factoryDescriptorStruct, factoryGbeStruct8k)) return 1; // ----------------------------------------------------------------------------------------------- @@ -390,6 +388,16 @@ int structBitfieldWrongOrder() { return 0; } +// Compatibility checks. This version of ich9deblob is not yet porable. +int systemOrCompilerIncompatible(struct DESCRIPTORREGIONRECORD descriptorStruct, struct GBEREGIONRECORD_8K gbeStruct8k) +{ + if (structSizesIncorrect(descriptorStruct, gbeStruct8k)) return 1; + if (systemIsBigEndian()) return 1; + if (structBitfieldWrongOrder()) return 1; + if (structMembersWrongOrder()) return 1; + return 0; +} + struct GBEREGIONRECORD_8K deblobbedGbeStructFromFactory(struct GBEREGIONRECORD_8K factoryGbeStruct8k) { // Correct the main gbe region. By default, the X200 (as shipped from Lenovo) comes -- cgit v0.9.1