mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-18 02:24:18 +00:00

We had exit but we didn't have atexit, and we were calling panic and tf_printf from exit, which generated a dependency from exit to them. Having atexit allows to set a different function pointer in every image. Change-Id: I95b9556d680d96249ed3b14da159b6f417da7661 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
26 lines
343 B
C
26 lines
343 B
C
/*
|
|
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
|
|
static void (*exitfun)(void);
|
|
|
|
void exit(int status)
|
|
{
|
|
if (exitfun)
|
|
(*exitfun)();
|
|
for (;;)
|
|
;
|
|
}
|
|
|
|
int atexit(void (*fun)(void))
|
|
{
|
|
if (exitfun)
|
|
return -1;
|
|
exitfun = fun;
|
|
|
|
return 0;
|
|
}
|