diff --git a/CHANGELOG.org b/CHANGELOG.org index 049ca1c..6e78ac4 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -17,12 +17,13 @@ * Current ** Added Added port to Knight-Native -Ported 1/24 working tests for AMD64 +Ported 4/24 working tests for AMD64 ** Changed ** Fixed Corrected Global char* to behave correctly when given a static string +Ensured pointers match register size ** Removed diff --git a/cc.h b/cc.h index c92f27c..202e83f 100644 --- a/cc.h +++ b/cc.h @@ -94,3 +94,4 @@ int string_index; /* Our Target Architecture */ int Architecture; +int register_size; diff --git a/cc_core.c b/cc_core.c index ba8d05d..9765755 100644 --- a/cc_core.c +++ b/cc_core.c @@ -407,7 +407,7 @@ void primary_expr_number() else { emit_out("LOADR R0 4\nJUMP 4\n'"); - emit_out(number_to_hex(size, 4)); + emit_out(number_to_hex(size, register_size)); emit_out("'"); } } @@ -591,7 +591,7 @@ void postfix_expr_arrow() } } - if((!match("=", global_token->s) && (4 >= i->size))) + if((!match("=", global_token->s) && (register_size >= i->size))) { if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("LOAD R0 R0 0\n"); else if(X86 == Architecture) emit_out("LOAD_INTEGER\n"); @@ -724,6 +724,16 @@ void additive_expr_stub() general_recursion(postfix_expr, "COPY_eax_to_ecx\nCOPY_ebx_to_eax\nSAL_eax_cl\n", "<<", additive_expr_stub); general_recursion(postfix_expr, "COPY_eax_to_ecx\nCOPY_ebx_to_eax\nSAR_eax_cl\n", ">>", additive_expr_stub); } + else if(AMD64 == Architecture) + { + general_recursion(postfix_expr, "ADD_rbx_to_rax\n", "+", additive_expr_stub); + general_recursion(postfix_expr, "SUBTRACT_rax_from_rbx_into_rbx\nMOVE_rbx_to_rax\n", "-", additive_expr_stub); + general_recursion(postfix_expr, "MULTIPLY_rax_by_rbx_into_rax\n", "*", additive_expr_stub); + general_recursion(postfix_expr, "XCHG_rax_rbx\nLOAD_IMMEDIATE_rdx %0\nDIVIDE_rax_by_rbx_into_rax\n", "/", additive_expr_stub); + general_recursion(postfix_expr, "XCHG_rax_rbx\nLOAD_IMMEDIATE_rdx %0\nMODULUS_rax_from_rbx_into_rbx\nMOVE_rdx_to_rax\n", "%", additive_expr_stub); + general_recursion(postfix_expr, "COPY_rax_to_rcx\nCOPY_rbx_to_rax\nSAL_rax_cl\n", "<<", additive_expr_stub); + general_recursion(postfix_expr, "COPY_rax_to_rcx\nCOPY_rbx_to_rax\nSAR_rax_cl\n", ">>", additive_expr_stub); + } else if(ARMV7L == Architecture) { general_recursion(postfix_expr, "'0' R0 R0 ADD R1 ARITH2_ALWAYS\n", "+", additive_expr_stub); @@ -826,6 +836,14 @@ void bitwise_expr_stub() general_recursion(relational_expr, "OR_eax_ebx\n", "||", bitwise_expr_stub); general_recursion(relational_expr, "XOR_ebx_eax_into_eax\n", "^", bitwise_expr_stub); } + else if(AMD64 == Architecture) + { + general_recursion(relational_expr, "AND_rax_rbx\n", "&", bitwise_expr_stub); + general_recursion(relational_expr, "AND_rax_rbx\n", "&&", bitwise_expr_stub); + general_recursion(relational_expr, "OR_rax_rbx\n", "|", bitwise_expr_stub); + general_recursion(relational_expr, "OR_rax_rbx\n", "||", bitwise_expr_stub); + general_recursion(relational_expr, "XOR_rbx_rax_into_rax\n", "^", bitwise_expr_stub); + } else if(ARMV7L == Architecture) { general_recursion(relational_expr, "NO_SHIFT R0 R0 AND R1 ARITH2_ALWAYS\n", "&", bitwise_expr_stub); @@ -865,23 +883,27 @@ void primary_expr() else if('-' == global_token->s[0]) { if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %0\n"); + else if(AMD64 == Architecture) emit_out("LOAD_IMMEDIATE_rax %0\n"); else if(ARMV7L == Architecture) emit_out("!0 R0 LOADI8_ALWAYS\n"); common_recursion(primary_expr); if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("NEG R0 R0\n"); else if(X86 == Architecture) emit_out("SUBTRACT_eax_from_ebx_into_ebx\nMOVE_ebx_to_eax\n"); + else if(AMD64 == Architecture) emit_out("SUBTRACT_rax_from_rbx_into_rbx\nMOVE_rbx_to_rax\n"); else if(ARMV7L == Architecture) emit_out("'0' R0 R0 SUB R1 ARITH2_ALWAYS\n"); } else if('!' == global_token->s[0]) { if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %1\n"); + else if(AMD64 == Architecture) emit_out("LOAD_IMMEDIATE_rax %1\n"); else if(ARMV7L == Architecture) emit_out("!1 R0 LOADI8_ALWAYS\n"); common_recursion(postfix_expr); if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("XORI R0 R0 1\n"); else if(X86 == Architecture) emit_out("XOR_ebx_eax_into_eax\n"); + else if(AMD64 == Architecture) emit_out("XOR_rbx_rax_into_rax\n"); else if(ARMV7L == Architecture) emit_out("'0' R0 R0 XOR R1 ARITH2_ALWAYS\n"); } else if('~' == global_token->s[0]) @@ -890,6 +912,7 @@ void primary_expr() if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("NOT R0 R0\n"); else if(X86 == Architecture) emit_out("NOT_eax\n"); + else if(AMD64 == Architecture) emit_out("NOT_rax\n"); else if(ARMV7L == Architecture) emit_out("'0' R0 R0 MVN_ALWAYS\n"); } else if(global_token->s[0] == '(') @@ -940,28 +963,32 @@ void collect_local() struct token_list* a = sym_declare(global_token->s, type_size, function->locals); if(match("main", function->s) && (NULL == function->locals)) { - if(KNIGHT_NATIVE == Architecture) a->depth = 4; + if(KNIGHT_NATIVE == Architecture) a->depth = register_size; else if(KNIGHT_POSIX == Architecture) a->depth = 20; else if(X86 == Architecture) a->depth = -20; + else if(AMD64 == Architecture) a->depth = -40; else if(ARMV7L == Architecture) a->depth = 16; } else if((NULL == function->arguments) && (NULL == function->locals)) { - if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) a->depth = 4; + if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) a->depth = register_size; else if(X86 == Architecture) a->depth = -8; + else if(AMD64 == Architecture) a->depth = -16; else if(ARMV7L == Architecture) a->depth = 8; } else if(NULL == function->locals) { if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) a->depth = function->arguments->depth + 8; else if(X86 == Architecture) a->depth = function->arguments->depth - 8; + else if(AMD64 == Architecture) a->depth = function->arguments->depth - 16; else if(ARMV7L == Architecture) a->depth = function->arguments->depth + 8; } else { - if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) a->depth = function->locals->depth + 4; - else if(X86 == Architecture) a->depth = function->locals->depth - 4; - else if(ARMV7L == Architecture) a->depth = function->locals->depth + 4; + if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) a->depth = function->locals->depth + register_size; + else if(X86 == Architecture) a->depth = function->locals->depth - register_size; + else if(AMD64 == Architecture) a->depth = function->locals->depth - register_size; + else if(ARMV7L == Architecture) a->depth = function->locals->depth + register_size; } function->locals = a; @@ -1068,12 +1095,14 @@ void process_for() if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP.Z R0 @FOR_END_"); else if(X86 == Architecture) emit_out("TEST\nJUMP_EQ %FOR_END_"); + else if(AMD64 == Architecture) emit_out("TEST\nJUMP_EQ %FOR_END_"); else if(ARMV7L == Architecture) emit_out("!0 CMPI8 R0 IMM_ALWAYS\n^~FOR_END_"); uniqueID_out(function->s, number_string); if(ARMV7L == Architecture) emit_out(" JUMP_EQUAL\n"); if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP @FOR_THEN_"); else if(X86 == Architecture) emit_out("JUMP %FOR_THEN_"); + else if(AMD64 == Architecture) emit_out("JUMP %FOR_THEN_"); else if(ARMV7L == Architecture) emit_out("^~FOR_THEN_"); uniqueID_out(function->s, number_string); if(ARMV7L == Architecture) emit_out(" JUMP_ALWAYS\n"); @@ -1086,6 +1115,7 @@ void process_for() if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP @FOR_"); else if(X86 == Architecture) emit_out("JUMP %FOR_"); + else if(AMD64 == Architecture) emit_out("JUMP %FOR_"); else if(ARMV7L == Architecture) emit_out("^~FOR_"); uniqueID_out(function->s, number_string); if(ARMV7L == Architecture) emit_out(" JUMP_ALWAYS\n"); @@ -1098,6 +1128,7 @@ void process_for() if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP @FOR_ITER_"); else if(X86 == Architecture) emit_out("JUMP %FOR_ITER_"); + else if(AMD64 == Architecture) emit_out("JUMP %FOR_ITER_"); else if(ARMV7L == Architecture) emit_out("^~FOR_ITER_"); uniqueID_out(function->s, number_string); if(ARMV7L == Architecture) emit_out(" JUMP_ALWAYS\n"); @@ -1156,6 +1187,7 @@ void process_do() if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP.NZ R0 @DO_"); else if(X86 == Architecture) emit_out("TEST\nJUMP_NE %DO_"); + else if(AMD64 == Architecture) emit_out("TEST\nJUMP_NE %DO_"); else if(ARMV7L == Architecture) emit_out("!0 CMPI8 R0 IMM_ALWAYS\n^~DO_"); uniqueID_out(function->s, number_string); if(ARMV7L == Architecture) emit_out(" JUMP_NE\n"); @@ -1195,6 +1227,7 @@ void process_while() if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP.Z R0 @END_WHILE_"); else if(X86 == Architecture) emit_out("TEST\nJUMP_EQ %END_WHILE_"); + else if(AMD64 == Architecture) emit_out("TEST\nJUMP_EQ %END_WHILE_"); else if(ARMV7L == Architecture) emit_out("!0 CMPI8 R0 IMM_ALWAYS\n^~END_WHILE_"); uniqueID_out(function->s, number_string); if(ARMV7L == Architecture) emit_out(" JUMP_EQUAL\t"); @@ -1206,6 +1239,7 @@ void process_while() if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP @WHILE_"); else if(X86 == Architecture) emit_out("JUMP %WHILE_"); + else if(AMD64 == Architecture) emit_out("JUMP %WHILE_"); else if(ARMV7L == Architecture) emit_out("^~WHILE_"); uniqueID_out(function->s, number_string); if(ARMV7L == Architecture) emit_out(" JUMP_ALWAYS\n"); @@ -1255,6 +1289,7 @@ void process_break() if(NULL == i) break; if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("POPR R1 R15\t# break_cleanup_locals\n"); else if(X86 == Architecture) emit_out("POP_ebx\t# break_cleanup_locals\n"); + else if(AMD64 == Architecture) emit_out("POP_RBX\t# break_cleanup_locals\n"); else if(ARMV7L == Architecture) emit_out("{R1} POP_ALWAYS\t# break_cleanup_locals\n"); i = i->next; } @@ -1262,6 +1297,7 @@ void process_break() if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP @"); else if(X86 == Architecture) emit_out("JUMP %"); + else if(AMD64 == Architecture) emit_out("JUMP %"); else if(ARMV7L == Architecture) emit_out("^~"); emit_out(break_target_head); @@ -1287,6 +1323,7 @@ void recursive_statement() /* Clean up any locals added */ if(((X86 == Architecture) && !match("RETURN\n", out->s)) || + ((AMD64 == Architecture) && !match("RETURN\n", out->s)) || (((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) && !match("RET R15\n", out->s)) || ((ARMV7L == Architecture) && !match("'1' LR RETURN\n", out->s))) { @@ -1412,13 +1449,15 @@ void collect_arguments() { if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) a->depth = 0; else if(X86 == Architecture) a->depth = -4; + else if(AMD64 == Architecture) a->depth = -8; else if(ARMV7L == Architecture) a->depth = 4; } else { - if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) a->depth = function->arguments->depth + 4; - else if(X86 == Architecture) a->depth = function->arguments->depth - 4; - else if(ARMV7L == Architecture) a->depth = function->arguments->depth + 4; + if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) a->depth = function->arguments->depth + register_size; + else if(X86 == Architecture) a->depth = function->arguments->depth - register_size; + else if(AMD64 == Architecture) a->depth = function->arguments->depth - register_size; + else if(ARMV7L == Architecture) a->depth = function->arguments->depth + register_size; } global_token = global_token->next; diff --git a/cc_types.c b/cc_types.c index 931ed15..c8d6cc0 100644 --- a/cc_types.c +++ b/cc_types.c @@ -23,7 +23,6 @@ int numerate_string(char *a); /* Initialize default types */ void initialize_types() { - int register_size; if(AMD64 == Architecture) register_size = 8; else register_size = 4; @@ -200,7 +199,7 @@ void create_struct() head->next = global_types; global_types = head; global_token = global_token->next; - i->size = 4; + i->size = register_size; require_match("ERROR in create_struct\n Missing {\n", "{"); struct type* last = NULL; while('}' != global_token->s[0]) diff --git a/makefile b/makefile index 842946b..64a81b5 100644 --- a/makefile +++ b/makefile @@ -65,6 +65,12 @@ results: test: test00-amd64-binary \ test01-amd64-binary \ test02-amd64-binary \ + test03-amd64-binary \ + test04-amd64-binary \ + test05-amd64-binary \ + test06-amd64-binary \ + test07-amd64-binary \ + test08-amd64-binary \ test00-knight-posix-binary \ test01-knight-posix-binary \ test02-knight-posix-binary \ @@ -179,6 +185,24 @@ test01-amd64-binary: M2-Planet | results test02-amd64-binary: M2-Planet | results test/test02/hello-amd64.sh +test03-amd64-binary: M2-Planet | results + test/test03/hello-amd64.sh + +test04-amd64-binary: M2-Planet | results + test/test04/hello-amd64.sh + +test05-amd64-binary: M2-Planet | results + test/test05/hello-amd64.sh + +test06-amd64-binary: M2-Planet | results + test/test06/hello-amd64.sh + +test07-amd64-binary: M2-Planet | results + test/test07/hello-amd64.sh + +test08-amd64-binary: M2-Planet | results + test/test08/hello-amd64.sh + test00-knight-posix-binary: M2-Planet | results test/test00/hello-knight-posix.sh diff --git a/test/common_amd64/amd64_defs.M1 b/test/common_amd64/amd64_defs.M1 index 70f21f9..8c1de4a 100644 --- a/test/common_amd64/amd64_defs.M1 +++ b/test/common_amd64/amd64_defs.M1 @@ -17,35 +17,54 @@ DEFINE ADD_IMMEDIATE_to_rax 4805 DEFINE ADD_IMMEDIATE_to_rbp 4881C5 +DEFINE ADD_rax_to_rbx 4801C3 DEFINE ADD_rbp_to_rax 4801E8 +DEFINE ADD_rbx_to_rax 4801D8 +DEFINE AND_rax_rbx 4821D8 DEFINE CALL_IMMEDIATE E8 -DEFINE CMP 4839D8 +DEFINE CMP 4839C3 +DEFINE COPY_rax_to_rcx 4889C1 DEFINE COPY_rax_to_rdi 4889C7 +DEFINE COPY_rbx_to_rax 4889D8 DEFINE COPY_rbp_to_rax 4889E8 +DEFINE COPY_rbx_to_rdi 4889DF DEFINE COPY_rdi_to_rbp 4889FD DEFINE COPY_rsp_to_rbp 4889E5 DEFINE COPY_RSP_to_RDI 4889E7 DEFINE JUMP E9 DEFINE JUMP_EQ 0F84 +DEFINE JUMP_NE 0F85 DEFINE LOAD_BASE_ADDRESS_rax 488D85 +DEFINE LOAD_BYTE 8A00 DEFINE LOAD_EFFECTIVE_ADDRESS_rsi 488DB424 DEFINE LOAD_IMMEDIATE_rax 48C7C0 +DEFINE LOAD_IMMEDIATE_rbx 48C7C3 DEFINE LOAD_IMMEDIATE_rdi 48C7C7 DEFINE LOAD_IMMEDIATE_rdx 48C7C2 DEFINE LOAD_INTEGER 488B00 +DEFINE LOAD_RSP_IMMEDIATE_into_rax 488B8424 +DEFINE MOVE_rbx_to_rax 4889D8 DEFINE MOVEZX 480FB6C0 +DEFINE POP_RAX 58 DEFINE POP_RBP 5D DEFINE POP_RBX 5B DEFINE POP_RDI 5F DEFINE PUSH_RAX 50 DEFINE PUSH_RBP 55 +DEFINE PUSH_RBX 53 DEFINE PUSH_RDI 57 DEFINE RETURN C3 DEFINE SAL_rax_Immediate8 48C1E0 +DEFINE SAL_rax_cl 48D3E0 +DEFINE SAR_rax_cl 48D3E8 DEFINE SETE 0F94C0 DEFINE SETG 0F9FC0 DEFINE SETGE 0F9DC0 DEFINE SETL 0F9CC0 DEFINE SETLE 0F9EC0 +DEFINE SETNE 0F95C0 +DEFINE STORE_INTEGER 488903 +DEFINE SUBTRACT_rax_from_rbx_into_rbx 4829C3 DEFINE SYSCALL 0F05 DEFINE TEST 4885C0 +DEFINE XOR_rbx_rax_into_rax 4831D8 diff --git a/test/common_amd64/functions/malloc.c b/test/common_amd64/functions/malloc.c new file mode 100644 index 0000000..2f8d9d6 --- /dev/null +++ b/test/common_amd64/functions/malloc.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2016 Jeremiah Orians + * This file is part of M2-Planet. + * + * M2-Planet is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * M2-Planet is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with M2-Planet. If not, see . + */ + +// CONSTANT NULL 0 + +void* malloc(int size) +{ + asm("LOAD_RSP_IMMEDIATE_into_rax %8" + "PUSH_RAX" + "LOAD_IMMEDIATE_rax %12" + "LOAD_IMMEDIATE_rdi %0" + "SYSCALL" + "POP_RBX" + "ADD_rax_to_rbx" + "COPY_rbx_to_rdi" + "PUSH_RAX" + "PUSH_RBX" + "LOAD_IMMEDIATE_rax %12" + "SYSCALL" + "POP_RBX" + "CMP" + "POP_RAX" + "JUMP_EQ %FUNCTION_malloc_Done" + "LOAD_IMMEDIATE_rax %-1" + ":FUNCTION_malloc_Done"); +} diff --git a/test/common_x86/functions/malloc.c b/test/common_x86/functions/malloc.c index a44f02b..6cc1216 100644 --- a/test/common_x86/functions/malloc.c +++ b/test/common_x86/functions/malloc.c @@ -19,7 +19,7 @@ void* malloc(int size) { - asm("STORE_eax_into_ESP_IMMEDIATE8 !4" + asm("LOAD_ESP_IMMEDIATE_into_eax %4" "PUSH_eax" "LOAD_IMMEDIATE_eax %45" "LOAD_IMMEDIATE_ebx %0" diff --git a/test/common_x86/x86_defs.M1 b/test/common_x86/x86_defs.M1 index d3479e5..ef081da 100644 --- a/test/common_x86/x86_defs.M1 +++ b/test/common_x86/x86_defs.M1 @@ -83,7 +83,6 @@ DEFINE SETGE 0F9DC0 DEFINE SETG 0F9FC0 DEFINE SETNE 0F95C0 DEFINE STORE_CHAR 8803 -DEFINE STORE_eax_into_ESP_IMMEDIATE8 8B4424 DEFINE STORE_INTEGER 8903 DEFINE SUBTRACT_eax_from_ebx_into_ebx 29C3 DEFINE TEST 85C0 diff --git a/test/test.answers b/test/test.answers index aa6cee4..2e5c0a4 100644 --- a/test/test.answers +++ b/test/test.answers @@ -8,35 +8,41 @@ c52562bd0aabb86ce8ca177f22f8d0455769b444df2d4d62894faab63b7151d8 test/results/t eab60d537e8418af8b64af4b1d1a5711085fb8f668403ce93de4393584e0edea test/results/test01-knight-native-binary 486ee05ccea796a9cfa9bfb23189b8e014b7ce8d14fea03b27d679d410fe17dd test/results/test01-knight-posix-binary eae96857f2b6d8e8ba86ac06e72345ea572622b358b23978bb5f2db1baadf41c test/results/test01-x86-binary -d6158a185d9b3837a7bfa31c6d5d8d60eb1419c6b47c20139050b1fa9924a868 test/results/test02-amd64-binary +c742a827684287cb82b4a3526eb996eda941bf284e11aab431816a3ef1e0804c test/results/test02-amd64-binary 63a79206ff41068e8cc585e535717a4f6a80506137891ee3905daf473bfc6420 test/results/test02-armv7l-binary bbcc2a7a785a29bcd36d26242afbc907d449346bce6e21634837d1f2ce31b7f9 test/results/test02-knight-native-binary e6493845b9e94a617649638252f23502f9212de583fd00cba6cc07fffd296e32 test/results/test02-knight-posix-binary 8ead336d2f3f72d5874230492e0472edec61d355905e8636e3dfb2731695037c test/results/test02-x86-binary +c611b3cab0a736e7176dac21aa04555039b28362d0cfd3a5c56cf29ca3e48616 test/results/test03-amd64-binary 58e95f5eb581d8202c941809d8b162da1ffeda714af7d36699f330dc5c276880 test/results/test03-armv7l-binary 18b906ce8866aea1e8464dbeb6eb118b28cfeb272896b20d1de1d7d69980a69c test/results/test03-knight-native-binary 96849d5a9294799a9648c24db21b2dab1555dd5ba69d172d77df800622347226 test/results/test03-knight-posix-binary 2313cb3f1a2b9eb6bf15f8d43418e15d6c16f7f1b5c22700fdfc2b38beb59192 test/results/test03-x86-binary +b773d7ec7c550b71997ce451af7e1ee59fe6597b32adc455b271b7d173d5eae9 test/results/test04-amd64-binary 69997b16f41de2ace669e6e331efbae4ad8da3483262476d7a490a450fe082ad test/results/test04-armv7l-binary 9ce8ab26d1db3aad3d449d33dd012e1875acc2e8138911d24adda1a667db8deb test/results/test04-knight-native-binary df9ba08dfa69ac6cbb4483146dbbe079ef575d7de8318e2e52283151ebf24bd3 test/results/test04-knight-posix-binary b7ddb37063c541c6a315809c4438aa235d6702f54bb64f4ffc88dbe78617de81 test/results/test04-x86-binary +baa88c5c70c04ec37f5108146b16e6393a6271d909f14db3c206d4763767fc75 test/results/test05-amd64-binary f84660128cf57c135f5f163b3558527abd962e202bcc588abd13230862a287e1 test/results/test05-armv7l-binary 0922872b8bf9baf032a378dcc2aa4aecf45ce94dcbf476ef443f145106888293 test/results/test05-knight-native-binary 5db3a2fbd84150dae41e1c778f2822d053a0539cbdf59bba56e5514222f46674 test/results/test05-knight-posix-binary 90321c43b2384050e5f03e5af67d345b55dd8a43e96d1f3b7f29d3c5dae3f077 test/results/test05-x86-binary +98fab6d12630465d4e3cb72102b541c818e75b034e1ca1823c26ad6dabc4a910 test/results/test06-amd64-binary e09cccfc8f46004f12a28cfca4f07835a895dfc5567e12759d19b57d63e1baaa test/results/test06-armv7l-binary 6f1f99bdcde87e3674a4defd03f094b762a089c771ae91c33c401a0480091bff test/results/test06-knight-native-binary b177d769ae44c3509d9a08d0ee631ec69654dc5d723408bf0decdc67c42aae27 test/results/test06-knight-posix-binary 663fc6eefe965f237b6bf5a211398c8ae1210f97ff39b59603677e92462c68c7 test/results/test06-x86-binary +58af02adcf5a1bfa21dae4992ed3fe0a1f708c67bb5bf1f842a51b3b8eeddf05 test/results/test07-amd64-binary 512e3d774b1d96808f046c01a6b08e818945056939515668530a2e17ea0ea6db test/results/test07-armv7l-binary d47fc54b2d577857ab15b3a571e7138fd60e80471066df524cff5313fd31b712 test/results/test07-knight-native-binary 9159c4ba8196b24ec78bc9ebfbc7066d510ddbf03461736e7795a48634134dc5 test/results/test07-knight-posix-binary a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/test07-x86-binary +3a9a7815ad19bbdd9ea6921ecae8521089df27ac08bc207df11a2a0080f5acbb test/results/test08-amd64-binary 8537995c4da57dae51a19f0845f4a57c682e67a9e7101352d5980ff06a5b2847 test/results/test08-armv7l-binary 3a1de0143bfe2302ab0f7da189a0a14c285efebf7c16d7ea0177751c9e3b2175 test/results/test08-knight-native-binary b824859fd0e39f1417742a1b9a1cec18ade78afdd80ce2c64cb54cdf7683f53a test/results/test08-knight-posix-binary -f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/test08-x86-binary +3a099298d2235ad00518bb6e2f2f9e25d429c4fe576dfc9cf083e3e0053bdcc2 test/results/test08-x86-binary 81cae9bfb57c727bcb16b59d81d9d588e84350b75a20170afa06e3d269029b87 test/results/test09-armv7l-binary b40d198af6c31f1af513ec70c6be9c6daa43cccf48a7191f4d984f81cdfbf623 test/results/test09-knight-native-binary 0feaacc13ad24c2b513fd9d46a58c38b1af57e77275c9a148cafb4a0d3cc7b7a test/results/test09-knight-posix-binary @@ -44,10 +50,10 @@ b40d198af6c31f1af513ec70c6be9c6daa43cccf48a7191f4d984f81cdfbf623 test/results/t 5df859c88e9cbb2758f823e020d9993d50ba81fae20d469c03ec2b196d55f580 test/results/test10-armv7l-binary 1154f39f25dcd6d914e9a542306f95280926baf985d011b2152c7ea0b87ab42d test/results/test10-knight-native-binary c1b5a2a3cd46c5e95e5540e871c2a916e028684ca80f51c001ef489342e27625 test/results/test10-knight-posix-binary -020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-x86-binary -68e1659a4cfcb61f78476144ec19f7869c9ba7f933bcf49490224c74557f0453 test/results/test100-armv7l-binary -c84ac8afbfae1eab10e3993a9dfbc8cf65238cb12aae403f7b7bbc35dd8197fd test/results/test100-knight-posix-binary -92527abb77f29e00bfdfb494126ec2996bf5bc4764f919f766dbaaa47d0a129a test/results/test100-x86-binary +b3e13d54aab689137628fb9c4487bfd8288f9bd18bef8fe756577c8d2dce1f1f test/results/test10-x86-binary +5d729f03e0445d11a37e8b33fdb199cebe8b38853f988c58252b7dffedc62f8c test/results/test100-armv7l-binary +9a83e2bd8a7fd9af63820bcbc914ce4ea2c67a3d77464a8e584fed3edc19cc40 test/results/test100-knight-posix-binary +8369f737c30cec44597707f4b27749e39d9dbb45bef0ba41b40ac3a96e5f74c7 test/results/test100-x86-binary d9d465340abbce2d5964a6bc58e6cdd0ef93fb3d0199eaa823c86ec6abd0452a test/results/test11-armv7l-binary 955b564d2c89abf2cfc6c80d766cd11479d146b828dec69e654b0958a62d5e6e test/results/test11-knight-native-binary 63fd5fbf389d1b19031026df193ec55e98d923b8568007125b80bc246c094496 test/results/test11-knight-posix-binary @@ -72,35 +78,35 @@ aeb94a4142633f20d7be4f8e74f0d5edc9050afb76f49cb504a1c264bf1ef96b test/results/t aae309ad68840fbc1685412c4fe42bb54bb9caf20a92b3251cfa4749c8698a0b test/results/test17-armv7l-binary 537f6885bf76a95ad322b4dc416d7de0bb73b5bbfc3bc2a9ea096e240b4081b8 test/results/test17-knight-native-binary 0323ae8fa9e79cae9a58eec89a80b2c354db276d76c6f50b3bf50840327d4950 test/results/test17-knight-posix-binary -403800bf92af0ca94563b0e1bdeceb355b805994bc6cbbd5691b37e8ade225da test/results/test17-x86-binary +56a83f34aa57b10efdea636135491043d8c8b09dc09b451b58c27801ca82990e test/results/test17-x86-binary 122d78f9943f3678a07a9ec82b491e041664b31931ac5056c8a238eb0753e879 test/results/test18-armv7l-binary 4da569a63039551da7dc2f8fd1505d7c1661ec1765aae301071ac0c24c2064c3 test/results/test18-knight-native-binary d0f0b1428c8db70806d6e2e5b81aca4b6752c4a581a3fa83da064317ceb605b0 test/results/test18-knight-posix-binary -8de7384c4633b1d5c60bbbb298d7f4b738e52fbc266ef4ef9a48b3cb995e3176 test/results/test18-x86-binary +8e3f5e2dfacf07aa3ab4376e9db2649cd51b53ed68e0e9789fbcaaac1277ad64 test/results/test18-x86-binary 4e3f590623e2baae4c42e68b6f8f35d9731e4d5a64bbe5112780b8382225f916 test/results/test19-armv7l-binary 32ba6ae74a8756fe4b95c65a643513bdd785778f98a878b3ea5459b5aaccaa38 test/results/test19-knight-posix-binary -5706ee8a2228a04d22e4fa09523c6f27de6289c39e88f1dd9b773257f19acd24 test/results/test19-x86-binary +07d8975a384003b5726e1e3c517fba25f55d9c19e4122273303743c94a18bd70 test/results/test19-x86-binary ef9d0050388ab15454b437bc40c19737cda9211cb3704a0b2619fae232239d7f test/results/test20-armv7l-binary 7ae1ba10ff6b6bf34148945ee44b9461aa6d1a16094e77fdf34b76e9a360a5b2 test/results/test20-knight-native-binary 6a59795dbb4397d0efaf1ad613d646ec435eec62db30eb758bcf2499d651520e test/results/test20-knight-posix-binary -365c96fb8368710d620a76facd6bebcdeeb6f6d30ceaf0a6f1567fc3fcbe9b54 test/results/test20-x86-binary +0d1a43723d0482a21028164e33ff116d66302d6042a88eacf08436a351494530 test/results/test20-x86-binary 737b2262e54035b5cac20fc43013956a0c4fd144c6b40ffc546ee05a6133922f test/results/test21-armv7l-binary 3c096914ca492c60bd53193fcc109549fae170052b347e3e62dabcbd9784691f test/results/test21-knight-posix-binary -68e67e7237ae5aa92940e61255a5d25ca5aaadea4eb3b26b33bfcd6af83e7d9d test/results/test21-x86-binary +f5d6430d6fade0d4acdaeda1662d9bfdeff881a75e2c877dc738f3485ddb4e63 test/results/test21-x86-binary 883b112bca57ddab502af939327765508fa37ea3a588c37094d3798b2267171b test/results/test22-armv7l-binary 7ccc16255ce81a9b35934649b5446face10db899cadaf00008c582934eefaa37 test/results/test22-knight-posix-binary -8007bd11c2bbcb3b6cda0e56f96c53929b829a3da8096b2cc6289b3d0e8c4f9e test/results/test22-x86-binary +f30be64f9bbebb5c1bfa16f584754106de5d95d48b6882b4458beb5e72b2c473 test/results/test22-x86-binary b70c97824a6008dd1be8a4360874c794d8d027004cab9b86a53fda95fef2e4cc test/results/test23-armv7l-binary 1b86c800067f64ffd6cfd4b39155b81e3b0fc7ffa6d43d1edd75852edd2d583f test/results/test23-knight-posix-binary -dc1594064c575cc718d8729075a74c435d3c98e8a92df3a9146bea3e119201e1 test/results/test23-x86-binary +f25bbe673256a099030a1d7dcf4d1c85fbdc22da3dfb30c11f93ad72e3356414 test/results/test23-x86-binary 1deae7d8b3ed2373afb1dba21d192ce642d17b47483c9ec72f3081089ac46725 test/results/test24-armv7l-binary a1053415b79f08f8bcc9ebda8c9b096ed4e66c483504ba3d7d4dbebad2e3fabf test/results/test24-knight-posix-binary -f1eea0a221b228e9258c9223ca8b555a11009d985288437d8368d61443b9322c test/results/test24-x86-binary +adb392ddd4f3daab1a9afc1eb0bf00cb388a6c45db7754f8455f39757e7f62f6 test/results/test24-x86-binary ef17edf7febc6da5f1cda6b8c367010ff9fd446df8edcfdaf9570ab4fcc63a7c test/results/test25-armv7l-binary -901cdea77f11257051e9236f51c77cd10224b8bf5e86a9b930872c19c6df5a58 test/results/test25-x86-binary +d8aa81fce8064db6697376b140cbf6aeeb91ff6728d1a80173c431bcb0526168 test/results/test25-x86-binary 70480a64dc02b0ef9275c1d69ca61712cc0c649f57dd63a019cb2359dc24f07b test/results/test26-armv7l-binary -d69771c515c55d11549e18c5b15c3772e101416c9390bda43d283a3b3938c4ad test/results/test26-x86-binary +63d55e89c7c5bd06f9bf2af2408277587ada25e2836a060438256dbdc6b894b5 test/results/test26-x86-binary 4cd7628090622b165d2c2d1d4c089476a6d661d494e2fadb1ad9b0906585cd75 test/results/test99-armv7l-binary eaca2f7f70b75b7503ee040bebd0dc0fa961a25597622356f70faadec759d696 test/results/test99-knight-native-binary bea554c06c8ecdb9eaae2c586a2006487968625b9570cbe305f69959c0e680e7 test/results/test99-knight-posix-binary -23c98b1c7fb90eb850e26895033a243aa1a10c2420418ecd03a5364f347d8872 test/results/test99-x86-binary +e970ab9e2e85cd01c0f9c14f0af1954e3628a44c988ca8175a983037457522f9 test/results/test99-x86-binary diff --git a/test/test03/hello-amd64.sh b/test/test03/hello-amd64.sh new file mode 100755 index 0000000..a7b7603 --- /dev/null +++ b/test/test03/hello-amd64.sh @@ -0,0 +1,44 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -x +# Build the test +bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/putchar.c \ + -f test/common_amd64/functions/exit.c \ + -f test/test03/constant.c \ + -o test/test03/constant.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_amd64/amd64_defs.M1 \ + -f test/common_amd64/libc-core.M1 \ + -f test/test03/constant.M1 \ + --LittleEndian \ + --architecture amd64 \ + -o test/test03/constant.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test03/constant.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test03-amd64-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] +then + # Verify that the compiled program returns the correct result + out=$(./test/results/test03-amd64-binary 2>&1 ) + [ 42 = $? ] || exit 4 + [ "$out" = "Hello mes" ] || exit 5 +fi +exit 0 diff --git a/test/test04/hello-amd64.sh b/test/test04/hello-amd64.sh new file mode 100755 index 0000000..a8eb43d --- /dev/null +++ b/test/test04/hello-amd64.sh @@ -0,0 +1,44 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -x +# Build the test +bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/putchar.c \ + -f test/common_amd64/functions/exit.c \ + -f test/test04/call.c \ + -o test/test04/call.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_amd64/amd64_defs.M1 \ + -f test/common_amd64/libc-core.M1 \ + -f test/test04/call.M1 \ + --LittleEndian \ + --architecture amd64 \ + -o test/test04/call.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test04/call.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test04-amd64-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] +then + # Verify that the compiled program returns the correct result + out=$(./test/results/test04-amd64-binary 2>&1 ) + [ 42 = $? ] || exit 4 + [ "$out" = "Hello mes" ] || exit 5 +fi +exit 0 diff --git a/test/test05/hello-amd64.sh b/test/test05/hello-amd64.sh new file mode 100755 index 0000000..3b84816 --- /dev/null +++ b/test/test05/hello-amd64.sh @@ -0,0 +1,44 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -x +# Build the test +bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/putchar.c \ + -f test/common_amd64/functions/exit.c \ + -f test/test05/string.c \ + -o test/test05/string.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_amd64/amd64_defs.M1 \ + -f test/common_amd64/libc-core.M1 \ + -f test/test05/string.M1 \ + --LittleEndian \ + --architecture amd64 \ + -o test/test05/string.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test05/string.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test05-amd64-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] +then + # Verify that the compiled program returns the correct result + out=$(./test/results/test05-amd64-binary 2>&1 ) + [ 42 = $? ] || exit 4 + [ "$out" = "Hello mes" ] || exit 5 +fi +exit 0 diff --git a/test/test06/hello-amd64.sh b/test/test06/hello-amd64.sh new file mode 100755 index 0000000..4ef2120 --- /dev/null +++ b/test/test06/hello-amd64.sh @@ -0,0 +1,44 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -ex +# Build the test +bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/putchar.c \ + -f test/test06/for.c \ + -o test/test06/for.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_amd64/amd64_defs.M1 \ + -f test/common_amd64/libc-core.M1 \ + -f test/test06/for.M1 \ + --LittleEndian \ + --architecture amd64 \ + -o test/test06/for.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test06/for.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test06-amd64-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] +then + . ./sha256.sh + # Verify that the resulting file works + ./test/results/test06-amd64-binary >| test/test06/proof || exit 4 + out=$(sha256_check test/test06/proof.answer) + [ "$out" = "test/test06/proof: OK" ] || exit 5 +fi +exit 0 diff --git a/test/test07/hello-amd64.sh b/test/test07/hello-amd64.sh new file mode 100755 index 0000000..2188dc6 --- /dev/null +++ b/test/test07/hello-amd64.sh @@ -0,0 +1,45 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -ex +# Build the test +bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/putchar.c \ + -f test/common_amd64/functions/exit.c \ + -f test/test07/do.c \ + -o test/test07/do.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_amd64/amd64_defs.M1 \ + -f test/common_amd64/libc-core.M1 \ + -f test/test07/do.M1 \ + --LittleEndian \ + --architecture amd64 \ + -o test/test07/do.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test07/do.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test07-amd64-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] +then + . ./sha256.sh + # Verify that the resulting file works + ./test/results/test07-amd64-binary >| test/test07/proof || exit 4 + out=$(sha256_check test/test07/proof.answer) + [ "$out" = "test/test07/proof: OK" ] || exit 5 +fi +exit 0 diff --git a/test/test08/hello-amd64.sh b/test/test08/hello-amd64.sh new file mode 100755 index 0000000..97bcd6c --- /dev/null +++ b/test/test08/hello-amd64.sh @@ -0,0 +1,45 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -x +# Build the test +bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/putchar.c \ + -f test/common_amd64/functions/exit.c \ + -f test/common_amd64/functions/malloc.c \ + -f test/test08/struct.c \ + -o test/test08/struct.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_amd64/amd64_defs.M1 \ + -f test/common_amd64/libc-core.M1 \ + -f test/test08/struct.M1 \ + --LittleEndian \ + --architecture amd64 \ + -o test/test08/struct.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test08/struct.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test08-amd64-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] +then + # Verify that the compiled program returns the correct result + out=$(./test/results/test08-amd64-binary 2>&1 ) + [ 32 = $? ] || exit 4 + [ "$out" = "35419896642975313541989657891634" ] || exit 5 +fi +exit 0 diff --git a/test/test100/proof.answer b/test/test100/proof.answer index 6172157..412fa33 100644 --- a/test/test100/proof.answer +++ b/test/test100/proof.answer @@ -1 +1 @@ -8ba20fc011941e6ad6bf17672820e0fafae7ac604f7730d138e1bb1c291d919a test/test100/proof +276f2a0a47246aaea1447be06b913cc49e037e3454939728650a68a384973305 test/test100/proof diff --git a/test/test21/test.M1 b/test/test21/test.M1 index c6fd976..a87800b 100644 --- a/test/test21/test.M1 +++ b/test/test21/test.M1 @@ -198,7 +198,7 @@ JUMP %WHILE_0 RETURN # Defining function malloc :FUNCTION_malloc -STORE_eax_into_ESP_IMMEDIATE8 !4 +LOAD_ESP_IMMEDIATE_into_eax %4 PUSH_eax LOAD_IMMEDIATE_eax %45 LOAD_IMMEDIATE_ebx %0 diff --git a/test/test23/proof.answer b/test/test23/proof.answer index 2fd422a..e52f115 100644 --- a/test/test23/proof.answer +++ b/test/test23/proof.answer @@ -1 +1 @@ -7d8c3c0220a44f64fbeaadd4818cab6f9fb3ff679a2e0ac17ef965f3cc5716a1 test/test23/proof +d07a55deb116430d25b4f5f3f59f91d2cb8ecb4702c764992ce23c96fd49230d test/test23/proof