summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2017-04-08 18:11:25 -0400
committerMichael Sevakis <jethead71@rockbox.org>2017-04-08 18:32:54 -0400
commiteefc7c73e2495decdc6f242515696fe0e3f85609 (patch)
tree2b0d4ceb498ee39f1c81340f315292bad5b785f2 /firmware
parent5e4532c87cf747600ec1d7ae22531e89ecdce6a4 (diff)
downloadrockbox-eefc7c73e2495decdc6f242515696fe0e3f85609.tar.gz
rockbox-eefc7c73e2495decdc6f242515696fe0e3f85609.zip
Fix some problems with playback crashing
I'm not sure all the situations it affects, to be honest. The fix aimed to address the strange symptom here: http://forums.rockbox.org/index.php/topic,50793.0.html It turns out that ringbuf_add_cross was used when handles were butted up against one another with the first parameter equal to the last, which it interprets as being an empty case when it should be interpreted as full in the context it was used. To fix this, introduce full/empty variants of ringbuf_add_cross and ringbuf_sub and use them at the appropriate time. The other way to address the problem is ensure there's always at least a space byte between the end of one handle and the start of another but this make the code a bit trickier to reason about than using additional function variants. bufopen() may yield after creating a handle and so do some more locking so that the buffering thread doesn't mess things up by moving anything or not seeing the yet-to-be linked-in allocation. Add alignof() macro to use proper method to get alignment of struct memory_handle. That should be useful in general anyway. It's merely defined as __alignof__ but looks nicer. Change-Id: If21739eaa33a4f6c084a28ee5b3c8fceecfd87ce
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/system.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 050c3074aa..62da252e80 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -135,6 +135,10 @@ int get_cpu_boost_counter(void);
135#define PTR_ADD(ptr, x) ((typeof(ptr))((char*)(ptr) + (x))) 135#define PTR_ADD(ptr, x) ((typeof(ptr))((char*)(ptr) + (x)))
136#define PTR_SUB(ptr, x) ((typeof(ptr))((char*)(ptr) - (x))) 136#define PTR_SUB(ptr, x) ((typeof(ptr))((char*)(ptr) - (x)))
137 137
138#ifndef alignof
139#define alignof __alignof__
140#endif
141
138/* Get the byte offset of a type's member */ 142/* Get the byte offset of a type's member */
139#ifndef offsetof 143#ifndef offsetof
140#define offsetof(type, member) __builtin_offsetof(type, member) 144#define offsetof(type, member) __builtin_offsetof(type, member)