Added cap on size, fixed 64-bit thing.

This commit is contained in:
Brad Nelson
2022-02-02 19:38:06 -08:00
parent 39aa4464a3
commit b1fb668395
2 changed files with 4 additions and 2 deletions

View File

@ -361,7 +361,7 @@ $(ESP32_SIM)/Esp32forth-sim: \
common/interp.h \
$(GEN)/esp32_boot.h \
$(GEN)/esp32_sim_opcodes.h | $(ESP32_SIM)
$(CXX) $(CFLAGS) -m32 $< -o $@
$(CXX) $(CFLAGS) -m32 -D_FILE_OFFSET_BITS=64 $< -o $@
strip $(STRIP_ARGS) $@
sizes: $(ESP32_SIM)/Esp32forth-sim

View File

@ -125,7 +125,9 @@ static cell_t find(const char *name, cell_t len) {
static void create(const char *name, cell_t nlength, cell_t flags, void *op) {
if (g_sys.latestxt) {
g_sys.latestxt[-1] |= ((g_sys.heap - &g_sys.latestxt[1]) << 16);
cell_t sz = g_sys.heap - &g_sys.latestxt[1];
if (sz < 0 || sz > 0xffff) { sz = 0xffff; }
g_sys.latestxt[-1] |= (sz << 16);
}
g_sys.heap = (cell_t *) CELL_ALIGNED(g_sys.heap);
char *pos = (char *) g_sys.heap;