File tree 3 files changed +30
-3
lines changed
3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 24
24
Modified 8 May 2015 by Hristo Gochkov (proper post and file upload handling)
25
25
*/
26
26
27
- #include < stdint.h>
28
- #include < stdlib.h>
29
- #include < stdio.h>
27
+ #include < cassert>
28
+ #include < cstdint>
29
+ #include < cstdlib>
30
+ #include < cstdio>
31
+
30
32
#include " pgmspace.h"
31
33
#include " debug.h"
32
34
#include " StackThunk.h"
35
+
33
36
#include < ets_sys.h>
34
37
#include < umm_malloc/umm_malloc.h>
35
38
#include < umm_malloc/umm_heap_select.h>
36
39
37
40
extern " C" {
38
41
42
+ extern void yield ();
43
+ extern bool can_yield ();
44
+
39
45
uint32_t *stack_thunk_ptr = NULL ;
40
46
uint32_t *stack_thunk_top = NULL ;
41
47
uint32_t *stack_thunk_save = NULL ; /* Saved A1 while in BearSSL */
@@ -45,6 +51,25 @@ uint32_t stack_thunk_refcnt = 0;
45
51
#define _stackSize (6200 /4 )
46
52
#define _stackPaint 0xdeadbeef
47
53
54
+ void stack_thunk_yield ()
55
+ {
56
+ if (can_yield ()) {
57
+ uint32_t tmp;
58
+ register uint32_t * save __asm__ (" a3" ) = stack_thunk_save;
59
+
60
+ __asm__ __volatile__ (
61
+ " mov.n %0, a1\n\t "
62
+ " mov.n a1, %1\n\t "
63
+ : " =r" (tmp) : " r" (save) : " memory" );
64
+
65
+ yield ();
66
+
67
+ __asm__ __volatile__ (
68
+ " mov.n a1, %0\n\t "
69
+ :: " r" (tmp) : " memory" );
70
+ }
71
+ }
72
+
48
73
/* Add a reference, and allocate the stack if necessary */
49
74
void stack_thunk_add_ref ()
50
75
{
Original file line number Diff line number Diff line change 31
31
extern "C" {
32
32
#endif
33
33
34
+ extern void stack_thunk_yield ();
35
+
34
36
extern void stack_thunk_add_ref ();
35
37
extern void stack_thunk_del_ref ();
36
38
extern void stack_thunk_repaint ();
You can’t perform that action at this time.
0 commit comments