Skip to content

Fix missing wrapping of calloc_r with uVisor enabled. #2534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions hal/common/retarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,11 @@ void mbed_stats_heap_get(mbed_stats_heap_t *stats)
#include "uvisor-lib/uvisor-lib.h"
#endif/* FEATURE_UVISOR */

#ifndef FEATURE_UVISOR
extern "C" {

/* uVisor wraps malloc_r, realloc_r and free_r, but not calloc_r! */
#ifndef FEATURE_UVISOR

extern "C" void __malloc_lock( struct _reent *_r );
extern "C" void __malloc_unlock( struct _reent *_r );

Expand Down Expand Up @@ -586,6 +588,9 @@ void __wrap__free_r(struct _reent * r, void * ptr) {
malloc_stats_mutex->unlock();
#endif
}

#endif/* FEATURE_UVISOR */

void* __wrap__calloc_r(struct _reent * r, size_t num, size_t size) {
#if !defined(MBED_HEAP_STATS_ENABLED ) || !MBED_HEAP_STATS_ENABLED
extern void* __real__calloc_r(struct _reent * r, size_t num, size_t size);
Expand All @@ -603,7 +608,6 @@ void* __wrap__calloc_r(struct _reent * r, size_t num, size_t size) {
#endif
}
}
#endif/* FEATURE_UVISOR */

extern "C" WEAK void software_init_hook_rtos(void)
{
Expand Down