Hiroshi san,

What was the original complaint?  If I understand correctly, the problem 
was this:

==========
cmd_que_allocate() - returns an un-aligned pointer.
==========

Is that correct? If so - the cause, and solution is utterly simple, and 
is as follows:

The solution is to *ROUND*UP* all requests to an alignment size.

For example:

If the request is for 13 bytes, the request should be rounded to 16 bytes
This should be done at the start/top of the allocation routine.

The cause of the alignment error is an earlier *ODD* size allocation.
The memory request *NEXT* will be mis-aligned.

Walk through the code - request first 20 bytes, then 5 bytes, then 20 bytes.

By simply at the top of "cmd_que_allocate()" - rounding up the 
allocation size.. the problem is solved.

For *ARM* - alignment is 4byte - this one line fix should be ok.

      size = (size + 3) & (~3);

Perhaps - with newer platforms (ie: The 64bit - AMD) we should as policy 
in the code - align to 16bytes?
Please try the above and let me know what you find.

-Duane.

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to