context_frame.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017, 2019 JP Bonn, Ken Rabold
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef CONTEXT_FRAME_H
20 #define CONTEXT_FRAME_H
21 
22 #if !defined(__ASSEMBLER__)
23 #include <stdint.h>
24 #endif /* __ASSEMBLER__ */
25 
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #if !defined(__ASSEMBLER__)
32 
42  /* Callee saved registers */
43  uint32_t s0;
44  uint32_t s1;
45  uint32_t s2;
46  uint32_t s3;
47  uint32_t s4;
48  uint32_t s5;
49  uint32_t s6;
50  uint32_t s7;
51  uint32_t s8;
52  uint32_t s9;
53  uint32_t s10;
54  uint32_t s11;
55  /* Caller saved registers */
56  uint32_t ra;
57  uint32_t t0;
58  uint32_t t1;
59  uint32_t t2;
60  uint32_t t3;
61  uint32_t t4;
62  uint32_t t5;
63  uint32_t t6;
64  uint32_t a0;
65  uint32_t a1;
66  uint32_t a2;
67  uint32_t a3;
68  uint32_t a4;
69  uint32_t a5;
70  uint32_t a6;
71  uint32_t a7;
72  /* Saved PC for return from ISR */
73  uint32_t pc;
74  uint32_t pad[3];
75 };
76 
77 #endif /* __ASSEMBLER__ */
78 
79 
84 /* These values are checked for correctness in context_frame.c */
85 #define s0_OFFSET 0
86 #define s1_OFFSET 4
87 #define s2_OFFSET 8
88 #define s3_OFFSET 12
89 #define s4_OFFSET 16
90 #define s5_OFFSET 20
91 #define s6_OFFSET 24
92 #define s7_OFFSET 28
93 #define s8_OFFSET 32
94 #define s9_OFFSET 36
95 #define s10_OFFSET 40
96 #define s11_OFFSET 44
97 #define ra_OFFSET 48
98 #define t0_OFFSET 52
99 #define t1_OFFSET 56
100 #define t2_OFFSET 60
101 #define t3_OFFSET 64
102 #define t4_OFFSET 68
103 #define t5_OFFSET 72
104 #define t6_OFFSET 76
105 #define a0_OFFSET 80
106 #define a1_OFFSET 84
107 #define a2_OFFSET 88
108 #define a3_OFFSET 92
109 #define a4_OFFSET 96
110 #define a5_OFFSET 100
111 #define a6_OFFSET 104
112 #define a7_OFFSET 108
113 #define pc_OFFSET 112
114 #define pad_OFFSET 116
115 
120 #define CONTEXT_FRAME_SIZE (pad_OFFSET + 12)
121 
125 #define SP_OFFSET_IN_THREAD 0
126 
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* CONTEXT_FRAME_H */
133 
context_switch_frame::s5
uint32_t s5
s5 register
Definition: context_frame.h:48
context_switch_frame::s11
uint32_t s11
s11 register
Definition: context_frame.h:54
context_switch_frame::a6
uint32_t a6
a6 register
Definition: context_frame.h:70
context_switch_frame::s1
uint32_t s1
s1 register
Definition: context_frame.h:44
context_switch_frame::a3
uint32_t a3
a3 register
Definition: context_frame.h:67
context_switch_frame
Stores the registers and PC for a context switch.
Definition: context_frame.h:41
context_switch_frame::s9
uint32_t s9
s9 register
Definition: context_frame.h:52
context_switch_frame::s10
uint32_t s10
s10 register
Definition: context_frame.h:53
context_switch_frame::s0
uint32_t s0
s0 register
Definition: context_frame.h:43
context_switch_frame::a0
uint32_t a0
a0 register
Definition: context_frame.h:64
context_switch_frame::s6
uint32_t s6
s6 register
Definition: context_frame.h:49
context_switch_frame::s3
uint32_t s3
s3 register
Definition: context_frame.h:46
context_switch_frame::a7
uint32_t a7
a7 register
Definition: context_frame.h:71
context_switch_frame::s2
uint32_t s2
s2 register
Definition: context_frame.h:45
context_switch_frame::t1
uint32_t t1
t1 register
Definition: context_frame.h:58
context_switch_frame::a4
uint32_t a4
a4 register
Definition: context_frame.h:68
context_switch_frame::s7
uint32_t s7
s7 register
Definition: context_frame.h:50
context_switch_frame::a2
uint32_t a2
a2 register
Definition: context_frame.h:66
context_switch_frame::ra
uint32_t ra
ra register
Definition: context_frame.h:56
context_switch_frame::a5
uint32_t a5
a5 register
Definition: context_frame.h:69
context_switch_frame::t3
uint32_t t3
t3 register
Definition: context_frame.h:60
context_switch_frame::a1
uint32_t a1
a1 register
Definition: context_frame.h:65
context_switch_frame::s4
uint32_t s4
s4 register
Definition: context_frame.h:47
context_switch_frame::pad
uint32_t pad[3]
padding to maintain 16 byte alignment
Definition: context_frame.h:74
context_switch_frame::s8
uint32_t s8
s8 register
Definition: context_frame.h:51
context_switch_frame::pc
uint32_t pc
program counter
Definition: context_frame.h:73
context_switch_frame::t6
uint32_t t6
t6 register
Definition: context_frame.h:63
context_switch_frame::t0
uint32_t t0
t0 register
Definition: context_frame.h:57
context_switch_frame::t2
uint32_t t2
t2 register
Definition: context_frame.h:59
context_switch_frame::t5
uint32_t t5
t5 register
Definition: context_frame.h:62
context_switch_frame::t4
uint32_t t4
t4 register
Definition: context_frame.h:61