summaryrefslogtreecommitdiffstats
path: root/resources/utilities/ich9deblob/src/common
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2015-01-10 18:07:56 (EST)
committer Francis Rowe <info@gluglug.org.uk>2015-01-10 18:07:56 (EST)
commitf6da483213c5a9ad026c2740eeff120414492a40 (patch)
tree72c62f49cc617a15a023134c26679c30133aacab /resources/utilities/ich9deblob/src/common
parent74adfa0f8c41754d1a74006b6ca5f923fd2af503 (diff)
downloadlibreboot-f6da483213c5a9ad026c2740eeff120414492a40.zip
libreboot-f6da483213c5a9ad026c2740eeff120414492a40.tar.gz
libreboot-f6da483213c5a9ad026c2740eeff120414492a40.tar.bz2
ich9deblob/ich9gen: use portable data types
For those integers that need to be a certain byte size.
Diffstat (limited to 'resources/utilities/ich9deblob/src/common')
-rw-r--r--resources/utilities/ich9deblob/src/common/descriptor_gbe.c8
-rw-r--r--resources/utilities/ich9deblob/src/common/descriptor_gbe.h1
-rw-r--r--resources/utilities/ich9deblob/src/common/x86compatibility.c10
-rw-r--r--resources/utilities/ich9deblob/src/common/x86compatibility.h1
4 files changed, 11 insertions, 9 deletions
diff --git a/resources/utilities/ich9deblob/src/common/descriptor_gbe.c b/resources/utilities/ich9deblob/src/common/descriptor_gbe.c
index ca50ac0..581f755 100644
--- a/resources/utilities/ich9deblob/src/common/descriptor_gbe.c
+++ b/resources/utilities/ich9deblob/src/common/descriptor_gbe.c
@@ -31,8 +31,8 @@ int notCreatedDescriptorGbeFile(struct DESCRIPTORREGIONRECORD descriptorStruct,
FILE* fileStream = NULL;
/* These will have the structs copied to them */
- char descriptorBuffer[DESCRIPTORREGIONSIZE];
- char gbeBuffer8k[GBEREGIONSIZE_8K];
+ uint8_t descriptorBuffer[DESCRIPTORREGIONSIZE];
+ uint8_t gbeBuffer8k[GBEREGIONSIZE_8K];
/* Copy the structs to buffers, to make writing them as files easier */
memcpy(&descriptorBuffer, &descriptorStruct, DESCRIPTORREGIONSIZE); /* descriptor */
@@ -45,14 +45,14 @@ int notCreatedDescriptorGbeFile(struct DESCRIPTORREGIONRECORD descriptorStruct,
fileStream = fopen(fileName, "ab");
/* write the descriptor region into the first part */
- if (DESCRIPTORREGIONSIZE != fwrite(descriptorBuffer, sizeof(char), DESCRIPTORREGIONSIZE, fileStream))
+ if (DESCRIPTORREGIONSIZE != fwrite(descriptorBuffer, 1, DESCRIPTORREGIONSIZE, fileStream))
{
printf("\nerror: writing descriptor region failed\n");
return 1;
}
/* add gbe to the end of the file */
- if (GBEREGIONSIZE_8K != fwrite(gbeBuffer8k, sizeof(char), GBEREGIONSIZE_8K, fileStream))
+ if (GBEREGIONSIZE_8K != fwrite(gbeBuffer8k, 1, GBEREGIONSIZE_8K, fileStream))
{
printf("\nerror: writing GBe region failed\n");
return 1;
diff --git a/resources/utilities/ich9deblob/src/common/descriptor_gbe.h b/resources/utilities/ich9deblob/src/common/descriptor_gbe.h
index cc0cc42..d3e8977 100644
--- a/resources/utilities/ich9deblob/src/common/descriptor_gbe.h
+++ b/resources/utilities/ich9deblob/src/common/descriptor_gbe.h
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
+#include <stdint.h>
#include "../descriptor/descriptor.h" /* structs describing what's in the descriptor region */
#include "../gbe/gbe.h" /* structs describing what's in the gbe region */
diff --git a/resources/utilities/ich9deblob/src/common/x86compatibility.c b/resources/utilities/ich9deblob/src/common/x86compatibility.c
index 505a37d..aaf3173 100644
--- a/resources/utilities/ich9deblob/src/common/x86compatibility.c
+++ b/resources/utilities/ich9deblob/src/common/x86compatibility.c
@@ -51,10 +51,10 @@ int structSizesIncorrect(struct DESCRIPTORREGIONRECORD descriptorDummy, struct G
/* endianness check. big endian forced to fail */
int systemIsBigEndian()
{
- unsigned short steak = 0xBEEF;
- unsigned char *grill = (unsigned char*)&steak;
+ uint16_t steak = 0xBEEF;
+ uint8_t *grill = (uint8_t*)&steak;
- if (*grill==0xBE) {
+ if (*grill!=0xEF) {
printf("\nunsigned short 0xBEEF: first byte should be EF, but it's BE. Your system is big endian, and unsupported (only little endian is tested)\n");
return 1;
}
@@ -66,7 +66,7 @@ int structMembersWrongOrder()
{
int i;
struct DESCRIPTORREGIONRECORD descriptorDummy;
- unsigned char *meVsccTablePtr = (unsigned char*)&descriptorDummy.meVsccTable;
+ uint8_t *meVsccTablePtr = (uint8_t*)&descriptorDummy.meVsccTable;
/* These do not use bitfields. */
descriptorDummy.meVsccTable.jid0 = 0x01020304; /* unsigned int 32-bit */
@@ -124,7 +124,7 @@ int structBitfieldWrongOrder()
{
int i;
struct DESCRIPTORREGIONRECORD descriptorDummy;
- unsigned char *flMap0Ptr = (unsigned char*)&descriptorDummy.flMaps.flMap0;
+ uint8_t *flMap0Ptr = (uint8_t*)&descriptorDummy.flMaps.flMap0;
descriptorDummy.flMaps.flMap0.FCBA = 0xA2; /* :8 --> 10100010 */
descriptorDummy.flMaps.flMap0.NC = 0x02; /* :2 --> 10 */
diff --git a/resources/utilities/ich9deblob/src/common/x86compatibility.h b/resources/utilities/ich9deblob/src/common/x86compatibility.h
index d9d5bdb..e5f02be 100644
--- a/resources/utilities/ich9deblob/src/common/x86compatibility.h
+++ b/resources/utilities/ich9deblob/src/common/x86compatibility.h
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
+#include <stdint.h>
#include "../descriptor/descriptor.h" /* structs describing what's in the descriptor region */
#include "../gbe/gbe.h" /* structs describing what's in the gbe region */