diff options
Diffstat (limited to 'firmware/export/system.h')
-rw-r--r-- | firmware/export/system.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/firmware/export/system.h b/firmware/export/system.h index cba4b81631..b973b57fd9 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h | |||
@@ -243,16 +243,18 @@ static inline uint32_t swap_odd_even32(uint32_t value) | |||
243 | #define CACHEALIGN_DOWN(x) \ | 243 | #define CACHEALIGN_DOWN(x) \ |
244 | ((typeof (x))ALIGN_DOWN_P2((uintptr_t)(x), CACHEALIGN_BITS)) | 244 | ((typeof (x))ALIGN_DOWN_P2((uintptr_t)(x), CACHEALIGN_BITS)) |
245 | /* Aligns at least to the greater of size x or CACHEALIGN_SIZE */ | 245 | /* Aligns at least to the greater of size x or CACHEALIGN_SIZE */ |
246 | #define CACHEALIGN_AT_LEAST_ATTR(x) __attribute__((aligned(CACHEALIGN_UP(x)))) | 246 | #define CACHEALIGN_AT_LEAST_ATTR(x) \ |
247 | __attribute__((aligned(CACHEALIGN_UP(x)))) | ||
247 | /* Aligns a buffer pointer and size to proper boundaries */ | 248 | /* Aligns a buffer pointer and size to proper boundaries */ |
248 | #define CACHEALIGN_BUFFER(start, size) \ | 249 | #define CACHEALIGN_BUFFER(start, size) \ |
249 | ({ align_buffer((start), (size), CACHEALIGN_SIZE); }) | 250 | ({ align_buffer(PUN_PTR(void **, (start)), (size), CACHEALIGN_SIZE); }) |
250 | 251 | ||
251 | #else /* ndef PROC_NEEDS_CACHEALIGN */ | 252 | #else /* ndef PROC_NEEDS_CACHEALIGN */ |
252 | 253 | ||
253 | /* Cache alignment attributes and sizes are not enabled */ | 254 | /* Cache alignment attributes and sizes are not enabled */ |
254 | #define CACHEALIGN_ATTR | 255 | #define CACHEALIGN_ATTR |
255 | #define CACHEALIGN_AT_LEAST_ATTR(x) __attribute__((aligned(x))) | 256 | #define CACHEALIGN_AT_LEAST_ATTR(x) \ |
257 | __attribute__((aligned(x))) | ||
256 | #define CACHEALIGN_UP(x) (x) | 258 | #define CACHEALIGN_UP(x) (x) |
257 | #define CACHEALIGN_DOWN(x) (x) | 259 | #define CACHEALIGN_DOWN(x) (x) |
258 | /* Make no adjustments */ | 260 | /* Make no adjustments */ |
@@ -261,4 +263,8 @@ static inline uint32_t swap_odd_even32(uint32_t value) | |||
261 | 263 | ||
262 | #endif /* PROC_NEEDS_CACHEALIGN */ | 264 | #endif /* PROC_NEEDS_CACHEALIGN */ |
263 | 265 | ||
266 | /* Double-cast to avoid 'dereferencing type-punned pointer will | ||
267 | * break strict aliasing rules' B.S. */ | ||
268 | #define PUN_PTR(type, p) ((type)(intptr_t)(p)) | ||
269 | |||
264 | #endif /* __SYSTEM_H__ */ | 270 | #endif /* __SYSTEM_H__ */ |