summaryrefslogtreecommitdiff
path: root/supervisor/shared/stack.h
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-12-07 15:34:43 -0500
committerGitHub <noreply@github.com>2018-12-07 15:34:43 -0500
commit2fbaceb2b15ff7d2c368a6cf4dfc10881f5979e7 (patch)
tree60210206b73c579e74288333a3ecc4e8f233dd1b /supervisor/shared/stack.h
parent481c4954afd161448aa37d353fa577d409d880c6 (diff)
parent89ef6eef575501e736ae528f13d9979e1302be63 (diff)
Merge pull request #1294 from tannewt/stack_check4.0.0-alpha.4
Add stack validity check and raise an error when it happens.
Diffstat (limited to 'supervisor/shared/stack.h')
-rwxr-xr-xsupervisor/shared/stack.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/supervisor/shared/stack.h b/supervisor/shared/stack.h
index 3a5c18e7d..1fb43be57 100755
--- a/supervisor/shared/stack.h
+++ b/supervisor/shared/stack.h
@@ -37,5 +37,12 @@ void stack_init(void);
void stack_resize(void);
void set_next_stack_size(uint32_t size);
uint32_t get_current_stack_size(void);
+bool stack_ok(void);
+
+// Use this after any calls into a library which may use a lot of stack. This will raise a Python
+// exception when the stack has likely overwritten a portion of the heap.
+void assert_heap_ok(void);
+
+#define STACK_CANARY_VALUE 0x017829ef
#endif // MICROPY_INCLUDED_SUPERVISOR_STACK_H