• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved.
3  * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
4  * Copyright (c) 2021 Nuclei Limited. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without modification,
7  * are permitted provided that the following conditions are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright notice, this list of
10  *    conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
13  *    of conditions and the following disclaimer in the documentation and/or other materials
14  *    provided with the distribution.
15  *
16  * 3. Neither the name of the copyright holder nor the names of its contributors may be used
17  *    to endorse or promote products derived from this software without specific prior written
18  *    permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef _LOS_ARCH_CONTEXT_H
34 #define _LOS_ARCH_CONTEXT_H
35 
36 #include "los_compiler.h"
37 #include "los_context.h"
38 
39 #ifdef __cplusplus
40 #if __cplusplus
41 extern "C" {
42 #endif /* __cplusplus */
43 #endif /* __cplusplus */
44 
45 /**
46  * @ingroup los_hw
47  */
48 typedef unsigned long STACK_TYPE;
49 
50 typedef struct {
51     STACK_TYPE epc;        /* epc - epc    - program counter                     */
52     STACK_TYPE ra;         /* x1  - ra     - return address for jumps            */
53     STACK_TYPE t0;         /* x5  - t0     - temporary register 0                */
54     STACK_TYPE t1;         /* x6  - t1     - temporary register 1                */
55     STACK_TYPE t2;         /* x7  - t2     - temporary register 2                */
56     STACK_TYPE s0_fp;      /* x8  - s0/fp  - saved register 0 or frame pointer   */
57     STACK_TYPE s1;         /* x9  - s1     - saved register 1                    */
58     STACK_TYPE a0;         /* x10 - a0     - return value or function argument 0 */
59     STACK_TYPE a1;         /* x11 - a1     - return value or function argument 1 */
60     STACK_TYPE a2;         /* x12 - a2     - function argument 2                 */
61     STACK_TYPE a3;         /* x13 - a3     - function argument 3                 */
62     STACK_TYPE a4;         /* x14 - a4     - function argument 4                 */
63     STACK_TYPE a5;         /* x15 - a5     - function argument 5                 */
64 #ifndef __riscv_32e
65     STACK_TYPE a6;         /* x16 - a6     - function argument 6                 */
66     STACK_TYPE a7;         /* x17 - s7     - function argument 7                 */
67     STACK_TYPE s2;         /* x18 - s2     - saved register 2                    */
68     STACK_TYPE s3;         /* x19 - s3     - saved register 3                    */
69     STACK_TYPE s4;         /* x20 - s4     - saved register 4                    */
70     STACK_TYPE s5;         /* x21 - s5     - saved register 5                    */
71     STACK_TYPE s6;         /* x22 - s6     - saved register 6                    */
72     STACK_TYPE s7;         /* x23 - s7     - saved register 7                    */
73     STACK_TYPE s8;         /* x24 - s8     - saved register 8                    */
74     STACK_TYPE s9;         /* x25 - s9     - saved register 9                    */
75     STACK_TYPE s10;        /* x26 - s10    - saved register 10                   */
76     STACK_TYPE s11;        /* x27 - s11    - saved register 11                   */
77     STACK_TYPE t3;         /* x28 - t3     - temporary register 3                */
78     STACK_TYPE t4;         /* x29 - t4     - temporary register 4                */
79     STACK_TYPE t5;         /* x30 - t5     - temporary register 5                */
80     STACK_TYPE t6;         /* x31 - t6     - temporary register 6                */
81 #endif
82     STACK_TYPE mstatus;    /*              - machine status register             */
83 } TaskContext;
84 
85 extern VOID HalStartToRun(VOID);
86 
87 #ifdef __cplusplus
88 #if __cplusplus
89 }
90 #endif /* __cplusplus */
91 #endif /* __cplusplus */
92 
93 #endif /* _LOS_ARCH_CONTEXT_H */
94