summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli.c7
-rw-r--r--tools.c8
2 files changed, 12 insertions, 3 deletions
diff --git a/cli.c b/cli.c
index daed679..adf0f4b 100644
--- a/cli.c
+++ b/cli.c
@@ -376,8 +376,11 @@ int WriteData(int handle, int bar, unsigned long addr, int n, int access, char *
int size = n * abs(access);
err = posix_memalign( (void**)&buf, 256, size );
- if (!err) err = posix_memalign( (void**)&check, 256, size );
- if ((!err)||(!buf)||(!check)) Error("Allocation of %i bytes of memory have failed", size);
+ if (!err) {
+ err = posix_memalign( (void**)&check, 256, size );
+ }
+ if ((err)||(!buf)||(!check))
+ Error("Allocation of %i bytes of memory have failed", size);
for (i = 0; i < n; i++) {
switch (access) {
diff --git a/tools.c b/tools.c
index 9770b60..4ca3730 100644
--- a/tools.c
+++ b/tools.c
@@ -15,7 +15,13 @@ void *memcpy32(void * dst, void const * src, size_t len) {
uint32_t const * plSrc = (uint32_t const *) src;
while (len >= 4) {
- *plDst++ = *plSrc++;
+ uint32_t a = (*plSrc & 0xFF) << 24;
+ a |= (*plSrc & 0xFF00) << 8;
+ a |= (*plSrc & 0xFF0000) >> 8;
+ a |= (*plSrc & 0xFF000000) >> 24;
+ *plDst = a;
+ plSrc++;
+ plDst++;
len -= 4;
}