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#ifdef TX_INCLUDE_USER_DEFINE_FILE
22#include "tx_user.h"
23#endif
24
25    .text
26    .align 3
27/**************************************************************************/
28/*                                                                        */
29/*  FUNCTION                                               RELEASE        */
30/*                                                                        */
31/*    _tx_thread_interrupt_control                         ARMv8-A        */
32/*                                                           6.3.0        */
33/*  AUTHOR                                                                */
34/*                                                                        */
35/*    William E. Lamie, Microsoft Corporation                             */
36/*                                                                        */
37/*  DESCRIPTION                                                           */
38/*                                                                        */
39/*    This function is responsible for changing the interrupt lockout     */
40/*    posture of the system.                                              */
41/*                                                                        */
42/*  INPUT                                                                 */
43/*                                                                        */
44/*    new_posture                           New interrupt lockout posture */
45/*                                                                        */
46/*  OUTPUT                                                                */
47/*                                                                        */
48/*    old_posture                           Old interrupt lockout posture */
49/*                                                                        */
50/*  CALLS                                                                 */
51/*                                                                        */
52/*    None                                                                */
53/*                                                                        */
54/*  CALLED BY                                                             */
55/*                                                                        */
56/*    Application Code                                                    */
57/*                                                                        */
58/*  RELEASE HISTORY                                                       */
59/*                                                                        */
60/*    DATE              NAME                      DESCRIPTION             */
61/*                                                                        */
62/*  09-30-2020     William E. Lamie         Initial Version 6.1           */
63/*  01-31-2022     Andres Mlinar            Updated comments,             */
64/*                                            resulting in version 6.1.10 */
65/*  10-31-2023     Tiejun Zhou              Modified comment(s), added    */
66/*                                            #include tx_user.h,         */
67/*                                            resulting in version 6.3.0  */
68/*                                                                        */
69/**************************************************************************/
70// UINT   _tx_thread_interrupt_control(UINT new_posture)
71// {
72    .global  _tx_thread_interrupt_control
73    .type    _tx_thread_interrupt_control, @function
74_tx_thread_interrupt_control:
75
76    /* Pickup current interrupt lockout posture.  */
77
78    MRS     x1, DAIF                            // Pickup current interrupt posture
79
80    /* Apply the new interrupt posture.  */
81
82    MSR     DAIF, x0                            // Set new interrupt posture
83    MOV     x0, x1                              // Setup return value
84    RET                                         // Return to caller
85// }
86