@@ -167,6 +167,24 @@ macro_rules! save_context {
167167 } ;
168168}
169169
170+ /// This macro expands to code for restoring context on exit from an exception
171+ /// handler.
172+ ///
173+ /// It should match `save_context!`.
174+ #[ cfg( not( any( target_abi = "eabihf" , feature = "eabi-fpu" ) ) ) ]
175+ macro_rules! restore_context {
176+ ( ) => {
177+ r#"
178+ // restore alignment amount, and preserved register
179+ pop {{r0, r12}}
180+ // restore pre-alignment SP
181+ add sp, r0
182+ // restore more preserved registers
183+ pop {{r0-r3}}
184+ "#
185+ } ;
186+ }
187+
170188/// This macro expands to code for saving context on entry to an exception
171189/// handler.
172190///
@@ -199,14 +217,22 @@ macro_rules! save_context {
199217/// handler.
200218///
201219/// It should match `save_context!`.
202- #[ cfg( not( any( target_abi = "eabihf" , feature = "eabi-fpu" ) ) ) ]
220+ #[ cfg( all(
221+ any( target_abi = "eabihf" , feature = "eabi-fpu" ) ,
222+ not( feature = "vfp-dp" )
223+ ) ) ]
203224macro_rules! restore_context {
204225 ( ) => {
205226 r#"
206227 // restore alignment amount, and preserved register
207228 pop {{r0, r12}}
208229 // restore pre-alignment SP
209230 add sp, r0
231+ // pop FPU state
232+ pop {{r0-r1}}
233+ vmsr FPEXC, r1
234+ vmsr FPSCR, r0
235+ vpop {{d0-d7}}
210236 // restore more preserved registers
211237 pop {{r0-r3}}
212238 "#
@@ -239,32 +265,6 @@ macro_rules! save_context {
239265 } ;
240266}
241267
242- /// This macro expands to code for restoring context on exit from an exception
243- /// handler.
244- ///
245- /// It should match `save_context!`.
246- #[ cfg( all(
247- any( target_abi = "eabihf" , feature = "eabi-fpu" ) ,
248- not( feature = "vfp-dp" )
249- ) ) ]
250- macro_rules! restore_context {
251- ( ) => {
252- r#"
253- // restore alignment amount, and preserved register
254- pop {{r0, r12}}
255- // restore pre-alignment SP
256- add sp, r0
257- // pop FPU state
258- pop {{r0-r1}}
259- vmsr FPEXC, r1
260- vmsr FPSCR, r0
261- vpop {{d0-d7}}
262- // restore more preserved registers
263- pop {{r0-r3}}
264- "#
265- } ;
266- }
267-
268268/// This macro expands to code for restoring context on exit from an exception
269269/// handler.
270270///
0 commit comments