exit.c
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "os_type.h"
#ifdef FREE_RTOS
/* _exit function for the Xtensa semihosting simulator. */
/*
* Copyright (c) 1998-2008 by Tensilica Inc. ALL RIGHTS RESERVED.
* These coded instructions, statements, and computer programs are the
* copyrighted works and confidential proprietary information of Tensilica Inc.
* They may not be modified, copied, reproduced, distributed, or disclosed to
* third parties in any manner, medium, or form, in whole or in part, without
* the prior written consent of Tensilica Inc.
*/
#include <sys/reent.h>
#include <xtensa/simcall.h>
#include <xtensa/config/core-isa.h>
#include <xtensa/config/core.h>
#include "c_def.h"
void _exit (int n) __attribute__ ((section (".internal_ram_1_text")));
void _exit (int n)
{
/* Sync dirty data to memory before terminating. */
#if XCHAL_DCACHE_IS_COHERENT
xthal_cache_coherence_optout ();
#elif XCHAL_DCACHE_IS_WRITEBACK
xthal_dcache_all_writeback ();
#endif
/* Issue EXTW instruction (or MEMW if pre-LX) to sync memory and queues: */
#pragma flush
{
register int a2 __asm__ ("a2") = SYS_exit;
register int a3 __asm__ ("a3") = n;
__asm__ volatile ("simcall"
: : "a" (a2), "a" (a3));
}
/*NOTREACHED*/
}
#if 0
void _DEFUN (exit, (code), int code)
{
__call_exitprocs (code, NULL);
if (_GLOBAL_REENT->__cleanup)
(*_GLOBAL_REENT->__cleanup) (_GLOBAL_REENT);
_exit (code);
}
#endif
#endif //FREE_RTOS