summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2011-11-01 21:02:33 +0000
committerStefan Reinauer <reinauer@chromium.org>2011-11-02 12:59:54 -0700
commit66264b5d9778e7f3e99f4f72e170d2ef6a819a0e (patch)
tree56a3328331887eb33cae22a621b49b2ebf4d2d86
parent01f276bb0ef07b705104fbf8e62494be3ba61d03 (diff)
downloadvboot-66264b5d9778e7f3e99f4f72e170d2ef6a819a0e.tar.gz
Move Memset from vboot_reference to vbexport/u-boot
All memory operations (except the "safe ones") live in the firmware so the fast operations can be used. Except Memset. This CL changes that problem. This CL needs https://gerrit.chromium.org/gerrit/#change,10992 and a similar change in H2C. BUG=chrome-os-partner:6313 TEST=run coreboot/u-boot on Stumpy Change-Id: Ic961ebbb45470c8fc1316490b902759dcf221deb Reviewed-on: https://gerrit.chromium.org/gerrit/10993 Tested-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--firmware/lib/utility.c8
-rw-r--r--firmware/stub/utility_stub.c6
-rw-r--r--tests/utility_tests.c20
3 files changed, 6 insertions, 28 deletions
diff --git a/firmware/lib/utility.c b/firmware/lib/utility.c
index 7a2370b0..5e506f33 100644
--- a/firmware/lib/utility.c
+++ b/firmware/lib/utility.c
@@ -8,14 +8,6 @@
#include "sysincludes.h"
#include "utility.h"
-void* Memset(void* d, const uint8_t c, uint64_t n) {
- uint8_t* dest = d; /* the only way to keep both cl and gcc happy */
- while (n--) {
- *dest++ = c;
- }
- return d;
-}
-
int SafeMemcmp(const void* s1, const void* s2, size_t n) {
const unsigned char* us1 = s1;
const unsigned char* us2 = s2;
diff --git a/firmware/stub/utility_stub.c b/firmware/stub/utility_stub.c
index 489b0f72..e3ec19be 100644
--- a/firmware/stub/utility_stub.c
+++ b/firmware/stub/utility_stub.c
@@ -24,3 +24,9 @@ int Memcmp(const void* src1, const void* src2, size_t n) {
void* Memcpy(void* dest, const void* src, uint64_t n) {
return memcpy(dest, src, (size_t)n);
}
+
+void* Memset(void* d, const uint8_t c, uint64_t n) {
+ return memset(d, c, n);
+}
+
+
diff --git a/tests/utility_tests.c b/tests/utility_tests.c
index 03ba5f9e..5ecb0b06 100644
--- a/tests/utility_tests.c
+++ b/tests/utility_tests.c
@@ -47,25 +47,6 @@ static void MacrosTest(void) {
}
-/* Test Memset */
-static void MemsetTest(void) {
- char dest[128];
- char want[128];
-
- memset(want, 0, 128);
- memset(dest, 0, 128);
-
- /* Simple fill */
- memset(want, 123, 5);
- TEST_PTR_EQ(dest, Memset(dest, 123, 5), "Memset() returns dest");
- TEST_EQ(0, memcmp(dest, want, 128), "Memset()");
-
- /* Filling length 0 does nothing */
- Memset(dest, 42, 0);
- TEST_EQ(0, memcmp(dest, want, 128), "Memset() size=0");
-}
-
-
/* Test SafeMemcmp */
static void SafeMemcmpTest(void) {
/* Zero-length strings are equal */
@@ -88,7 +69,6 @@ int main(int argc, char* argv[]) {
int error_code = 0;
MacrosTest();
- MemsetTest();
SafeMemcmpTest();
if (!gTestSuccess)