| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 * | 4 * |
| 5 * Stub implementations of utility functions which call their linux-specific | 5 * Stub implementations of utility functions which call their linux-specific |
| 6 * equivalents. | 6 * equivalents. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #define _STUB_IMPLEMENTATION_ | 9 #define _STUB_IMPLEMENTATION_ |
| 10 #include "utility.h" | 10 #include "utility.h" |
| 11 | 11 |
| 12 #include <stdarg.h> | 12 #include <stdarg.h> |
| 13 #include <stdio.h> | 13 #include <stdio.h> |
| 14 #include <stdlib.h> | 14 #include <stdlib.h> |
| 15 #include <string.h> | 15 #include <string.h> |
| 16 #include <sys/time.h> |
| 16 | 17 |
| 17 void error(const char *format, ...) { | 18 void error(const char *format, ...) { |
| 18 va_list ap; | 19 va_list ap; |
| 19 va_start(ap, format); | 20 va_start(ap, format); |
| 20 fprintf(stderr, "ERROR: "); | 21 fprintf(stderr, "ERROR: "); |
| 21 vfprintf(stderr, format, ap); | 22 vfprintf(stderr, format, ap); |
| 22 va_end(ap); | 23 va_end(ap); |
| 23 exit(1); | 24 exit(1); |
| 24 } | 25 } |
| 25 | 26 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 44 free(ptr); | 45 free(ptr); |
| 45 } | 46 } |
| 46 | 47 |
| 47 int Memcmp(const void* src1, const void* src2, size_t n) { | 48 int Memcmp(const void* src1, const void* src2, size_t n) { |
| 48 return memcmp(src1, src2, n); | 49 return memcmp(src1, src2, n); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void* Memcpy(void* dest, const void* src, uint64_t n) { | 52 void* Memcpy(void* dest, const void* src, uint64_t n) { |
| 52 return memcpy(dest, src, (size_t)n); | 53 return memcpy(dest, src, (size_t)n); |
| 53 } | 54 } |
| 55 |
| 56 uint64_t VbGetTimer(void) { |
| 57 struct timeval tv; |
| 58 gettimeofday(&tv, NULL); |
| 59 return (uint64_t)tv.tv_sec * 1000000 + (uint64_t)tv.tv_usec; |
| 60 } |
| 61 |
| 62 uint64_t VbGetTimerMaxFreq(void) { |
| 63 return UINT64_C(1000000); |
| 64 } |
| OLD | NEW |