summaryrefslogtreecommitdiff
path: root/firmware/lib/cgptlib
diff options
context:
space:
mode:
authorvbendeb <vbendeb@chromium.org>2010-06-24 16:19:53 -0700
committervbendeb <vbendeb@chromium.org>2010-06-24 16:19:53 -0700
commit3ecaf776d82d29573be083b2e5c6ddc5b9f49c70 (patch)
tree3887c0749d73e45562a250c275f56eb4f5356613 /firmware/lib/cgptlib
parentd6aad3a0888ad57383036dacdfc4c01f0c3b56e3 (diff)
downloadvboot-3ecaf776d82d29573be083b2e5c6ddc5b9f49c70.tar.gz
Make vboot_reference build in MSVC command line environment.
This is a mostly NOOP change which modifies the source code to compile cleanly in the MSVC command line build environment. A new makefile is introduced (msc/nmakefile) along with a README.txt in the same directory explaining how to build the code in the DOS window. As of this submission the build is running in a 32 bit environment, the intention is to use the same makefile for 64 bit builds in the future. Enabling high compilation warnings level allowed to identify a couple of bugs in the code which are being fixed. Not all sources are being compiled in the MSVC environment, only those in firmware/ and most of those in test/ subdirectories. The benchmark calculations require porting of the timer facilities and are being postponed. TEST Built in DOS and linux environments. Ran unit tests in linux environment. Review URL: http://codereview.chromium.org/2809037
Diffstat (limited to 'firmware/lib/cgptlib')
-rw-r--r--firmware/lib/cgptlib/cgptlib_internal.c10
-rw-r--r--firmware/lib/cgptlib/include/cgptlib_internal.h2
-rw-r--r--firmware/lib/cgptlib/include/gpt.h8
3 files changed, 8 insertions, 12 deletions
diff --git a/firmware/lib/cgptlib/cgptlib_internal.c b/firmware/lib/cgptlib/cgptlib_internal.c
index 4e0a06ac..c3fd1f32 100644
--- a/firmware/lib/cgptlib/cgptlib_internal.c
+++ b/firmware/lib/cgptlib/cgptlib_internal.c
@@ -115,7 +115,7 @@ int IsKernelEntry(const GptEntry* e) {
}
-int CheckEntries(GptEntry* entries, GptHeader* h, uint64_t drive_sectors) {
+int CheckEntries(GptEntry* entries, GptHeader* h) {
GptEntry* entry;
uint32_t crc32;
@@ -227,17 +227,17 @@ int GptSanityCheck(GptData *gpt) {
* Note that we use the same header in both checks. This way we'll
* catch the case where (header1,entries1) and (header2,entries2)
* are both valid, but (entries1 != entries2). */
- if (0 == CheckEntries(entries1, goodhdr, gpt->drive_sectors))
+ if (0 == CheckEntries(entries1, goodhdr))
gpt->valid_entries |= MASK_PRIMARY;
- if (0 == CheckEntries(entries2, goodhdr, gpt->drive_sectors))
+ if (0 == CheckEntries(entries2, goodhdr))
gpt->valid_entries |= MASK_SECONDARY;
/* If both headers are good but neither entries were good, check the
* entries with the secondary header. */
if (MASK_BOTH == gpt->valid_headers && !gpt->valid_entries) {
- if (0 == CheckEntries(entries1, header2, gpt->drive_sectors))
+ if (0 == CheckEntries(entries1, header2))
gpt->valid_entries |= MASK_PRIMARY;
- if (0 == CheckEntries(entries2, header2, gpt->drive_sectors))
+ if (0 == CheckEntries(entries2, header2))
gpt->valid_entries |= MASK_SECONDARY;
if (gpt->valid_entries) {
/* Sure enough, header2 had a good CRC for one of the entries. Mark
diff --git a/firmware/lib/cgptlib/include/cgptlib_internal.h b/firmware/lib/cgptlib/include/cgptlib_internal.h
index 5252b6a0..95e5b4e7 100644
--- a/firmware/lib/cgptlib/include/cgptlib_internal.h
+++ b/firmware/lib/cgptlib/include/cgptlib_internal.h
@@ -83,7 +83,7 @@ uint32_t HeaderCrc(GptHeader* h);
/* Check entries.
*
* Returns 0 if entries are valid, 1 if invalid. */
-int CheckEntries(GptEntry* entries, GptHeader* h, uint64_t drive_sectors);
+int CheckEntries(GptEntry* entries, GptHeader* h);
/* Check GptData, headers, entries.
*
diff --git a/firmware/lib/cgptlib/include/gpt.h b/firmware/lib/cgptlib/include/gpt.h
index 1d5cb58d..b55f921a 100644
--- a/firmware/lib/cgptlib/include/gpt.h
+++ b/firmware/lib/cgptlib/include/gpt.h
@@ -12,9 +12,7 @@
#include "sysincludes.h"
-#ifdef _MSC_VER
-#pragma pack(push,1) /* Support packing for MSVC. */
-#endif
+__pragma(pack(push,1)) /* Support packing for MSVC. */
#define GPT_HEADER_SIGNATURE "EFI PART"
#define GPT_HEADER_SIGNATURE_SIZE sizeof(GPT_HEADER_SIGNATURE)
@@ -117,8 +115,6 @@ typedef struct {
#define GPTENTRY_EXPECTED_SIZE 128
-#ifdef _MSC_VER
-#pragma pack(pop) /* Support packing for MSVC. */
-#endif
+__pragma(pack(pop)) /* Support packing for MSVC. */
#endif /* VBOOT_REFERENCE_CGPTLIB_GPT_H_ */