1/***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12/**************************************************************************/
13/**************************************************************************/
14/**                                                                       */
15/** ThreadX Component                                                     */
16/**                                                                       */
17/**   Thread                                                              */
18/**                                                                       */
19/**************************************************************************/
20/**************************************************************************/
21
22#ifdef TX_INCLUDE_USER_DEFINE_FILE
23#include "tx_user.h"
24#endif
25
26    .text
27    .align 4
28    .syntax unified
29/**************************************************************************/
30/*                                                                        */
31/*  FUNCTION                                               RELEASE        */
32/*                                                                        */
33/*    _tx_thread_context_save                          Cortex-Mx/GNU      */
34/*                                                           6.2.1        */
35/*  AUTHOR                                                                */
36/*                                                                        */
37/*    Scott Larson, Microsoft Corporation                                 */
38/*                                                                        */
39/*  DESCRIPTION                                                           */
40/*                                                                        */
41/*    This function is only needed for legacy applications and it should  */
42/*    not be called in any new development on a Cortex-M.                 */
43/*                                                                        */
44/*  INPUT                                                                 */
45/*                                                                        */
46/*    None                                                                */
47/*                                                                        */
48/*  OUTPUT                                                                */
49/*                                                                        */
50/*    None                                                                */
51/*                                                                        */
52/*  CALLS                                                                 */
53/*                                                                        */
54/*    [_tx_execution_isr_enter]             Execution profiling ISR enter */
55/*                                                                        */
56/*  CALLED BY                                                             */
57/*                                                                        */
58/*    ISRs                                                                */
59/*                                                                        */
60/*  RELEASE HISTORY                                                       */
61/*                                                                        */
62/*    DATE              NAME                      DESCRIPTION             */
63/*                                                                        */
64/*  06-02-2021      Scott Larson            Initial Version 6.1.7         */
65/*  03-08-2023      Scott Larson            Include tx_user.h,            */
66/*                                            resulting in version 6.2.1  */
67/*                                                                        */
68/**************************************************************************/
69// VOID   _tx_thread_context_save(VOID)
70// {
71    .global  _tx_thread_context_save
72    .thumb_func
73_tx_thread_context_save:
74
75#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
76    /* Call the ISR enter function to indicate an ISR is starting.  */
77    PUSH    {r0, lr}                                // Save return address
78    BL      _tx_execution_isr_enter                 // Call the ISR enter function
79    POP     {r0, lr}                                // Recover return address
80#endif
81
82    /* Context is already saved - just return.  */
83
84    BX      lr
85// }
86