Revert "Verified boot wrapper - replace utility functions"

This reverts commit bd81b3a7d3.

Change-Id: I2be2c076a37bf0e49569248691fceac417254f0b
Reviewed-on: http://gerrit.chromium.org/gerrit/3295
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
This commit is contained in:
mukesh agrawal
2011-06-27 20:00:52 -07:00
parent 1c1a883bc7
commit a7b9481f34
15 changed files with 137 additions and 83 deletions

View File

@@ -14,7 +14,7 @@
/* Debug and error output */
#ifdef VBOOT_DEBUG
#define VBDEBUG(params) VbExDebug params
#define VBDEBUG(params) debug params
#else
#define VBDEBUG(params)
#endif
@@ -35,10 +35,16 @@
#define VBPERFEND(name)
#endif
/* Outputs an error message and quits. */
void error(const char* format, ...);
/* Outputs debug/warning messages. */
void debug(const char* format, ...);
#ifdef VBOOT_DEBUG
#define VbAssert(expr) do { if (!(expr)) { \
VbExError("assert fail: %s at %s:%d\n", \
#expr, __FILE__, __LINE__); }} while(0)
error("assert fail: %s at %s:%d\n", \
#expr, __FILE__, __LINE__); }} while(0)
#else
#define VbAssert(expr)
#endif
@@ -51,6 +57,14 @@
/* Return the minimum of (a) or (b). */
#define Min(a, b) (((a) < (b)) ? (a) : (b))
/* Allocate [size] bytes and return a pointer to the allocated memory. Abort
* on error.
*/
void* Malloc(size_t size);
/* Free memory pointed by [ptr] previously allocated by Malloc(). */
void Free(void* ptr);
/* Compare [n] bytes in [src1] and [src2]
* Returns an integer less than, equal to, or greater than zero if the first [n]
* bytes of [src1] is found, respectively, to be less than, to match, or be
@@ -82,4 +96,18 @@ int SafeMemcmp(const void* s1, const void* s2, size_t n);
#define memset _do_not_use_standard_memset
#endif
/* Read a high-resolution timer. */
uint64_t VbGetTimer(void);
/* Return the maximum frequency for the high-resolution timer, in Hz.
*
* Note that this call MUST be fast; the implementation must not
* attempt to actually measure the frequency. This function need only
* return an upper bound for the timer frequency, so that minimum
* delays can be established. For example, if the same BIOS can run
* on CPUs where the timer frequency varies between 1.2GHz and 1.8GHz,
* return 1800000000 (or even 2000000000). */
uint64_t VbGetTimerMaxFreq(void);
#endif /* VBOOT_REFERENCE_UTILITY_H_ */