File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,10 @@ extern "C" {
25
25
#include " osapi.h"
26
26
#include " mem.h"
27
27
}
28
+ #include < Arduino.h>
29
+ #include < cxxabi.h>
28
30
31
+ using __cxxabiv1::__guard;
29
32
30
33
void *operator new (size_t size) {
31
34
size = ((size + 3 ) & ~((size_t )0x3 ));
@@ -56,6 +59,34 @@ void __cxa_deleted_virtual(void) {
56
59
panic ();
57
60
}
58
61
62
+ typedef struct {
63
+ uint8_t guard;
64
+ uint8_t ps;
65
+ } guard_t ;
66
+
67
+ extern " C" int __cxa_guard_acquire (__guard* pg)
68
+ {
69
+ uint8_t ps = xt_rsil (15 );
70
+ if (reinterpret_cast <guard_t *>(pg)->guard ) {
71
+ xt_wsr_ps (ps);
72
+ return 0 ;
73
+ }
74
+ reinterpret_cast <guard_t *>(pg)->ps = ps;
75
+ return 1 ;
76
+ }
77
+
78
+ extern " C" void __cxa_guard_release (__guard* pg)
79
+ {
80
+ reinterpret_cast <guard_t *>(pg)->guard = 1 ;
81
+ xt_wsr_ps (reinterpret_cast <guard_t *>(pg)->ps );
82
+ }
83
+
84
+ extern " C" void __cxa_guard_abort (__guard* pg)
85
+ {
86
+ xt_wsr_ps (reinterpret_cast <guard_t *>(pg)->ps );
87
+ }
88
+
89
+
59
90
namespace std {
60
91
void __throw_bad_function_call () {
61
92
panic ();
You can’t perform that action at this time.
0 commit comments