Upgraded to 14/24 working tests
This commit is contained in:
parent
d3965e811f
commit
577f19dea9
|
@ -26,7 +26,7 @@ Added support for octal and binary numbers
|
|||
Added support for \0
|
||||
Added support for GET_MACHINE_FLAGS in tests
|
||||
Added --architecture flag
|
||||
Added 10/24 working tests for knight-posix
|
||||
Added 14/24 working tests for knight-posix
|
||||
Added working HEAP/malloc to knight-posix
|
||||
|
||||
** Changed
|
||||
|
@ -40,6 +40,7 @@ Updated to mescc-tools 0.6.0 syntax
|
|||
Changed default architecture to knight-native
|
||||
Moved x86 specific exit.c and putchar.c to test/common_x86/functions
|
||||
Relocated x86 specific libc.M1 to test/common_x86
|
||||
Formalized Knight-posix execve standard
|
||||
|
||||
** Fixed
|
||||
Fixed typo in file headers
|
||||
|
|
10
cc.c
10
cc.c
|
@ -74,11 +74,11 @@ int main(int argc, char** argv)
|
|||
else if(match(argv[i], "-A") || match(argv[i], "--architecture"))
|
||||
{
|
||||
arch = argv[i + 1];
|
||||
if(match("knight-native", arch)) Architecture = 0;
|
||||
else if(match("knight-posix", arch)) Architecture = 1;
|
||||
else if(match("x86", arch)) Architecture = 2;
|
||||
else if(match("amd64", arch)) Architecture = 3;
|
||||
else if(match("armv7l", arch)) Architecture = 40;
|
||||
if(match("knight-native", arch)) Architecture = KNIGHT_NATIVE;
|
||||
else if(match("knight-posix", arch)) Architecture = KNIGHT_POSIX;
|
||||
else if(match("x86", arch)) Architecture = X86;
|
||||
else if(match("amd64", arch)) Architecture = AMD64;
|
||||
else if(match("armv7l", arch)) Architecture = ARMV7L;
|
||||
else
|
||||
{
|
||||
file_print("Unknown architecture: ", stderr);
|
||||
|
|
18
cc.h
18
cc.h
|
@ -19,12 +19,24 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_STRING 4096
|
||||
// CONSTANT MAX_STRING 4096
|
||||
#define FALSE 0
|
||||
#define MAX_STRING 4096
|
||||
// CONSTANT FALSE 0
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
// CONSTANT TRUE 1
|
||||
#define TRUE 1
|
||||
|
||||
// CONSTANT KNIGHT_NATIVE 0
|
||||
#define KNIGHT_NATIVE 0
|
||||
// CONSTANT KNIGHT_POSIX 1
|
||||
#define KNIGHT_POSIX 1
|
||||
// CONSTANT X86 2
|
||||
#define X86 2
|
||||
// CONSTANT AMD64 3
|
||||
#define AMD64 3
|
||||
// CONSTANT ARMV7L 4
|
||||
#define ARMV7L 4
|
||||
|
||||
|
||||
void file_print(char* s, FILE* f);
|
||||
int match(char* a, char* b);
|
||||
|
|
230
cc_core.c
230
cc_core.c
|
@ -114,13 +114,13 @@ void function_call(char* s, int bool)
|
|||
require_match("ERROR in process_expression_list\nNo ( was found\n", "(");
|
||||
int passed = 0;
|
||||
|
||||
if(1 == Architecture)
|
||||
if(KNIGHT_POSIX == Architecture)
|
||||
{
|
||||
emit_out("PUSHR R13 R15\t# Prevent overwriting in recursion\n");
|
||||
emit_out("PUSHR R14 R15\t# Protect the old base pointer\n");
|
||||
emit_out("COPY R13 R15\t# Copy new base pointer\n");
|
||||
}
|
||||
else if(2 == Architecture)
|
||||
else if(X86 == Architecture)
|
||||
{
|
||||
emit_out("PUSH_edi\t# Prevent overwriting in recursion\n");
|
||||
emit_out("PUSH_ebp\t# Protect the old base pointer\n");
|
||||
|
@ -130,16 +130,16 @@ void function_call(char* s, int bool)
|
|||
if(global_token->s[0] != ')')
|
||||
{
|
||||
expression();
|
||||
if(1 == Architecture) emit_out("PUSHR R0 R15\t#_process_expression1\n");
|
||||
else if(2 == Architecture) emit_out("PUSH_eax\t#_process_expression1\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("PUSHR R0 R15\t#_process_expression1\n");
|
||||
else if(X86 == Architecture) emit_out("PUSH_eax\t#_process_expression1\n");
|
||||
passed = 1;
|
||||
|
||||
while(global_token->s[0] == ',')
|
||||
{
|
||||
global_token = global_token->next;
|
||||
expression();
|
||||
if(1 == Architecture) emit_out("PUSHR R0 R15\t#_process_expression2\n");
|
||||
else if(2 == Architecture) emit_out("PUSH_eax\t#_process_expression2\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("PUSHR R0 R15\t#_process_expression2\n");
|
||||
else if(X86 == Architecture) emit_out("PUSH_eax\t#_process_expression2\n");
|
||||
passed = passed + 1;
|
||||
}
|
||||
}
|
||||
|
@ -148,14 +148,14 @@ void function_call(char* s, int bool)
|
|||
|
||||
if(TRUE == bool)
|
||||
{
|
||||
if(1 == Architecture)
|
||||
if(KNIGHT_POSIX == Architecture)
|
||||
{
|
||||
emit_out("LOAD R0 R15 @");
|
||||
emit_out(s);
|
||||
emit_out("MOVE R14 R13\n");
|
||||
emit_out("CALL R0 R15\n");
|
||||
}
|
||||
else if(2 == Architecture)
|
||||
else if(X86 == Architecture)
|
||||
{
|
||||
emit_out("LOAD_BASE_ADDRESS_eax %");
|
||||
emit_out(s);
|
||||
|
@ -166,14 +166,14 @@ void function_call(char* s, int bool)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(1 == Architecture)
|
||||
if(KNIGHT_POSIX == Architecture)
|
||||
{
|
||||
emit_out("MOVE R14 R13\n");
|
||||
emit_out("CALLI R15 @FUNCTION_");
|
||||
emit_out(s);
|
||||
emit_out("\n");
|
||||
}
|
||||
else if(2 == Architecture)
|
||||
else if(X86 == Architecture)
|
||||
{
|
||||
emit_out("COPY_edi_to_ebp\n");
|
||||
emit_out("CALL_IMMEDIATE %FUNCTION_");
|
||||
|
@ -184,16 +184,16 @@ void function_call(char* s, int bool)
|
|||
|
||||
for(; passed > 0; passed = passed - 1)
|
||||
{
|
||||
if(1 == Architecture) emit_out("POPR R1 R15\t# _process_expression_locals\n");
|
||||
else if(2 == Architecture) emit_out("POP_ebx\t# _process_expression_locals\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("POPR R1 R15\t# _process_expression_locals\n");
|
||||
else if(X86 == Architecture) emit_out("POP_ebx\t# _process_expression_locals\n");
|
||||
}
|
||||
|
||||
if(1 == Architecture)
|
||||
if(KNIGHT_POSIX == Architecture)
|
||||
{
|
||||
emit_out("POPR R14 R15\t# Restore old base pointer\n");
|
||||
emit_out("POPR R13 R15\t# Prevent overwrite\n");
|
||||
}
|
||||
else if(2 == Architecture)
|
||||
else if(X86 == Architecture)
|
||||
{
|
||||
emit_out("POP_ebp\t# Restore old base pointer\n");
|
||||
emit_out("POP_edi\t# Prevent overwrite\n");
|
||||
|
@ -202,8 +202,8 @@ void function_call(char* s, int bool)
|
|||
|
||||
void constant_load(struct token_list* a)
|
||||
{
|
||||
if(1 == Architecture) emit_out("LOADI R0 ");
|
||||
else if(2 == Architecture) emit_out("LOAD_IMMEDIATE_eax %");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("LOADI R0 ");
|
||||
else if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %");
|
||||
emit_out(a->arguments->s);
|
||||
emit_out("\n");
|
||||
}
|
||||
|
@ -217,16 +217,16 @@ void variable_load(struct token_list* a)
|
|||
}
|
||||
current_target = a->type;
|
||||
|
||||
if(1 == Architecture) emit_out("ADDI R0 R14 ");
|
||||
else if(2 == Architecture) emit_out("LOAD_BASE_ADDRESS_eax %");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("ADDI R0 R14 ");
|
||||
else if(X86 == Architecture) emit_out("LOAD_BASE_ADDRESS_eax %");
|
||||
|
||||
emit_out(numerate_number(a->depth));
|
||||
emit_out("\n");
|
||||
if(TRUE == Address_of) return;
|
||||
if(match("=", global_token->s)) return;
|
||||
|
||||
if(1 == Architecture) emit_out("LOAD R0 R0 0\n");
|
||||
else if(2 == Architecture) emit_out("LOAD_INTEGER\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("LOAD R0 R0 0\n");
|
||||
else if(X86 == Architecture) emit_out("LOAD_INTEGER\n");
|
||||
}
|
||||
|
||||
void function_load(struct token_list* a)
|
||||
|
@ -237,8 +237,8 @@ void function_load(struct token_list* a)
|
|||
return;
|
||||
}
|
||||
|
||||
if(1 == Architecture) emit_out("LOADUI R0 $FUNCTION_");
|
||||
else if(2 == Architecture) emit_out("LOAD_IMMEDIATE_eax &FUNCTION_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("LOADUI R0 $FUNCTION_");
|
||||
else if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax &FUNCTION_");
|
||||
emit_out(a->s);
|
||||
emit_out("\n");
|
||||
}
|
||||
|
@ -246,14 +246,14 @@ void function_load(struct token_list* a)
|
|||
void global_load(struct token_list* a)
|
||||
{
|
||||
current_target = a->type;
|
||||
if(1 == Architecture) emit_out("LOADUI R0 $GLOBAL_");
|
||||
else if(2 == Architecture) emit_out("LOAD_IMMEDIATE_eax &GLOBAL_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("LOADUI R0 $GLOBAL_");
|
||||
else if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax &GLOBAL_");
|
||||
emit_out(a->s);
|
||||
emit_out("\n");
|
||||
if(!match("=", global_token->s))
|
||||
{
|
||||
if(1 == Architecture) emit_out("LOAD R0 R0 0\n");
|
||||
else if(2 == Architecture) emit_out("LOAD_INTEGER\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("LOAD R0 R0 0\n");
|
||||
else if(X86 == Architecture) emit_out("LOAD_INTEGER\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,8 +280,8 @@ void primary_expr_string()
|
|||
{
|
||||
char* number_string = numerate_number(current_count);
|
||||
current_count = current_count + 1;
|
||||
if(1 == Architecture) emit_out("LOADUI R0 $STRING_");
|
||||
else if(2 == Architecture) emit_out("LOAD_IMMEDIATE_eax &STRING_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("LOADUI R0 $STRING_");
|
||||
else if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax &STRING_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
|
||||
/* The target */
|
||||
|
@ -295,8 +295,8 @@ void primary_expr_string()
|
|||
|
||||
void primary_expr_char()
|
||||
{
|
||||
if(1 == Architecture) emit_out("LOADI R0 ");
|
||||
else if(2 == Architecture) emit_out("LOAD_IMMEDIATE_eax %");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("LOADI R0 ");
|
||||
else if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %");
|
||||
emit_out(numerate_number(escape_lookup(global_token->s + 1)));
|
||||
emit_out("\n");
|
||||
global_token = global_token->next;
|
||||
|
@ -304,7 +304,7 @@ void primary_expr_char()
|
|||
|
||||
void primary_expr_number()
|
||||
{
|
||||
if(1 == Architecture)
|
||||
if(KNIGHT_POSIX == Architecture)
|
||||
{
|
||||
int size = numerate_string(global_token->s);
|
||||
if((32768 > size) && (size > -32768))
|
||||
|
@ -320,7 +320,7 @@ void primary_expr_number()
|
|||
emit_out("'\n");
|
||||
}
|
||||
}
|
||||
else if(2 == Architecture)
|
||||
else if(X86 == Architecture)
|
||||
{
|
||||
emit_out("LOAD_IMMEDIATE_eax %");
|
||||
emit_out(global_token->s);
|
||||
|
@ -402,14 +402,14 @@ void common_recursion(FUNCTION f)
|
|||
last_type = current_target;
|
||||
global_token = global_token->next;
|
||||
|
||||
if(1 == Architecture) emit_out("PUSHR R0 R15\t#_common_recursion\n");
|
||||
else if(2 == Architecture) emit_out("PUSH_eax\t#_common_recursion\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("PUSHR R0 R15\t#_common_recursion\n");
|
||||
else if(X86 == Architecture) emit_out("PUSH_eax\t#_common_recursion\n");
|
||||
|
||||
f();
|
||||
current_target = promote_type(current_target, last_type);
|
||||
|
||||
if(1 == Architecture) emit_out("POPR R1 R15\t# _common_recursion\n");
|
||||
else if(2 == Architecture) emit_out("POP_ebx\t# _common_recursion\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("POPR R1 R15\t# _common_recursion\n");
|
||||
else if(X86 == Architecture) emit_out("POP_ebx\t# _common_recursion\n");
|
||||
}
|
||||
|
||||
void general_recursion( FUNCTION f, char* s, char* name, FUNCTION iterate)
|
||||
|
@ -459,13 +459,13 @@ void postfix_expr_arrow()
|
|||
if(0 != i->offset)
|
||||
{
|
||||
emit_out("# -> offset calculation\n");
|
||||
if(1 == Architecture)
|
||||
if(KNIGHT_POSIX == Architecture)
|
||||
{
|
||||
emit_out("ADDUI R0 R0 ");
|
||||
emit_out(numerate_number(i->offset));
|
||||
emit_out("\n");
|
||||
}
|
||||
else if(2 == Architecture)
|
||||
else if(X86 == Architecture)
|
||||
{
|
||||
emit_out("LOAD_IMMEDIATE_ebx %");
|
||||
emit_out(numerate_number(i->offset));
|
||||
|
@ -475,8 +475,8 @@ void postfix_expr_arrow()
|
|||
|
||||
if((!match("=", global_token->s) && (4 >= i->size)))
|
||||
{
|
||||
if(1 == Architecture) emit_out("LOAD R0 R0 0\n");
|
||||
else if(2 == Architecture) emit_out("LOAD_INTEGER\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("LOAD R0 R0 0\n");
|
||||
else if(X86 == Architecture) emit_out("LOAD_INTEGER\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -486,26 +486,26 @@ void postfix_expr_array()
|
|||
common_recursion(expression);
|
||||
current_target = array;
|
||||
char* assign;
|
||||
if(1 == Architecture) assign = "LOAD R0 R0 0\n";
|
||||
else if(2 == Architecture) assign = "LOAD_INTEGER\n";
|
||||
if(KNIGHT_POSIX == Architecture) assign = "LOAD R0 R0 0\n";
|
||||
else if(X86 == Architecture) assign = "LOAD_INTEGER\n";
|
||||
|
||||
/* Add support for Ints */
|
||||
if(match("char*", current_target->name))
|
||||
{
|
||||
if(1 == Architecture) assign = "LOAD8 R0 R0 0\n";
|
||||
else if(2 == Architecture) assign = "LOAD_BYTE\n";
|
||||
if(KNIGHT_POSIX == Architecture) assign = "LOAD8 R0 R0 0\n";
|
||||
else if(X86 == Architecture) assign = "LOAD_BYTE\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(1 == Architecture) emit_out("SALI R0 ");
|
||||
else if(2 == Architecture) emit_out("SAL_eax_Immediate8 !");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("SALI R0 ");
|
||||
else if(X86 == Architecture) emit_out("SAL_eax_Immediate8 !");
|
||||
|
||||
emit_out(numerate_number(ceil_log2(current_target->indirect->size)));
|
||||
emit_out("\n");
|
||||
}
|
||||
|
||||
if(1 == Architecture) emit_out("ADD R0 R0 R1\n");
|
||||
else if(2 == Architecture) emit_out("ADD_ebx_to_eax\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("ADD R0 R0 R1\n");
|
||||
else if(X86 == Architecture) emit_out("ADD_ebx_to_eax\n");
|
||||
|
||||
require_match("ERROR in postfix_expr\nMissing ]\n", "]");
|
||||
|
||||
|
@ -532,8 +532,8 @@ void unary_expr_sizeof()
|
|||
struct type* a = type_name();
|
||||
require_match("ERROR in unary_expr\nMissing )\n", ")");
|
||||
|
||||
if(1 == Architecture) emit_out("LOADUI R0 ");
|
||||
else if(2 == Architecture) emit_out("LOAD_IMMEDIATE_eax %");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("LOADUI R0 ");
|
||||
else if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %");
|
||||
emit_out(numerate_number(a->size));
|
||||
emit_out("\n");
|
||||
}
|
||||
|
@ -572,7 +572,7 @@ void postfix_expr()
|
|||
*/
|
||||
void additive_expr_stub()
|
||||
{
|
||||
if(1 == Architecture)
|
||||
if(KNIGHT_POSIX == Architecture)
|
||||
{
|
||||
general_recursion(postfix_expr, "ADD R0 R0 R1\n", "+", additive_expr_stub);
|
||||
general_recursion(postfix_expr, "SUB R0 R1 R0\n", "-", additive_expr_stub);
|
||||
|
@ -582,7 +582,7 @@ void additive_expr_stub()
|
|||
general_recursion(postfix_expr, "SAL R0 R1 R0\n", "<<", additive_expr_stub);
|
||||
general_recursion(postfix_expr, "SAR R0 R1 R0\n", ">>", additive_expr_stub);
|
||||
}
|
||||
else if(2 == Architecture)
|
||||
else if(X86 == Architecture)
|
||||
{
|
||||
general_recursion(postfix_expr, "ADD_ebx_to_eax\n", "+", additive_expr_stub);
|
||||
general_recursion(postfix_expr, "SUBTRACT_eax_from_ebx_into_ebx\nMOVE_ebx_to_eax\n", "-", additive_expr_stub);
|
||||
|
@ -613,7 +613,7 @@ void additive_expr()
|
|||
|
||||
void relational_expr_stub()
|
||||
{
|
||||
if(1 == Architecture)
|
||||
if(KNIGHT_POSIX == Architecture)
|
||||
{
|
||||
general_recursion(additive_expr, "CMPSKIP.GE R1 R0\nLOADUI R2 1\nMOVE R0 R2\n", "<", relational_expr_stub);
|
||||
general_recursion(additive_expr, "CMPSKIP.G R1 R0\nLOADUI R2 1\nMOVE R0 R2\n", "<=", relational_expr_stub);
|
||||
|
@ -622,7 +622,7 @@ void relational_expr_stub()
|
|||
general_recursion(additive_expr, "CMPSKIP.NE R1 R0\nLOADUI R2 1\nMOVE R0 R2\n", "==", relational_expr_stub);
|
||||
general_recursion(additive_expr, "CMPSKIP.E R1 R0\nLOADUI R2 1\nMOVE R0 R2\n", "!=", relational_expr_stub);
|
||||
}
|
||||
else if(2 == Architecture)
|
||||
else if(X86 == Architecture)
|
||||
{
|
||||
general_recursion(additive_expr, "CMP\nSETL\nMOVEZBL\n", "<", relational_expr_stub);
|
||||
general_recursion(additive_expr, "CMP\nSETLE\nMOVEZBL\n", "<=", relational_expr_stub);
|
||||
|
@ -650,7 +650,7 @@ void relational_expr()
|
|||
*/
|
||||
void bitwise_expr_stub()
|
||||
{
|
||||
if(1 == Architecture)
|
||||
if(KNIGHT_POSIX == Architecture)
|
||||
{
|
||||
general_recursion(relational_expr, "AND R0 R0 R1\n", "&", bitwise_expr_stub);
|
||||
general_recursion(relational_expr, "AND R0 R0 R1\n", "&&", bitwise_expr_stub);
|
||||
|
@ -658,7 +658,7 @@ void bitwise_expr_stub()
|
|||
general_recursion(relational_expr, "OR R0 R0 R1\n", "||", bitwise_expr_stub);
|
||||
general_recursion(relational_expr, "XOR R0 R0 R1\n", "^", bitwise_expr_stub);
|
||||
}
|
||||
else if(2 == Architecture)
|
||||
else if(X86 == Architecture)
|
||||
{
|
||||
general_recursion(relational_expr, "AND_eax_ebx\n", "&", bitwise_expr_stub);
|
||||
general_recursion(relational_expr, "AND_eax_ebx\n", "&&", bitwise_expr_stub);
|
||||
|
@ -696,28 +696,28 @@ void primary_expr()
|
|||
if(match("sizeof", global_token->s)) unary_expr_sizeof();
|
||||
else if('-' == global_token->s[0])
|
||||
{
|
||||
if(2 == Architecture) emit_out("LOAD_IMMEDIATE_eax %0\n");
|
||||
if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %0\n");
|
||||
|
||||
common_recursion(primary_expr);
|
||||
|
||||
if(1 == Architecture) emit_out("NEG R0 R0\n");
|
||||
else if(2 == Architecture) emit_out("SUBTRACT_eax_from_ebx_into_ebx\nMOVE_ebx_to_eax\n");
|
||||
if(KNIGHT_POSIX == 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('!' == global_token->s[0])
|
||||
{
|
||||
if(2 == Architecture) emit_out("LOAD_IMMEDIATE_eax %1\n");
|
||||
if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %1\n");
|
||||
|
||||
common_recursion(postfix_expr);
|
||||
|
||||
if(1 == Architecture) emit_out("XORI R0 R0 1\n");
|
||||
else if(2 == Architecture) emit_out("XOR_ebx_eax_into_eax\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("XORI R0 R0 1\n");
|
||||
else if(X86 == Architecture) emit_out("XOR_ebx_eax_into_eax\n");
|
||||
}
|
||||
else if('~' == global_token->s[0])
|
||||
{
|
||||
common_recursion(postfix_expr);
|
||||
|
||||
if(1 == Architecture) emit_out("NOT R0 R0\n");
|
||||
else if(2 == Architecture) emit_out("NOT_eax\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("NOT R0 R0\n");
|
||||
else if(X86 == Architecture) emit_out("NOT_eax\n");
|
||||
}
|
||||
else if(global_token->s[0] == '(')
|
||||
{
|
||||
|
@ -740,13 +740,13 @@ void expression()
|
|||
char* store = "";
|
||||
if(!match("]", global_token->prev->s) || !match("char*", current_target->name))
|
||||
{
|
||||
if(1 == Architecture) store = "STORE R0 R1 0\n";
|
||||
else if(2 == Architecture) store = "STORE_INTEGER\n";
|
||||
if(KNIGHT_POSIX == Architecture) store = "STORE R0 R1 0\n";
|
||||
else if(X86 == Architecture) store = "STORE_INTEGER\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(1 == Architecture) store = "STORE8 R0 R1 0\n";
|
||||
else if(2 == Architecture) store = "STORE_CHAR\n";
|
||||
if(KNIGHT_POSIX == Architecture) store = "STORE8 R0 R1 0\n";
|
||||
else if(X86 == Architecture) store = "STORE_CHAR\n";
|
||||
}
|
||||
|
||||
common_recursion(expression);
|
||||
|
@ -763,23 +763,23 @@ 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(1 == Architecture) a->depth = 4;
|
||||
else if(2 == Architecture) a->depth = -20;
|
||||
if(KNIGHT_POSIX == Architecture) a->depth = 20;
|
||||
else if(X86 == Architecture) a->depth = -20;
|
||||
}
|
||||
else if((NULL == function->arguments) && (NULL == function->locals))
|
||||
{
|
||||
if(1 == Architecture) a->depth = 4;
|
||||
else if(2 == Architecture) a->depth = -8;
|
||||
if(KNIGHT_POSIX == Architecture) a->depth = 4;
|
||||
else if(X86 == Architecture) a->depth = -8;
|
||||
}
|
||||
else if(NULL == function->locals)
|
||||
{
|
||||
if(1 == Architecture) a->depth = function->arguments->depth + 8;
|
||||
else if(2 == Architecture) a->depth = function->arguments->depth - 8;
|
||||
if(KNIGHT_POSIX == Architecture) a->depth = function->arguments->depth + 8;
|
||||
else if(X86 == Architecture) a->depth = function->arguments->depth - 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(1 == Architecture) a->depth = function->locals->depth + 4;
|
||||
else if(2 == Architecture) a->depth = function->locals->depth - 4;
|
||||
if(KNIGHT_POSIX == Architecture) a->depth = function->locals->depth + 4;
|
||||
else if(X86 == Architecture) a->depth = function->locals->depth - 4;
|
||||
}
|
||||
|
||||
function->locals = a;
|
||||
|
@ -798,8 +798,8 @@ void collect_local()
|
|||
|
||||
require_match("ERROR in collect_local\nMissing ;\n", ";");
|
||||
|
||||
if(1 == Architecture) emit_out("PUSHR R0 R15\t#");
|
||||
else if(2 == Architecture) emit_out("PUSH_eax\t#");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("PUSHR R0 R15\t#");
|
||||
else if(X86 == Architecture) emit_out("PUSH_eax\t#");
|
||||
emit_out(a->s);
|
||||
emit_out("\n");
|
||||
}
|
||||
|
@ -819,16 +819,16 @@ void process_if()
|
|||
require_match("ERROR in process_if\nMISSING (\n", "(");
|
||||
expression();
|
||||
|
||||
if(1 == Architecture) emit_out("JUMP.Z R0 @ELSE_");
|
||||
else if(2 == Architecture) emit_out("TEST\nJUMP_EQ %ELSE_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP.Z R0 @ELSE_");
|
||||
else if(X86 == Architecture) emit_out("TEST\nJUMP_EQ %ELSE_");
|
||||
|
||||
uniqueID_out(function->s, number_string);
|
||||
|
||||
require_match("ERROR in process_if\nMISSING )\n", ")");
|
||||
statement();
|
||||
|
||||
if(1 == Architecture) emit_out("JUMP @_END_IF_");
|
||||
else if(2 == Architecture) emit_out("JUMP %_END_IF_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP @_END_IF_");
|
||||
else if(X86 == Architecture) emit_out("JUMP %_END_IF_");
|
||||
|
||||
uniqueID_out(function->s, number_string);
|
||||
emit_out(":ELSE_");
|
||||
|
@ -875,11 +875,11 @@ void process_for()
|
|||
require_match("ERROR in process_for\nMISSING ;1\n", ";");
|
||||
expression();
|
||||
|
||||
if(1 == Architecture) emit_out("JUMP.Z R0 @FOR_END_");
|
||||
else if(2 == Architecture) emit_out("TEST\nJUMP_EQ %FOR_END_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP.Z R0 @FOR_END_");
|
||||
else if(X86 == Architecture) emit_out("TEST\nJUMP_EQ %FOR_END_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
if(1 == Architecture) emit_out("JUMP @FOR_THEN_");
|
||||
else if(2 == Architecture) emit_out("JUMP %FOR_THEN_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP @FOR_THEN_");
|
||||
else if(X86 == Architecture) emit_out("JUMP %FOR_THEN_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
emit_out(":FOR_ITER_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
|
@ -887,8 +887,8 @@ void process_for()
|
|||
require_match("ERROR in process_for\nMISSING ;2\n", ";");
|
||||
expression();
|
||||
|
||||
if(1 == Architecture) emit_out("JUMP @FOR_");
|
||||
else if(2 == Architecture) emit_out("JUMP %FOR_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP @FOR_");
|
||||
else if(X86 == Architecture) emit_out("JUMP %FOR_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
emit_out(":FOR_THEN_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
|
@ -896,8 +896,8 @@ void process_for()
|
|||
require_match("ERROR in process_for\nMISSING )\n", ")");
|
||||
statement();
|
||||
|
||||
if(1 == Architecture) emit_out("JUMP @FOR_ITER_");
|
||||
else if(2 == Architecture) emit_out("JUMP %FOR_ITER_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP @FOR_ITER_");
|
||||
else if(X86 == Architecture) emit_out("JUMP %FOR_ITER_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
emit_out(":FOR_END_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
|
@ -951,8 +951,8 @@ void process_do()
|
|||
require_match("ERROR in process_do\nMISSING )\n", ")");
|
||||
require_match("ERROR in process_do\nMISSING ;\n", ";");
|
||||
|
||||
if(1 == Architecture) emit_out("JUMP.NZ R0 @DO_");
|
||||
else if(2 == Architecture) emit_out("TEST\nJUMP_NE %DO_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP.NZ R0 @DO_");
|
||||
else if(X86 == Architecture) emit_out("TEST\nJUMP_NE %DO_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
emit_out(":DO_END_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
|
@ -987,8 +987,8 @@ void process_while()
|
|||
require_match("ERROR in process_while\nMISSING (\n", "(");
|
||||
expression();
|
||||
|
||||
if(1 == Architecture) emit_out("JUMP.Z R0 @END_WHILE_");
|
||||
else if(2 == Architecture) emit_out("TEST\nJUMP_EQ %END_WHILE_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP.Z R0 @END_WHILE_");
|
||||
else if(X86 == Architecture) emit_out("TEST\nJUMP_EQ %END_WHILE_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
emit_out("# THEN_while_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
|
@ -996,8 +996,8 @@ void process_while()
|
|||
require_match("ERROR in process_while\nMISSING )\n", ")");
|
||||
statement();
|
||||
|
||||
if(1 == Architecture) emit_out("JUMP @WHILE_");
|
||||
else if(2 == Architecture) emit_out("JUMP %WHILE_");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP @WHILE_");
|
||||
else if(X86 == Architecture) emit_out("JUMP %WHILE_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
emit_out(":END_WHILE_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
|
@ -1019,12 +1019,12 @@ void return_result()
|
|||
struct token_list* i;
|
||||
for(i = function->locals; NULL != i; i = i->next)
|
||||
{
|
||||
if(1 == Architecture) emit_out("POPR R1 R15\t# _return_result_locals\n");
|
||||
else if(2 == Architecture) emit_out("POP_ebx\t# _return_result_locals\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("POPR R1 R15\t# _return_result_locals\n");
|
||||
else if(X86 == Architecture) emit_out("POP_ebx\t# _return_result_locals\n");
|
||||
}
|
||||
|
||||
if(1 == Architecture) emit_out("RET R15\n");
|
||||
else if(2 == Architecture) emit_out("RETURN\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("RET R15\n");
|
||||
else if(X86 == Architecture) emit_out("RETURN\n");
|
||||
}
|
||||
|
||||
void process_break()
|
||||
|
@ -1039,14 +1039,14 @@ void process_break()
|
|||
while(i != break_frame)
|
||||
{
|
||||
if(NULL == i) break;
|
||||
if(1 == Architecture) emit_out("POPR R1 R15\t# break_cleanup_locals\n");
|
||||
else if(2 == Architecture) emit_out("POP_ebx\t# break_cleanup_locals\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("POPR R1 R15\t# break_cleanup_locals\n");
|
||||
else if(X86 == Architecture) emit_out("POP_ebx\t# break_cleanup_locals\n");
|
||||
i = i->next;
|
||||
}
|
||||
global_token = global_token->next;
|
||||
|
||||
if(1 == Architecture) emit_out("JUMP @");
|
||||
else if(2 == Architecture) emit_out("JUMP %");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP @");
|
||||
else if(X86 == Architecture) emit_out("JUMP %");
|
||||
|
||||
emit_out(break_target_head);
|
||||
emit_out(break_target_func);
|
||||
|
@ -1069,13 +1069,13 @@ void recursive_statement()
|
|||
|
||||
/* Clean up any locals added */
|
||||
|
||||
if(((2 == Architecture) && !match("RETURN\n", out->s)) || ((1 == Architecture) && !match("RET R15\n", out->s)))
|
||||
if(((X86 == Architecture) && !match("RETURN\n", out->s)) || ((KNIGHT_POSIX == Architecture) && !match("RET R15\n", out->s)))
|
||||
{
|
||||
struct token_list* i;
|
||||
for(i = function->locals; frame != i; i = i->next)
|
||||
{
|
||||
if(1 == Architecture) emit_out("POPR R1 R15\t# _recursive_statement_locals\n");
|
||||
else if(2 == Architecture) emit_out( "POP_ebx\t# _recursive_statement_locals\n");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("POPR R1 R15\t# _recursive_statement_locals\n");
|
||||
else if(X86 == Architecture) emit_out( "POP_ebx\t# _recursive_statement_locals\n");
|
||||
}
|
||||
}
|
||||
function->locals = frame;
|
||||
|
@ -1140,8 +1140,8 @@ void statement()
|
|||
else if(match("goto", global_token->s))
|
||||
{
|
||||
global_token = global_token->next;
|
||||
if(1 == Architecture) emit_out("JUMP @");
|
||||
else if(2 == Architecture) emit_out("JUMP %");
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("JUMP @");
|
||||
else if(X86 == Architecture) emit_out("JUMP %");
|
||||
emit_out(global_token->s);
|
||||
emit_out("\n");
|
||||
global_token = global_token->next;
|
||||
|
@ -1187,13 +1187,13 @@ void collect_arguments()
|
|||
struct token_list* a = sym_declare(global_token->s, type_size, function->arguments);
|
||||
if(NULL == function->arguments)
|
||||
{
|
||||
if(1 == Architecture) a->depth = 0;
|
||||
else if(2 == Architecture) a->depth = -4;
|
||||
if(KNIGHT_POSIX == Architecture) a->depth = 0;
|
||||
else if(X86 == Architecture) a->depth = -4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(1 == Architecture) a->depth = function->arguments->depth + 4;
|
||||
else if(2 == Architecture) a->depth = function->arguments->depth - 4;
|
||||
if(KNIGHT_POSIX == Architecture) a->depth = function->arguments->depth + 4;
|
||||
else if(X86 == Architecture) a->depth = function->arguments->depth - 4;
|
||||
}
|
||||
|
||||
global_token = global_token->next;
|
||||
|
@ -1228,8 +1228,8 @@ void declare_function()
|
|||
statement();
|
||||
|
||||
/* Prevent duplicate RETURNS */
|
||||
if((1 == Architecture) && !match("RET R15\n", out->s)) emit_out("RET R15\n");
|
||||
else if((2 == Architecture) && !match("RETURN\n", out->s)) emit_out("RETURN\n");
|
||||
if((KNIGHT_POSIX == Architecture) && !match("RET R15\n", out->s)) emit_out("RET R15\n");
|
||||
else if((X86 == Architecture) && !match("RETURN\n", out->s)) emit_out("RETURN\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
40
makefile
40
makefile
|
@ -73,6 +73,10 @@ test: test00-knight-posix-binary \
|
|||
test08-knight-posix-binary \
|
||||
test09-knight-posix-binary \
|
||||
test10-knight-posix-binary \
|
||||
test11-knight-posix-binary \
|
||||
test12-knight-posix-binary \
|
||||
test13-knight-posix-binary \
|
||||
test14-knight-posix-binary \
|
||||
test00-x86-binary \
|
||||
test01-x86-binary \
|
||||
test02-x86-binary \
|
||||
|
@ -84,10 +88,10 @@ test: test00-knight-posix-binary \
|
|||
test08-x86-binary \
|
||||
test09-x86-binary \
|
||||
test10-x86-binary \
|
||||
test11-binary \
|
||||
test12-binary \
|
||||
test13-binary \
|
||||
test14-binary \
|
||||
test11-x86-binary \
|
||||
test12-x86-binary \
|
||||
test13-x86-binary \
|
||||
test14-x86-binary \
|
||||
test15-binary \
|
||||
test16-binary \
|
||||
test17-binary \
|
||||
|
@ -135,6 +139,18 @@ test09-knight-posix-binary: M2-Planet | results
|
|||
test10-knight-posix-binary: M2-Planet | results
|
||||
test/test10/hello-knight-posix.sh
|
||||
|
||||
test11-knight-posix-binary: M2-Planet | results
|
||||
test/test11/hello-knight-posix.sh
|
||||
|
||||
test12-knight-posix-binary: M2-Planet | results
|
||||
test/test12/hello-knight-posix.sh
|
||||
|
||||
test13-knight-posix-binary: M2-Planet | results
|
||||
test/test13/hello-knight-posix.sh
|
||||
|
||||
test14-knight-posix-binary: M2-Planet | results
|
||||
test/test14/hello-knight-posix.sh
|
||||
|
||||
test00-x86-binary: M2-Planet | results
|
||||
test/test00/hello-x86.sh
|
||||
|
||||
|
@ -168,17 +184,17 @@ test09-x86-binary: M2-Planet | results
|
|||
test10-x86-binary: M2-Planet | results
|
||||
test/test10/hello-x86.sh
|
||||
|
||||
test11-binary: M2-Planet | results
|
||||
test/test11/hello.sh
|
||||
test11-x86-binary: M2-Planet | results
|
||||
test/test11/hello-x86.sh
|
||||
|
||||
test12-binary: M2-Planet | results
|
||||
test/test12/hello.sh
|
||||
test12-x86-binary: M2-Planet | results
|
||||
test/test12/hello-x86.sh
|
||||
|
||||
test13-binary: M2-Planet | results
|
||||
test/test13/hello.sh
|
||||
test13-x86-binary: M2-Planet | results
|
||||
test/test13/hello-x86.sh
|
||||
|
||||
test14-binary: M2-Planet | results
|
||||
test/test14/hello.sh
|
||||
test14-x86-binary: M2-Planet | results
|
||||
test/test14/hello-x86.sh
|
||||
|
||||
test15-binary: M2-Planet | results
|
||||
test/test15/hello.sh
|
||||
|
|
|
@ -16,8 +16,12 @@
|
|||
|
||||
:_start
|
||||
LOADR32 R12 @HEAP ; Setup HEAP pointer
|
||||
LOADUI R15 $ELF_end ; Setup Stack pointer
|
||||
COPY R14 R15 ; Protect esp
|
||||
;; Kernel Setup R15 as Stack pointer after the initial stack frame
|
||||
|
||||
;; Default stack frame is:
|
||||
;; ARGC, ARGV, ENVP, NULL
|
||||
|
||||
SUBI R14 R15 16 ; Set our base pointer
|
||||
|
||||
;; Perform the main loop
|
||||
CALLI R15 @FUNCTION_main
|
||||
|
|
|
@ -1,30 +1,34 @@
|
|||
9386b893f5d31a130103618131b4bf89c40d8c8aa99d216bd30cc7dc62deeb47 test/results/test00-knight-posix-binary
|
||||
9852ca1e2f800d638fdf89b575f52660c6ced5f49b720cc6fc7c70707c39d2f1 test/results/test00-knight-posix-binary
|
||||
c52562bd0aabb86ce8ca177f22f8d0455769b444df2d4d62894faab63b7151d8 test/results/test00-x86-binary
|
||||
97d784284844e01d28beb37c0d04a97b3f1b2835c7b7e0b169e1a6e78d6c6c9a test/results/test01-knight-posix-binary
|
||||
928eef8ec4892cfd602efbe5509f93e2b787edf868320d0e67d6843566993321 test/results/test01-knight-posix-binary
|
||||
eae96857f2b6d8e8ba86ac06e72345ea572622b358b23978bb5f2db1baadf41c test/results/test01-x86-binary
|
||||
0add4a5a2e1a2a1e3806f72523f682364c7c65f5c1efbdf1f11af916b6afc5a0 test/results/test02-knight-posix-binary
|
||||
cbeb10391dbb9f4db172b529bc8daf0daf089f405ebbee3e5a6ec9e515cfdf75 test/results/test02-knight-posix-binary
|
||||
8ead336d2f3f72d5874230492e0472edec61d355905e8636e3dfb2731695037c test/results/test02-x86-binary
|
||||
d29f0a2580efa4c47b47a7ff24d5295920ac0d410cd9480639072b6635c585e9 test/results/test03-knight-posix-binary
|
||||
2f26b4307604ab214b197ae2270d102a918bb92805d8d5ed8e2a506990503784 test/results/test03-knight-posix-binary
|
||||
2313cb3f1a2b9eb6bf15f8d43418e15d6c16f7f1b5c22700fdfc2b38beb59192 test/results/test03-x86-binary
|
||||
2831709595712268889e1737ec7728cf29385567b736a3dcc35fb7b97773b79f test/results/test04-knight-posix-binary
|
||||
614941257943816b34bb13c6798fb2c3fcc253f1f6a4204282d1c1694cfeebc3 test/results/test04-knight-posix-binary
|
||||
b7ddb37063c541c6a315809c4438aa235d6702f54bb64f4ffc88dbe78617de81 test/results/test04-x86-binary
|
||||
78921a43d41d6c62cab2552d3f13f353a9fd5beee5be702417e47a15d95e169d test/results/test05-knight-posix-binary
|
||||
4ee5729158a7c3682605696f4aa59c2ac373c8bd8fec113da06eb499471c9141 test/results/test05-knight-posix-binary
|
||||
b5b76320ccda887a30b0bbefc2a5c302c8f2aa3c398d92ef3a79526690b25d6f test/results/test05-x86-binary
|
||||
3f415979cca69519a8298535380ec707f9cbdc2f2635df1e3abc8bc492b6203d test/results/test06-knight-posix-binary
|
||||
06317267e6f6eb9d6214406d6ece5e8df965c3c3f523d939027099cff275c0f1 test/results/test06-knight-posix-binary
|
||||
663fc6eefe965f237b6bf5a211398c8ae1210f97ff39b59603677e92462c68c7 test/results/test06-x86-binary
|
||||
3befa4e52965fb52186379c36fc6f6d897902dd4427e7f6ba2cc4e99cc969c49 test/results/test07-knight-posix-binary
|
||||
bd0e8878f0a12755d50ae1f9dba169cf49a07ff3d3cff0f5dfc36044dfd1e7db test/results/test07-knight-posix-binary
|
||||
a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/test07-x86-binary
|
||||
08bc1fb86c1df73b21e0b68e76572a33477f8943abdd16433d00ef231195bd22 test/results/test08-knight-posix-binary
|
||||
5c5667ef92a7b02b3516b029921ac000d4769a8a112f128b96099b7bbe869bab test/results/test08-knight-posix-binary
|
||||
f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/test08-x86-binary
|
||||
ae993dd3c49b61f8d7d2b3dcf1d182adbf552135491fd903a371ad9122eb0697 test/results/test09-knight-posix-binary
|
||||
84a650501212aef7c01d35ccfbab668f7fe35a1ae834b2c874be6eb3ae1fb973 test/results/test09-knight-posix-binary
|
||||
3b39e72f3de90ed690adfaf6145af46157cef2ec5e72867ac577fa27a0229894 test/results/test09-x86-binary
|
||||
bdea362acff602d855c8298456b59bac78480a5e78af4476646262537175a3f6 test/results/test10-knight-posix-binary
|
||||
24f11239bf55776eddf7116a5fe48e7ff8df3cbdf24e4d8dfd7d46d940df7b96 test/results/test10-knight-posix-binary
|
||||
020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-x86-binary
|
||||
9a0edc49d1078ffc7ed2578e50198e9e7695c2f26151a3d6e76bab7f2db6872c test/results/test100-binary
|
||||
3fd11bad4a426ce1ff8fd9c6d7d2b943effae9f3f5740b7376e426e9b0555851 test/results/test11-binary
|
||||
f98ab8e4bb35580e0dde96126d7a56aff66bda208d02c8d89390b40d6cff591c test/results/test12-binary
|
||||
5051ffca2615144419f8ec1a5d4999486ae81e7781428f59e47e866af97cef92 test/results/test13-binary
|
||||
a8218958b628066e2fda63d3933f1bf607c358d7bdfe84fc02596393698ea5f6 test/results/test14-binary
|
||||
c50892d9f292bed448ef560b1f8859fb6ee866e03ea46cf9a2c7d8e9b0cc8407 test/results/test100-binary
|
||||
28653927f7d2929a2168b88ad681b7ad0fb4e68422a097ceaaa5406e2bf500d5 test/results/test11-knight-posix-binary
|
||||
3fd11bad4a426ce1ff8fd9c6d7d2b943effae9f3f5740b7376e426e9b0555851 test/results/test11-x86-binary
|
||||
8b522a97c51f816e69939b9a1e0c4572a834e5b616bf92acb21c804887c95b31 test/results/test12-knight-posix-binary
|
||||
f98ab8e4bb35580e0dde96126d7a56aff66bda208d02c8d89390b40d6cff591c test/results/test12-x86-binary
|
||||
552e4f59224318c5d7b4b790f397c83e20e666af097f01dc32bcb241377242a9 test/results/test13-knight-posix-binary
|
||||
5051ffca2615144419f8ec1a5d4999486ae81e7781428f59e47e866af97cef92 test/results/test13-x86-binary
|
||||
4e3b3c645466cd90bafcb1bfddc2bb0b5c7466fc01b3a3a37bd0453567d444af test/results/test14-knight-posix-binary
|
||||
a8218958b628066e2fda63d3933f1bf607c358d7bdfe84fc02596393698ea5f6 test/results/test14-x86-binary
|
||||
3adb4a5f3995583ba711151361728a26c3fbf0140864d13b4b042978ca45d683 test/results/test15-binary
|
||||
d70e072f4f1f077d10ff65e9216ca8b423b996e35d68d208025db7a78b062f50 test/results/test16-binary
|
||||
9b4ba350b07cc1cf4e12dc77d0d960ded1511f13b887363b0eb33421e2f626de test/results/test17-binary
|
||||
|
|
|
@ -1 +1 @@
|
|||
956e610f595e53333bd961775a8f10fc9529e8a1dfb330886014a77c90914555 test/test100/proof
|
||||
22a36afd9af84a5b94c48d700c30a664db3fc4fdff6c07ec150b86afd6993d51 test/test100/proof
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -ex
|
||||
# Build the test
|
||||
bin/M2-Planet --architecture knight-posix -f test/common_knight/functions/putchar.c \
|
||||
-f test/common_knight/functions/exit.c \
|
||||
-f test/test11/break-do.c \
|
||||
-o test/test11/break-do.M1 || exit 1
|
||||
|
||||
# Macro assemble with libc written in M1-Macro
|
||||
M1 -f test/common_knight/knight_defs.M1 \
|
||||
-f test/common_knight/libc-core.M1 \
|
||||
-f test/test11/break-do.M1 \
|
||||
--BigEndian \
|
||||
--architecture knight-posix \
|
||||
-o test/test11/break-do.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test11/break-do.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test11-knight-posix-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
||||
then
|
||||
# Verify that the resulting file works
|
||||
./test/results/test11-knight-posix-binary >| test/test11/proof || exit 4
|
||||
out=$(sha256sum -c test/test11/proof.answer)
|
||||
[ "$out" = "test/test11/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -31,13 +31,13 @@ M1 -f test/common_x86/x86_defs.M1 \
|
|||
-o test/test11/break-do.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test11/break-do.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test11-binary --exec_enable || exit 3
|
||||
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test11/break-do.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test11-x86-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
|
||||
then
|
||||
# Verify that the resulting file works
|
||||
./test/results/test11-binary >| test/test11/proof || exit 4
|
||||
./test/results/test11-x86-binary >| test/test11/proof || exit 4
|
||||
out=$(sha256sum -c test/test11/proof.answer)
|
||||
[ "$out" = "test/test11/proof: OK" ] || exit 5
|
||||
fi
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -ex
|
||||
# Build the test
|
||||
bin/M2-Planet --architecture knight-posix -f test/common_knight/functions/putchar.c \
|
||||
-f test/common_knight/functions/exit.c \
|
||||
-f test/test12/break-for.c \
|
||||
-o test/test12/break-for.M1 || exit 1
|
||||
|
||||
# Macro assemble with libc written in M1-Macro
|
||||
M1 -f test/common_knight/knight_defs.M1 \
|
||||
-f test/common_knight/libc-core.M1 \
|
||||
-f test/test12/break-for.M1 \
|
||||
--BigEndian \
|
||||
--architecture knight-posix \
|
||||
-o test/test12/break-for.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test12/break-for.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test12-knight-posix-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
||||
then
|
||||
# Verify that the resulting file works
|
||||
./test/results/test12-knight-posix-binary >| test/test12/proof || exit 4
|
||||
out=$(sha256sum -c test/test12/proof.answer)
|
||||
[ "$out" = "test/test12/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -31,13 +31,13 @@ M1 -f test/common_x86/x86_defs.M1 \
|
|||
-o test/test12/break-for.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test12/break-for.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test12-binary --exec_enable || exit 3
|
||||
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test12/break-for.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test12-x86-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
|
||||
then
|
||||
# Verify that the resulting file works
|
||||
./test/results/test12-binary >| test/test12/proof || exit 4
|
||||
./test/results/test12-x86-binary >| test/test12/proof || exit 4
|
||||
out=$(sha256sum -c test/test12/proof.answer)
|
||||
[ "$out" = "test/test12/proof: OK" ] || exit 5
|
||||
fi
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -ex
|
||||
# Build the test
|
||||
bin/M2-Planet --architecture knight-posix -f test/common_knight/functions/putchar.c \
|
||||
-f test/common_knight/functions/exit.c \
|
||||
-f test/test13/break-while.c \
|
||||
-o test/test13/break-while.M1 || exit 1
|
||||
|
||||
# Macro assemble with libc written in M1-Macro
|
||||
M1 -f test/common_knight/knight_defs.M1 \
|
||||
-f test/common_knight/libc-core.M1 \
|
||||
-f test/test13/break-while.M1 \
|
||||
--BigEndian \
|
||||
--architecture knight-posix \
|
||||
-o test/test13/break-while.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test13/break-while.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test13-knight-posix-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
||||
then
|
||||
# Verify that the resulting file works
|
||||
./test/results/test13-kight-posix-binary >| test/test13/proof || exit 4
|
||||
out=$(sha256sum -c test/test13/proof.answer)
|
||||
[ "$out" = "test/test13/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -31,13 +31,13 @@ M1 -f test/common_x86/x86_defs.M1 \
|
|||
-o test/test13/break-while.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test13/break-while.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test13-binary --exec_enable || exit 3
|
||||
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test13/break-while.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test13-x86-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
|
||||
then
|
||||
# Verify that the resulting file works
|
||||
./test/results/test13-binary >| test/test13/proof || exit 4
|
||||
./test/results/test13-x86-binary >| test/test13/proof || exit 4
|
||||
out=$(sha256sum -c test/test13/proof.answer)
|
||||
[ "$out" = "test/test13/proof: OK" ] || exit 5
|
||||
fi
|
|
@ -0,0 +1,43 @@
|
|||
#! /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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -ex
|
||||
# Build the test
|
||||
bin/M2-Planet --architecture knight-posix -f test/common_knight/functions/putchar.c \
|
||||
-f test/test14/basic_args.c \
|
||||
-o test/test14/basic_args.M1 || exit 1
|
||||
|
||||
# Macro assemble with libc written in M1-Macro
|
||||
M1 -f test/common_knight/knight_defs.M1 \
|
||||
-f test/common_knight/libc-core.M1 \
|
||||
-f test/test14/basic_args.M1 \
|
||||
--BigEndian \
|
||||
--architecture knight-posix \
|
||||
-o test/test14/basic_args.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test14/basic_args.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test14-knight-posix-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
||||
then
|
||||
# Verify that the resulting file works
|
||||
./test/results/test14-knight-posix-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test14/proof || exit 4
|
||||
out=$(sha256sum -c test/test14/proof-knight-posix.answer)
|
||||
[ "$out" = "test/test14/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -30,14 +30,14 @@ M1 -f test/common_x86/x86_defs.M1 \
|
|||
-o test/test14/basic_args.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test14/basic_args.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test14-binary --exec_enable || exit 3
|
||||
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test14/basic_args.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test14-x86-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
|
||||
then
|
||||
# Verify that the resulting file works
|
||||
./test/results/test14-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test14/proof || exit 4
|
||||
out=$(sha256sum -c test/test14/proof.answer)
|
||||
./test/results/test14-x86-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test14/proof || exit 4
|
||||
out=$(sha256sum -c test/test14/proof-x86.answer)
|
||||
[ "$out" = "test/test14/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1 @@
|
|||
03353728d558b1fa70bb76788667b88e7ca433e075c3e8ccf3f33ec0579ff5cd test/test14/proof
|
|
@ -0,0 +1 @@
|
|||
ceb2ca67c604d2284ae5fee3381b1cb2de5f3096acdf6689130145ae65df6895 test/test14/proof
|
|
@ -1 +0,0 @@
|
|||
036eed868520c4eb4ebd1c2cfcce3f5fed6618184f151cd26b4e95234ff73115 test/test14/proof
|
Loading…
Reference in New Issue