From 58350e3a4977c03b1dbf2fb5b9e2a6eeb40e985b Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Thu, 18 Jun 2020 04:43:03 -0400 Subject: [PATCH 01/21] Fail if there's a memory leak building the kernel --- .build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.build.yml b/.build.yml index 1bd8d46..0b10fe9 100644 --- a/.build.yml +++ b/.build.yml @@ -2,8 +2,14 @@ image: archlinux packages: - make - cmake + - mkrom + - patchrom + - genkfs + - mktiupgrade + - valgrind sources: - https://github.com/knightos/scas + - https://github.com/knightos/kernel environment: project: scas tasks: @@ -13,3 +19,7 @@ tasks: cd build cmake -DCMAKE_BUILD_TYPE=Release .. make + cd ../../kernel + mkdir bin/TI84pSE -p + valgrind -s --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas --define TI84pSE --include "include/;bin/TI84pSE/;src/00/" --symbols bin/TI84pSE/00.sym --listing bin/TI84pSE/00.list src/00/base.asm -o bin/TI84pSE/00.bin -vv + if [[ "$(grep ERROR\ SUMMARY log | cut -d\ -f4)" != "0" ]] ; then echo Memory error ; exit 1 ; fi From 17b0c92294398fd403e713e55a1dc7a1426bea4f Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Thu, 18 Jun 2020 05:11:11 -0400 Subject: [PATCH 02/21] Make it possible to undefine --- assembler/assembler.c | 3 +++ assembler/directives.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/assembler/assembler.c b/assembler/assembler.c index 1502dbd..6dc7a53 100644 --- a/assembler/assembler.c +++ b/assembler/assembler.c @@ -172,6 +172,9 @@ int try_expand_macro(struct assembler_state *state, char **line) { if (strstr(*line, "macro") == *line + 1) { // Cannot expand macros while defining them return 0; } + if (strstr(*line, "undefine") == *line + 1) { // Should not expand while removing + return 0; + } if (strstr(*line, "ifdef") == *line + 1) { // Should not expand when testing for existence return 0; } diff --git a/assembler/directives.c b/assembler/directives.c index 3eb3303..d004dd2 100644 --- a/assembler/directives.c +++ b/assembler/directives.c @@ -433,6 +433,8 @@ int handle_undef(struct assembler_state *state, char **argv, int argc) { return 1; } + scas_log(L_DEBUG, "Looking for %s", argv[0]); + int i; for (i = 0; i < state->macros->length; i++) { macro_t *m = state->macros->items[i]; From 1a4b6cec4ae4b20ad0a20b00a01da15bd8882b28 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Wed, 1 Jul 2020 16:29:57 -0400 Subject: [PATCH 03/21] Use KnightOS/kernel#195 for now --- .build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.build.yml b/.build.yml index 0b10fe9..49cb781 100644 --- a/.build.yml +++ b/.build.yml @@ -20,6 +20,8 @@ tasks: cmake -DCMAKE_BUILD_TYPE=Release .. make cd ../../kernel + # Temporary: use scas PR + gco scas mkdir bin/TI84pSE -p valgrind -s --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas --define TI84pSE --include "include/;bin/TI84pSE/;src/00/" --symbols bin/TI84pSE/00.sym --listing bin/TI84pSE/00.list src/00/base.asm -o bin/TI84pSE/00.bin -vv if [[ "$(grep ERROR\ SUMMARY log | cut -d\ -f4)" != "0" ]] ; then echo Memory error ; exit 1 ; fi From 1c357a3a5be03828ff4b89c1e301511aac62185a Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Thu, 2 Jul 2020 21:05:14 -0400 Subject: [PATCH 04/21] Ignore .echo --- assembler/directives.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/assembler/directives.c b/assembler/directives.c index d004dd2..4a9bb7d 100644 --- a/assembler/directives.c +++ b/assembler/directives.c @@ -612,11 +612,20 @@ static void printf_putc(char c) { putchar(c); } -int handle_printf(struct assembler_state *state, char **argv, int argc) { +int handle_echo(struct assembler_state *state, char **argv, int argc) { if (argc == 0) { ERROR(ERROR_INVALID_DIRECTIVE, state->column, "echo expects 1+ arguments"); return 1; } + (void)argv; + return 1; +} + +int handle_printf(struct assembler_state *state, char **argv, int argc) { + if (argc == 0) { + ERROR(ERROR_INVALID_DIRECTIVE, state->column, "printf expects 1+ arguments"); + return 1; + } int len = strlen(argv[0]); if (argv[0][0] != '"' || argv[0][len - 1] != '"') { ERROR(ERROR_INVALID_DIRECTIVE, state->column, "unterminated string"); @@ -1279,7 +1288,7 @@ struct directive directives[] = { { "dl", handle_dl, DELIM_COMMAS }, { "ds", handle_block, DELIM_COMMAS }, { "dw", handle_dw, DELIM_COMMAS }, - //{ "echo", handle_echo, DELIM_COMMAS | DELIM_WHITESPACE }, + { "echo", handle_echo, DELIM_COMMAS | DELIM_WHITESPACE }, { "elif", handle_elseif, 0 }, { "else", handle_else, 0 }, { "elseif", handle_elseif, 0 }, From d2d84660f50eff6847536d05080f5ec296064a3d Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Sun, 5 Jul 2020 17:52:08 -0400 Subject: [PATCH 05/21] Treat equates as normal symbols --- assembler/assembler.c | 6 +----- assembler/directives.c | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/assembler/assembler.c b/assembler/assembler.c index 6dc7a53..bc551b9 100644 --- a/assembler/assembler.c +++ b/assembler/assembler.c @@ -710,11 +710,7 @@ object_t *assemble(FILE *file, const char *file_name, assembler_settings_t *sett macro_free(macro); } list_free(state.macros); - for (int i = 0; i < state.equates->length; i += 1) { - symbol_t *sym = (symbol_t*)state.equates->items[i]; - free(sym->name); - free(sym); - } + // Equates are also added to an area's symbols list, so they're cleaned up there list_free(state.equates); stack_free(state.source_map_stack); free(state.instruction_buffer); diff --git a/assembler/directives.c b/assembler/directives.c index 4a9bb7d..a1d1605 100644 --- a/assembler/directives.c +++ b/assembler/directives.c @@ -763,6 +763,7 @@ int handle_equ(struct assembler_state *state, char **argv, int argc) { sym->value = result; sym->exported = 0; list_add(state->equates, sym); + list_add(state->current_area->symbols, sym); scas_log(L_DEBUG, "Added equate '%s' with value 0x%08X", sym->name, sym->value); } return 1; From 6037c49bf011718e78b9dea8f89f8c6576478e5d Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Wed, 8 Jul 2020 12:04:47 -0400 Subject: [PATCH 06/21] Symbol file generation, explicit exports --- assembler/assembler.c | 2 +- linker/linker.c | 21 +++++++++++++++++---- scas/main.c | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/assembler/assembler.c b/assembler/assembler.c index bc551b9..fcc6645 100644 --- a/assembler/assembler.c +++ b/assembler/assembler.c @@ -329,7 +329,7 @@ int try_add_label(struct assembler_state *state, char **line) { /* Add label */ symbol_t *sym = malloc(sizeof(symbol_t)); - sym->exported = 1; /* TODO: Support explicit export */ + sym->exported = !scas_runtime.options.explicit_export; sym->type = SYMBOL_LABEL; sym->value = state->PC + scas_runtime.options.origin; sym->defined_address = state->current_area->data_length; diff --git a/linker/linker.c b/linker/linker.c index acc0c77..4ec2e7f 100644 --- a/linker/linker.c +++ b/linker/linker.c @@ -191,9 +191,8 @@ void link_objects(FILE *output, list_t *objects, linker_settings_t *settings) { if (scas_runtime.options.remove_unused_functions) { remove_unused_functions(merged); } - int i; uint64_t address = 0; - for (i = 0; i < merged->areas->length; ++i) { + for (int i = 0; i < merged->areas->length; ++i) { area_t *area = merged->areas->items[i]; relocate_area(area, address, false); if (settings->automatic_relocation) { @@ -206,11 +205,11 @@ void link_objects(FILE *output, list_t *objects, linker_settings_t *settings) { } address += area->data_length; } - for (i = 0; i < merged->areas->length; ++i) { + for (int i = 0; i < merged->areas->length; ++i) { area_t *area = merged->areas->items[i]; gather_symbols(symbols, area, settings); } - for (i = 0; i < merged->areas->length; ++i) { + for (int i = 0; i < merged->areas->length; ++i) { area_t *area = merged->areas->items[i]; scas_log(L_INFO, "Linking area %s", area->name); if (scas_runtime.options.origin) { @@ -222,6 +221,20 @@ void link_objects(FILE *output, list_t *objects, linker_settings_t *settings) { } settings->write_output(output, final->data, (int)final->data_length); scas_log(L_DEBUG, "Final binary written: %d bytes", ftell(output)); + + if (scas_runtime.symbol_file) { + scas_log(L_DEBUG, "Generating symbol file '%s'", scas_runtime.symbol_file); + FILE *symfile = fopen(scas_runtime.symbol_file, "w"); + for (int i = 0; i < symbols->length; i++) { + symbol_t *symbol = symbols->items[i]; + if (symbol->type == SYMBOL_LABEL && symbol->exported) { + fprintf(symfile, ".equ %s, %lu\n", symbol->name, symbol->value); + } + } + fflush(symfile); + fclose(symfile); + } + object_free(merged); area_free(final); list_free(symbols); diff --git a/scas/main.c b/scas/main.c index c0dab1f..1aa3570 100644 --- a/scas/main.c +++ b/scas/main.c @@ -324,6 +324,7 @@ int main(int argc, char **argv) { } fclose(out); } + if (errors->length != 0) { int i; for (i = 0; i < errors->length; ++i) { From 1c007c50169dda494c5558631e9fcf96828ca1fc Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Wed, 8 Jul 2020 12:07:01 -0400 Subject: [PATCH 07/21] Timeline.Fetch(self).isStupid() --- .build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.build.yml b/.build.yml index 49cb781..b2e43ad 100644 --- a/.build.yml +++ b/.build.yml @@ -21,7 +21,7 @@ tasks: make cd ../../kernel # Temporary: use scas PR - gco scas + git checkout scas mkdir bin/TI84pSE -p valgrind -s --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas --define TI84pSE --include "include/;bin/TI84pSE/;src/00/" --symbols bin/TI84pSE/00.sym --listing bin/TI84pSE/00.list src/00/base.asm -o bin/TI84pSE/00.bin -vv if [[ "$(grep ERROR\ SUMMARY log | cut -d\ -f4)" != "0" ]] ; then echo Memory error ; exit 1 ; fi From ed9a2ca6643e80e218897cfcef312bd61316ccdb Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Wed, 8 Jul 2020 12:57:20 -0400 Subject: [PATCH 08/21] Fix CI --- .build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.build.yml b/.build.yml index b2e43ad..917b98f 100644 --- a/.build.yml +++ b/.build.yml @@ -24,4 +24,3 @@ tasks: git checkout scas mkdir bin/TI84pSE -p valgrind -s --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas --define TI84pSE --include "include/;bin/TI84pSE/;src/00/" --symbols bin/TI84pSE/00.sym --listing bin/TI84pSE/00.list src/00/base.asm -o bin/TI84pSE/00.bin -vv - if [[ "$(grep ERROR\ SUMMARY log | cut -d\ -f4)" != "0" ]] ; then echo Memory error ; exit 1 ; fi From 248cb76aaebf687fa1ab13b3e44f692b4c281a2b Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Sun, 6 Sep 2020 15:44:22 -0400 Subject: [PATCH 09/21] Don't expand macros in equates or labels --- assembler/assembler.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/assembler/assembler.c b/assembler/assembler.c index fcc6645..adc8df9 100644 --- a/assembler/assembler.c +++ b/assembler/assembler.c @@ -178,6 +178,12 @@ int try_expand_macro(struct assembler_state *state, char **line) { if (strstr(*line, "ifdef") == *line + 1) { // Should not expand when testing for existence return 0; } + // Shouldn't expand macros in equates + if ((**line == '.' || **line == '#')) { + if (code_strstr(*line, ".equ") || code_strchr(*line, '=')) { + return 0; + } + } int i; for (i = 0; i < state->macros->length; i++) { macro_t *macro = state->macros->items[i]; @@ -608,8 +614,8 @@ object_t *assemble(FILE *file, const char *file_name, assembler_settings_t *sett try_empty_line, try_parse_inside_macro, try_split_line, - try_expand_macro, try_add_label, + try_expand_macro, try_handle_directive, try_match_instruction, }; From 6103da4c25f302a8cd810286e52e0f1c2d687404 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Sun, 6 Sep 2020 15:45:03 -0400 Subject: [PATCH 10/21] Symbol files: make compatible with patchrom --- linker/linker.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linker/linker.c b/linker/linker.c index 4ec2e7f..b260b97 100644 --- a/linker/linker.c +++ b/linker/linker.c @@ -226,10 +226,10 @@ void link_objects(FILE *output, list_t *objects, linker_settings_t *settings) { scas_log(L_DEBUG, "Generating symbol file '%s'", scas_runtime.symbol_file); FILE *symfile = fopen(scas_runtime.symbol_file, "w"); for (int i = 0; i < symbols->length; i++) { - symbol_t *symbol = symbols->items[i]; - if (symbol->type == SYMBOL_LABEL && symbol->exported) { - fprintf(symfile, ".equ %s, %lu\n", symbol->name, symbol->value); - } + symbol_t *symbol = symbols->items[i]; + if (symbol->type == SYMBOL_LABEL && symbol->exported && !strchr(symbol->name, '@')) { + fprintf(symfile, ".equ %s 0x%lX\n", symbol->name, symbol->value); + } } fflush(symfile); fclose(symfile); From 7a34beb67d9896241aafefa60858ae6fc0ad7fa2 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 04:32:30 -0400 Subject: [PATCH 11/21] Remove DEVEL mode --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 692aee5..d1d57b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 2.8.5) project(scas C) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99 -D_XOPEN_SOURCE=700") -set(CMAKE_C_FLAGS_DEVEL "-Werror -g -Og") if(WIN32) set(CMAKE_C_FLAGS "-Wl,--allow-multiple-definition") From 9657a473751a59b88545745eb76bf2a2bb3f379a Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 04:32:48 -0400 Subject: [PATCH 12/21] Correctly handle `$` in instructions --- assembler/assembler.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/assembler/assembler.c b/assembler/assembler.c index adc8df9..1f1ff39 100644 --- a/assembler/assembler.c +++ b/assembler/assembler.c @@ -442,7 +442,14 @@ int try_match_instruction(struct assembler_state *state, char **_line) { transform_local_labels(expression, state->last_global_label); const char *file_name = stack_peek(state->file_name_stack); transform_relative_labels(expression, state->last_relative_label, file_name); + symbol_t sym_pc = { + .type = SYMBOL_LABEL, + .value = state->PC, + .name = "$" + }; + list_add(state->equates, &sym_pc); result = evaluate_expression(expression, state->equates, &error, &symbol); + state->equates->length -= 1; if (error == EXPRESSION_BAD_SYMBOL) { if (scas_runtime.options.explicit_import && strcmp(symbol, "$") != 0) { unresolved_symbol_t *unresolved_sym = malloc(sizeof(unresolved_symbol_t)); From a6624ac1360b36353f511846e7ea221c0f2b73eb Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 04:38:12 -0400 Subject: [PATCH 13/21] Correctly handle local and pc-relative `equ`s --- assembler/directives.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/assembler/directives.c b/assembler/directives.c index a1d1605..b64dd94 100644 --- a/assembler/directives.c +++ b/assembler/directives.c @@ -748,8 +748,20 @@ int handle_equ(struct assembler_state *state, char **argv, int argc) { ERROR_NO_ARG(ERROR_INVALID_SYNTAX, state->column); return 1; } else { + transform_local_labels(expression, state->last_global_label); + int len = state->equates->length; + for (int i = 0; i < state->current_area->symbols->length; i += 1) { + list_add(state->equates, state->current_area->symbols->items[i]); + } + symbol_t sym_pc = { + .type = SYMBOL_LABEL, + .value = state->PC, + .name = "$" + }; + list_add(state->equates, &sym_pc); result = evaluate_expression(expression, state->equates, &error, &symbol); free_expression(expression); + state->equates->length = len; } if (error == EXPRESSION_BAD_SYMBOL) { ERROR(ERROR_UNKNOWN_SYMBOL, state->column, symbol); From d1fdabb23c00340780ffd46008a77acef1a17960 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 04:38:39 -0400 Subject: [PATCH 14/21] Fix use-after-free --- assembler/directives.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assembler/directives.c b/assembler/directives.c index b64dd94..2e0ec61 100644 --- a/assembler/directives.c +++ b/assembler/directives.c @@ -760,7 +760,6 @@ int handle_equ(struct assembler_state *state, char **argv, int argc) { }; list_add(state->equates, &sym_pc); result = evaluate_expression(expression, state->equates, &error, &symbol); - free_expression(expression); state->equates->length = len; } if (error == EXPRESSION_BAD_SYMBOL) { @@ -778,6 +777,7 @@ int handle_equ(struct assembler_state *state, char **argv, int argc) { list_add(state->current_area->symbols, sym); scas_log(L_DEBUG, "Added equate '%s' with value 0x%08X", sym->name, sym->value); } + free_expression(expression); return 1; } From 37e6cd3cd73955fcbbd2aef3d755dd88be690f9a Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 04:33:51 -0400 Subject: [PATCH 15/21] Improve logging of add_error_from_map --- common/errors.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/common/errors.c b/common/errors.c index 42d388b..3d1900f 100644 --- a/common/errors.c +++ b/common/errors.c @@ -2,6 +2,7 @@ #include "list.h" #include "log.h" #include "objects.h" +#include #include #include #include @@ -101,15 +102,14 @@ void add_warning(list_t *warnings, int code, size_t line_number, void add_error_from_map(list_t *errors, int code, list_t *maps, uint64_t address, ...) { source_map_t *map; source_map_entry_t *entry; - int found = 0; - int i; - for (i = 0; i < maps->length; ++i) { + bool found = false; + for (int i = 0; i < maps->length; ++i) { map = maps->items[i]; int j; for (j = 0; j < map->entries->length; ++j) { entry = map->entries->items[j]; if (address >= entry->address && address < entry->address + entry->length) { - found = 1; + found = true; break; } } @@ -135,16 +135,25 @@ void add_error_from_map(list_t *errors, int code, list_t *maps, uint64_t address va_end(args); error->message = buf; + scas_log(L_ERROR, "Added error '%s' at:", buf); if (found) { error->line_number = entry->line_number; error->file_name = strdup(map->file_name); error->line = strdup(entry->source_code); + for (int i = 0; i < maps->length; ++i) { + map = maps->items[i]; + for (int j = 0; j < map->entries->length; ++j) { + entry = map->entries->items[j]; + if (address >= entry->address && address < entry->address + entry->length) { + scas_log(L_ERROR, "\t%s:%d:%d", map->file_name, + entry->line_number, error->column); + } + } + } } else { error->line_number = 0; error->file_name = NULL; error->line = NULL; } list_add(errors, error); - scas_log(L_ERROR, "Added error '%s' at %s:%d:%d", buf, error->file_name, - error->line_number, error->column); } From 5cb9520b4ef469a46906fa1a2d24b47b4cb18577 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 04:34:44 -0400 Subject: [PATCH 16/21] Expose relative label transformation from the assembler --- include/assembler.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/assembler.h b/include/assembler.h index ef761b0..046c2a1 100644 --- a/include/assembler.h +++ b/include/assembler.h @@ -50,6 +50,7 @@ struct assembler_state { object_t *assemble(FILE *file, const char *file_name, assembler_settings_t *settings); void transform_local_labels(tokenized_expression_t *expression, const char *last_global_label); +void transform_relative_labels(tokenized_expression_t *expression, int last_relative_label, const char *const file_name); void macro_free(macro_t *macro); #endif From e746eaac236c752fb74a8564b3f51dfdf1c2f2ad Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 04:35:54 -0400 Subject: [PATCH 17/21] Ignore ccls --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index f023399..8d1fb99 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ test/ build/ .lvimrc tables/z80.c +.ccls +.ccls-cache From 01d5c4244cc02b01ec68f7ef9b9119919ac2acd2 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 04:36:35 -0400 Subject: [PATCH 18/21] List: don't memmove when deleting the last entry --- common/list.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/list.c b/common/list.c index a7585a3..4ddc02f 100644 --- a/common/list.c +++ b/common/list.c @@ -49,12 +49,13 @@ void list_insert(list_t *list, int index, void *item) { void list_del(list_t *list, int index) { list->length--; - memmove(&list->items[index], &list->items[index + 1], sizeof(void*) * (list->length - index)); + if (index != list->length) { + memmove(&list->items[index], &list->items[index + 1], sizeof(void*) * (list->length - index)); + } } void list_cat(list_t *list, list_t *source) { - int i; - for (i = 0; i < source->length; ++i) { + for (int i = 0; i < source->length; ++i) { list_add(list, source->items[i]); } } From 5762431652b3df63eda790fc386c03c62ec7e9e8 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 04:41:57 -0400 Subject: [PATCH 19/21] CI: also build pages one and two --- .build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.build.yml b/.build.yml index 917b98f..dad64f5 100644 --- a/.build.yml +++ b/.build.yml @@ -24,3 +24,5 @@ tasks: git checkout scas mkdir bin/TI84pSE -p valgrind -s --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas --define TI84pSE --include "include/;bin/TI84pSE/;src/00/" --symbols bin/TI84pSE/00.sym --listing bin/TI84pSE/00.list src/00/base.asm -o bin/TI84pSE/00.bin -vv + valgrind -s --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas --define TI84pSE --include "include/;bin/TI84pSE/;src/01/" --symbols bin/TI84pSE/01.sym --listing bin/TI84pSE/01.list src/01/base.asm -o bin/TI84pSE/01.bin -vv + valgrind -s --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas --define TI84pSE --include "include/;bin/TI84pSE/;src/02/" --symbols bin/TI84pSE/02.sym --listing bin/TI84pSE/02.list src/02/base.asm -o bin/TI84pSE/02.bin -vv From 5e52d3037480e299b58dbd837b890b50f1f7a4ad Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 05:00:34 -0400 Subject: [PATCH 20/21] Fix last kernel memory leak --- assembler/directives.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assembler/directives.c b/assembler/directives.c index 2e0ec61..61aedfd 100644 --- a/assembler/directives.c +++ b/assembler/directives.c @@ -152,6 +152,7 @@ int handle_block(struct assembler_state *state, char **argv, int argc) { if (error == EXPRESSION_BAD_SYMBOL) { ERROR(ERROR_UNKNOWN_SYMBOL, state->column, symbol); + free_expression(expression); return 1; } @@ -167,6 +168,8 @@ int handle_block(struct assembler_state *state, char **argv, int argc) { result = 0; } } + free(buffer); + free_expression(expression); return 1; } From 601e9a35ca46e114fd4ec57e3a16f5c8a9e92ee5 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Fri, 11 Sep 2020 05:01:25 -0400 Subject: [PATCH 21/21] Update CI --- .build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.build.yml b/.build.yml index dad64f5..d6b0439 100644 --- a/.build.yml +++ b/.build.yml @@ -23,6 +23,4 @@ tasks: # Temporary: use scas PR git checkout scas mkdir bin/TI84pSE -p - valgrind -s --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas --define TI84pSE --include "include/;bin/TI84pSE/;src/00/" --symbols bin/TI84pSE/00.sym --listing bin/TI84pSE/00.list src/00/base.asm -o bin/TI84pSE/00.bin -vv - valgrind -s --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas --define TI84pSE --include "include/;bin/TI84pSE/;src/01/" --symbols bin/TI84pSE/01.sym --listing bin/TI84pSE/01.list src/01/base.asm -o bin/TI84pSE/01.bin -vv - valgrind -s --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas --define TI84pSE --include "include/;bin/TI84pSE/;src/02/" --symbols bin/TI84pSE/02.sym --listing bin/TI84pSE/02.list src/02/base.asm -o bin/TI84pSE/02.bin -vv + make AS="valgrind --track-origins=yes --leak-check=full --error-exitcode=1 ../scas/build/scas"