1/**************************************************************************/
2/*                                                                        */
3/*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4/*                                                                        */
5/*       This software is licensed under the Microsoft Software License   */
6/*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7/*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8/*       and in the root directory of this software.                      */
9/*                                                                        */
10/**************************************************************************/
11
12
13/**************************************************************************/
14/**************************************************************************/
15/**                                                                       */
16/** ThreadX Component                                                     */
17/**                                                                       */
18/**   Thread                                                              */
19/**                                                                       */
20/**************************************************************************/
21/**************************************************************************/
22
23#ifdef TX_INCLUDE_USER_DEFINE_FILE
24#include "tx_user.h"
25#endif
26
27#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
28    IMPORT  _tx_execution_isr_enter
29#endif
30
31    AREA    ||.text||, CODE, READONLY
32    PRESERVE8
33/**************************************************************************/
34/*                                                                        */
35/*  FUNCTION                                               RELEASE        */
36/*                                                                        */
37/*    _tx_thread_context_save                          Cortex-Mx/AC5      */
38/*                                                           6.3.0        */
39/*  AUTHOR                                                                */
40/*                                                                        */
41/*    Scott Larson, Microsoft Corporation                                 */
42/*                                                                        */
43/*  DESCRIPTION                                                           */
44/*                                                                        */
45/*    This function is only needed for legacy applications and it should  */
46/*    not be called in any new development on a Cortex-M.                 */
47/*                                                                        */
48/*  INPUT                                                                 */
49/*                                                                        */
50/*    None                                                                */
51/*                                                                        */
52/*  OUTPUT                                                                */
53/*                                                                        */
54/*    None                                                                */
55/*                                                                        */
56/*  CALLS                                                                 */
57/*                                                                        */
58/*    [_tx_execution_isr_enter]             Execution profiling ISR enter */
59/*                                                                        */
60/*  CALLED BY                                                             */
61/*                                                                        */
62/*    ISRs                                                                */
63/*                                                                        */
64/*  RELEASE HISTORY                                                       */
65/*                                                                        */
66/*    DATE              NAME                      DESCRIPTION             */
67/*                                                                        */
68/*  06-02-2021      Scott Larson            Initial Version 6.1.7         */
69/*  10-31-2023      Tiejun Zhou             Included tx_user.h,           */
70/*                                            resulting in version 6.3.0  */
71/*                                                                        */
72/**************************************************************************/
73// VOID   _tx_thread_context_save(VOID)
74// {
75    EXPORT  _tx_thread_context_save
76_tx_thread_context_save
77
78#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
79    /* Call the ISR enter function to indicate an ISR is starting.  */
80    PUSH    {r0, lr}                                // Save return address
81    BL      _tx_execution_isr_enter                 // Call the ISR enter function
82    POP     {r0, lr}                                // Recover return address
83#endif
84
85    /* Context is already saved - just return.  */
86
87    BX      lr
88// }
89    ALIGN
90    LTORG
91    END
92