rick> This doesn't change the pointer returned by cmd_queue_alloc() at all.

the problem I believe is the *NEXT* allocation that is failing, after an 
"odd-sized" request, you get an odd aligned pointer.

Two odd requests - should give you an even..  (sort of, not exactly, it 
has to be 4 bytes here... not 2 bytes)

Rick> It just rounds the size of the allocation up to a 4-byte alignment.
Rick> If that is necessary, it should be fixed by the caller rather than
Rick> always padding in cmd_queue_alloc().

NO - Never.  "allocation()" should always follow the "well known behavior"
The well known malloc sets the standard. and it does that good reason.

The solution -if what you say is a true problem- and I believe it is not
Is to put a fix in the cmd_queue_alloc() to special case the (size(1)) 
allocations.

But - the reason that malloc() is right is in 2 parts:

(1)  As they say:   It is easier to stand on the shoulders of giants.

(2) I would strongly suggest people watch this, it's about an hour long.
    http://www.youtube.com/watch?v=aAb7hSCtvGw

rick>  but the OS should catch the trap and handle the unaligned access 
correctly

No - many OSes I've worked with in my *years* of writing code abort the 
process.
Others - too bad - what great bugs to find and debug! AGH!!!! Been there 
done that.
On some OSes - you can *enable* this if you want, at a *PERFORMANCE* 
cost to your app.

micheal> [c requires aligned pointers]

No, The C standard states it is implementation defined, i don't have a 
copy handy to quote chapter & verse.

============

-Duane.

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to