diff options
| author | Kamil Tomaszewski <kamil.tomaszewski@sony.com> | 2019-10-18 11:05:08 +0200 |
|---|---|---|
| committer | Kamil Tomaszewski <kamil.tomaszewski@sony.com> | 2019-10-18 11:05:08 +0200 |
| commit | f3151bb6c4adac5ed9cf03d3977ab6d9662c0e05 (patch) | |
| tree | 29817229b386ff0e018369becac89438727a1cb5 /supervisor/shared | |
| parent | 96756b3945ec3388986c7ebda8b924aeb42cd7fb (diff) | |
Use get top and limit stack functions
Diffstat (limited to 'supervisor/shared')
| -rwxr-xr-x | supervisor/shared/memory.c | 7 | ||||
| -rwxr-xr-x | supervisor/shared/stack.c | 3 |
2 files changed, 5 insertions, 5 deletions
diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index 11133415d..38040d11d 100755 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -25,6 +25,7 @@ */ #include "supervisor/memory.h" +#include "supervisor/port.h" #include <stddef.h> @@ -36,12 +37,10 @@ static supervisor_allocation allocations[CIRCUITPY_SUPERVISOR_ALLOC_COUNT]; // We use uint32_t* to ensure word (4 byte) alignment. uint32_t* low_address; uint32_t* high_address; -extern uint32_t _ebss; -extern uint32_t _estack; void memory_init(void) { - low_address = &_ebss; - high_address = &_estack; + low_address = port_stack_get_limit(); + high_address = port_stack_get_top(); } void free_memory(supervisor_allocation* allocation) { diff --git a/supervisor/shared/stack.c b/supervisor/shared/stack.c index 311fa31b2..dcecf2067 100755 --- a/supervisor/shared/stack.c +++ b/supervisor/shared/stack.c @@ -29,6 +29,7 @@ #include "py/mpconfig.h" #include "py/runtime.h" #include "supervisor/cpu.h" +#include "supervisor/port.h" #include "supervisor/shared/safe_mode.h" extern uint32_t _estack; @@ -43,7 +44,7 @@ void allocate_stack(void) { mp_uint_t regs[10]; mp_uint_t sp = cpu_get_regs_and_sp(regs); - mp_uint_t c_size = (uint32_t) &_estack - sp; + mp_uint_t c_size = (uint32_t) port_stack_get_top() - sp; stack_alloc = allocate_memory(c_size + next_stack_size + EXCEPTION_STACK_SIZE, true); if (stack_alloc == NULL) { |
