aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-12-11 15:55:08 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-12-11 15:55:08 +0000
commitf2c5dc67eab392655278f2d34b31190dbf94bac1 (patch)
tree55ad499c6b8a28bb32254c6dc02fc31bd4b1e08c /os/kernel
parentd980d7e3e434af2cd17ee2b04deaab65164204ce (diff)
downloadChibiOS-f2c5dc67eab392655278f2d34b31190dbf94bac1.tar.gz
ChibiOS-f2c5dc67eab392655278f2d34b31190dbf94bac1.tar.bz2
ChibiOS-f2c5dc67eab392655278f2d34b31190dbf94bac1.zip
Fixed bug 2912528.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1414 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel')
-rw-r--r--os/kernel/src/chmemcore.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/os/kernel/src/chmemcore.c b/os/kernel/src/chmemcore.c
index 47c579432..214504df7 100644
--- a/os/kernel/src/chmemcore.c
+++ b/os/kernel/src/chmemcore.c
@@ -28,15 +28,8 @@
#if CH_USE_MEMCORE
-#if CH_MEMCORE_SIZE == 0
- extern align_t __heap_base__;
- extern align_t __heap_end__;
-#else
-align_t buffer[MEM_ALIGN_SIZE(CH_MEMCORE_SIZE) / sizeof(align_t)];
-#endif
-
-static align_t *nextmem;
-static align_t *endmem;
+static uint8_t *nextmem;
+static uint8_t *endmem;
/**
* @brief Low level memory manager initialization.
@@ -45,11 +38,14 @@ static align_t *endmem;
*/
void core_init(void) {
#if CH_MEMCORE_SIZE == 0
+ extern uint8_t __heap_base__;
+ extern uint8_t __heap_end__;
nextmem = &__heap_base__;
endmem = &__heap_end__;
#else
- nextmem = &buffer[0];
- endmem = &buffer[MEM_ALIGN_SIZE(CH_MEMCORE_SIZE) / sizeof(align_t)];
+ static align_t buffer[MEM_ALIGN_SIZE(CH_MEMCORE_SIZE) / sizeof(align_t)];
+ nextmem = (uint8_t *)&buffer[0];
+ endmem = (uint8_t *)&buffer[MEM_ALIGN_SIZE(CH_MEMCORE_SIZE) / sizeof(align_t)];
#endif
}
@@ -87,7 +83,7 @@ void *chCoreAllocI(size_t size) {
void *p;
size = MEM_ALIGN_SIZE(size);
- if ((size_t)((uint8_t *)endmem - (uint8_t *)nextmem) < size)
+ if ((size_t)(endmem - nextmem) < size)
return NULL;
p = nextmem;
nextmem += size;