aboutsummaryrefslogtreecommitdiff
path: root/src/micro
diff options
context:
space:
mode:
Diffstat (limited to 'src/micro')
-rw-r--r--src/micro/micro.c7
-rw-r--r--src/micro/micro_port.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/micro/micro.c b/src/micro/micro.c
index 23994dd..39a22b2 100644
--- a/src/micro/micro.c
+++ b/src/micro/micro.c
@@ -776,6 +776,13 @@ int micro_run(void)
micro_msg("zy: genome does not fit\n");
return 1;
}
+#ifdef MICRO_PORT_IMAGE
+ /* the port may hand over an image of its own in place of the embedded one
+ (the wasm bootstrap seed does, to run a freshly built compiler) */
+ i = micro_port_image(m, (UCell)GORG, (UCell)FBOT);
+ if (i < 0) { micro_msg("zy: bad image\n"); return 1; }
+ if (i == 0)
+#endif
for (i = 0; i < GLEN; i++) m[GORG + i] = genome_word(i);
jknown = 0;
return run(GORG);
diff --git a/src/micro/micro_port.h b/src/micro/micro_port.h
index 9f77987..1653250 100644
--- a/src/micro/micro_port.h
+++ b/src/micro/micro_port.h
@@ -56,6 +56,9 @@ int micro_eof(void);
#define MICRO_WAIT (-2)
#define MICRO_SUSPENDED 3
int micro_run(void);
+/* with MICRO_PORT_IMAGE defined, the port's micro_port_image(mem, org, end) may load an
+ image of its own at mem[org..end): 1 when it did, 0 to use the embedded genome, -1 on error. */
+int micro_port_image(Cell *mem, UCell org, UCell end);
int micro_resume(void);
/* write the low 8 bits. */