Thread (1 message) 1 message, 1 author, 2011-06-21

[PATCH 4/4] ARM: zImage: allow supplementing appended DTB with traditional ATAG data

From: David Brown <hidden>
Date: 2011-06-21 22:58:23
Also in: linux-devicetree

On Mon, Jun 20 2011, Nicolas Pitre wrote:
+void *memmove(void *__dest, __const void *__src, size_t __n)
+{
+	unsigned char *d = __dest;
+	const unsigned char *s = __src;
+
+	if (__dest == __src)
+		return __dest;
+
+	if (__dest < __src)
+		return memcpy(__dest, __src, __n);
+
+	while (--__n >= 0)
+		d[__n] = s[__n];
+
+	return __dest;
+}
Ahh, found it.  size_t is unsigned, so the while loop never terminates.
Something like:

	for (; __n; __n--)
		d[__n] = s[__n];

makes that work for me.

This allows me to not need to pad or have any of the chosen attributes.
I do need to have a memory attribute, however, and I'll see if I can
figure out what is happening there.

Fun debugging when the loop overwrites the code itself, but it keeps
working because it is in the cache.

David

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help