Workaround/fix (I'm not sure!) for buffer_alloc() returning unaligned addresses in case other parts of the code increase audiobuf behind buffer.c's back.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30049 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Frank Gevaerts 2011-06-21 22:04:17 +00:00
parent 2bc133dce9
commit 7763869e10

View File

@ -61,7 +61,7 @@ void buffer_init(void)
void *buffer_alloc(size_t size)
{
void *retval = audiobuf;
void *retval;
#ifdef BUFFER_ALLOC_DEBUG
struct buffer_start_marker *start;
struct buffer_end_marker *end;
@ -70,6 +70,11 @@ void *buffer_alloc(size_t size)
/* 32-bit aligned */
size = (size + 3) & ~3;
/* Other code touches audiobuf. Make sure it stays aligned */
audiobuf = (void *)(((unsigned long)audiobuf + 3) & ~3);
retval = audiobuf;
#ifdef BUFFER_ALLOC_DEBUG
retval +=sizeof(struct buffer_start_marker);
if(size>0)