summaryrefslogtreecommitdiffstatshomepage
path: root/unix/gccollect.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/gccollect.c')
-rw-r--r--unix/gccollect.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/unix/gccollect.c b/unix/gccollect.c
index 4f3b786e72..d04e5d87fb 100644
--- a/unix/gccollect.c
+++ b/unix/gccollect.c
@@ -26,13 +26,13 @@
#include <stdio.h>
-#include "misc.h"
#include "mpconfig.h"
+#include "misc.h"
#include "gc.h"
#if MICROPY_ENABLE_GC
-extern void *stack_top;
+extern char *stack_top;
#if MICROPY_GCREGS_SETJMP
#include <setjmp.h>
@@ -97,7 +97,7 @@ void gc_helper_get_regs(regs_t arr) {
}
#endif
-#ifdef __thumb2__
+#if defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
typedef machine_uint_t regs_t[10];
void gc_helper_get_regs(regs_t arr) {
@@ -130,8 +130,11 @@ void gc_collect(void) {
gc_collect_start();
// this traces the .bss section
-#ifdef __CYGWIN__
+#if defined( __CYGWIN__ )
#define BSS_START __bss_start__
+#elif defined( _MSC_VER ) || defined( __MINGW32__ )
+#define BSS_START *bss_start
+#define _end *bss_end
#else
#define BSS_START __bss_start
#endif
@@ -141,7 +144,8 @@ void gc_collect(void) {
regs_t regs;
gc_helper_get_regs(regs);
// GC stack (and regs because we captured them)
- gc_collect_root((void**)&regs, ((machine_uint_t)stack_top - (machine_uint_t)&regs) / sizeof(machine_uint_t));
+ void **regs_ptr = (void**)(void*)&regs;
+ gc_collect_root(regs_ptr, ((machine_uint_t)stack_top - (machine_uint_t)&regs) / sizeof(machine_uint_t));
gc_collect_end();
//printf("-----\n");