Release_1.3.0
This commit is contained in:
parent
06a29d2132
commit
27cf071ee9
|
@ -17,17 +17,21 @@
|
|||
* Current
|
||||
** Added
|
||||
Added port to Knight-Native
|
||||
Ported 4/24 working tests for AMD64
|
||||
Ported 24/24 working tests for AMD64
|
||||
Added support for CONSTANT to leverage sizeof(type)
|
||||
|
||||
** Changed
|
||||
Added basic verification of the compiled program (kaem) to test25
|
||||
Added basic verification of the compiled program (Slow_Lisp) to test26
|
||||
Updated from mescc-tools from 0.6.0 to 0.6.1 (To gain support for --64)
|
||||
Changed test26 to adust behavior according to struct size
|
||||
|
||||
** Fixed
|
||||
Corrected Global char* to behave correctly when given a static string
|
||||
Ensured pointers match register size
|
||||
|
||||
** Removed
|
||||
Removed need to hand calculate struct sizes
|
||||
|
||||
* 1.2 - 2019-04-14
|
||||
** Added
|
||||
|
|
2
cc.c
2
cc.c
|
@ -100,7 +100,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
else if(match(argv[i], "-V") || match(argv[i], "--version"))
|
||||
{
|
||||
file_print("M2-Planet v1.0.0\n", stderr);
|
||||
file_print("M2-Planet v1.3.0\n", stderr);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
|
|
18
cc_core.c
18
cc_core.c
|
@ -1400,6 +1400,7 @@ void statement()
|
|||
global_token = global_token->next;
|
||||
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(global_token->s);
|
||||
if(ARMV7L == Architecture) emit_out(" JUMP_ALWAYS");
|
||||
|
@ -1535,8 +1536,21 @@ new_type:
|
|||
{
|
||||
global_token = global_token->next;
|
||||
global_constant_list = sym_declare(global_token->s, NULL, global_constant_list);
|
||||
global_constant_list->arguments = global_token->next;
|
||||
global_token = global_token->next->next;
|
||||
|
||||
if(match("sizeof", global_token->next->s))
|
||||
{
|
||||
global_token = global_token->next->next;
|
||||
require_match("ERROR in CONSTANT with sizeof\nMissing (\n", "(");
|
||||
struct type* a = type_name();
|
||||
require_match("ERROR in CONSTANT with sizeof\nMissing )\n", ")");
|
||||
global_token->prev->s = numerate_number(a->size);
|
||||
global_constant_list->arguments = global_token->prev;
|
||||
}
|
||||
else
|
||||
{
|
||||
global_constant_list->arguments = global_token->next;
|
||||
global_token = global_token->next->next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
80
makefile
80
makefile
|
@ -71,6 +71,26 @@ test: test00-amd64-binary \
|
|||
test06-amd64-binary \
|
||||
test07-amd64-binary \
|
||||
test08-amd64-binary \
|
||||
test09-amd64-binary \
|
||||
test10-amd64-binary \
|
||||
test11-amd64-binary \
|
||||
test12-amd64-binary \
|
||||
test13-amd64-binary \
|
||||
test14-amd64-binary \
|
||||
test15-amd64-binary \
|
||||
test16-amd64-binary \
|
||||
test17-amd64-binary \
|
||||
test18-amd64-binary \
|
||||
test19-amd64-binary \
|
||||
test20-amd64-binary \
|
||||
test21-amd64-binary \
|
||||
test22-amd64-binary \
|
||||
test23-amd64-binary \
|
||||
test24-amd64-binary \
|
||||
test25-amd64-binary \
|
||||
test26-amd64-binary \
|
||||
test99-amd64-binary \
|
||||
test100-amd64-binary \
|
||||
test00-knight-posix-binary \
|
||||
test01-knight-posix-binary \
|
||||
test02-knight-posix-binary \
|
||||
|
@ -203,6 +223,66 @@ test07-amd64-binary: M2-Planet | results
|
|||
test08-amd64-binary: M2-Planet | results
|
||||
test/test08/hello-amd64.sh
|
||||
|
||||
test09-amd64-binary: M2-Planet | results
|
||||
test/test09/hello-amd64.sh
|
||||
|
||||
test10-amd64-binary: M2-Planet | results
|
||||
test/test10/hello-amd64.sh
|
||||
|
||||
test11-amd64-binary: M2-Planet | results
|
||||
test/test11/hello-amd64.sh
|
||||
|
||||
test12-amd64-binary: M2-Planet | results
|
||||
test/test12/hello-amd64.sh
|
||||
|
||||
test13-amd64-binary: M2-Planet | results
|
||||
test/test13/hello-amd64.sh
|
||||
|
||||
test14-amd64-binary: M2-Planet | results
|
||||
test/test14/hello-amd64.sh
|
||||
|
||||
test15-amd64-binary: M2-Planet | results
|
||||
test/test15/hello-amd64.sh
|
||||
|
||||
test16-amd64-binary: M2-Planet | results
|
||||
test/test16/hello-amd64.sh
|
||||
|
||||
test17-amd64-binary: M2-Planet | results
|
||||
test/test17/hello-amd64.sh
|
||||
|
||||
test18-amd64-binary: M2-Planet | results
|
||||
test/test18/hello-amd64.sh
|
||||
|
||||
test19-amd64-binary: M2-Planet | results
|
||||
test/test19/hello-amd64.sh
|
||||
|
||||
test20-amd64-binary: M2-Planet | results
|
||||
test/test20/hello-amd64.sh
|
||||
|
||||
test21-amd64-binary: M2-Planet | results
|
||||
test/test21/hello-amd64.sh
|
||||
|
||||
test22-amd64-binary: M2-Planet | results
|
||||
test/test22/hello-amd64.sh
|
||||
|
||||
test23-amd64-binary: M2-Planet | results
|
||||
test/test23/hello-amd64.sh
|
||||
|
||||
test24-amd64-binary: M2-Planet | results
|
||||
test/test24/hello-amd64.sh
|
||||
|
||||
test25-amd64-binary: M2-Planet | results
|
||||
test/test25/hello-amd64.sh
|
||||
|
||||
test26-amd64-binary: M2-Planet | results
|
||||
test/test26/hello-amd64.sh
|
||||
|
||||
test99-amd64-binary: M2-Planet | results
|
||||
test/test99/hello-amd64.sh
|
||||
|
||||
test100-amd64-binary: M2-Planet | results
|
||||
test/test100/hello-amd64.sh
|
||||
|
||||
test00-knight-posix-binary: M2-Planet | results
|
||||
test/test00/hello-knight-posix.sh
|
||||
|
||||
|
|
|
@ -0,0 +1,196 @@
|
|||
### Copyright (C) 2016 Jeremiah Orians
|
||||
### Copyright (C) 2017 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||
### 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/>.
|
||||
|
||||
### elf64.hex2: 64 bit elf header in hex2
|
||||
### if you wish to use this header, you need to add :ELF_end to the end of your
|
||||
### M1 or hex2 files.
|
||||
|
||||
## ELF Header
|
||||
|
||||
:ELF_base
|
||||
7F 45 4C 46 # e_ident[EI_MAG0-3] ELF's magic number
|
||||
|
||||
02 # e_ident[EI_CLASS] Indicating 64 bit
|
||||
01 # e_ident[EI_DATA] Indicating little endianness
|
||||
01 # e_ident[EI_VERSION] Indicating original elf
|
||||
|
||||
00 # e_ident[EI_OSABI] Set at 0 because none cares
|
||||
00 # e_ident[EI_ABIVERSION] See above
|
||||
|
||||
00 00 00 00 00 00 00 # e_ident[EI_PAD]
|
||||
02 00 # e_type Indicating Executable
|
||||
3E 00 # e_machine Indicating AMD64
|
||||
01 00 00 00 # e_version Indicating original elf
|
||||
|
||||
&ELF_text 00 00 00 00 # e_entry Address of the entry point
|
||||
%ELF_program_headers>ELF_base 00 00 00 00 # e_phoff Address of program header table
|
||||
%ELF_section_headers>ELF_base 00 00 00 00 # e_shoff Address of section header table
|
||||
|
||||
00 00 00 00 # e_flags
|
||||
40 00 # e_ehsize Indicating our 64 Byte header
|
||||
|
||||
38 00 # e_phentsize size of a program header table
|
||||
02 00 # e_phnum number of entries in program table
|
||||
|
||||
40 00 # e_shentsize size of a section header table
|
||||
07 00 # e_shnum number of entries in section table
|
||||
|
||||
04 00 # e_shstrndx index of the section names
|
||||
|
||||
:ELF_program_headers
|
||||
:ELF_program_header__text
|
||||
01 00 00 00 # ph_type: PT-LOAD = 1
|
||||
07 00 00 00 # ph_flags: PF-X|PF-W|PF-R = 7
|
||||
00 00 00 00 00 00 00 00 # ph_offset
|
||||
&ELF_base 00 00 00 00 # ph_vaddr
|
||||
&ELF_base 00 00 00 00 # ph_physaddr
|
||||
%ELF_end>ELF_base 00 00 00 00 # ph_filesz
|
||||
%ELF_end>ELF_base 00 00 00 00 # ph_memsz
|
||||
01 00 00 00 00 00 00 00 # ph_align
|
||||
|
||||
#:ELF_program_header__data # NOT USED
|
||||
# FIXME: linux 4.17 does not allow this overlap
|
||||
# Uhuuh, elf segment at 0000000001000000
|
||||
# requested but the memory is mapped already
|
||||
00 00 00 00 # ph_type: PT-LOAD = 0 => no load
|
||||
07 00 00 00 # ph_flags: PF-X|PF-W|PF-R = 7
|
||||
00 00 00 00 00 00 00 00 # ph_offset
|
||||
&ELF_base 00 00 00 00 # ph_vaddr
|
||||
&ELF_base 00 00 00 00 # ph_physaddr
|
||||
%ELF_end>ELF_base 00 00 00 00 # ph_filesz
|
||||
%ELF_end>ELF_base 00 00 00 00 # ph_memsz
|
||||
01 00 00 00 00 00 00 00 # ph_align
|
||||
|
||||
:ELF_comment
|
||||
4d 45 53 00 00 00 00 00 # MES
|
||||
00 00 00 00 00 00 00 00 # align
|
||||
00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00
|
||||
|
||||
4d 45 53 00 00 00 00 00 # MES
|
||||
00 00 00 00 00 00 00 00 # align
|
||||
00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00
|
||||
|
||||
:ELF_shstr
|
||||
00
|
||||
:ELF_shstr__text
|
||||
2e 74 65 78 74 00 # .text
|
||||
:ELF_shstr__data
|
||||
2e 64 61 74 61 00 # .data
|
||||
:ELF_shstr__comment
|
||||
2e 63 6f 6d 6d 65 6e 74 00 # .comment
|
||||
:ELF_shstr__shstr
|
||||
2e 73 68 73 74 72 74 61 62 00 # .shstrtab
|
||||
:ELF_shstr__sym
|
||||
2e 73 79 6d 74 61 62 00 # .symtab
|
||||
:ELF_shstr__str
|
||||
2e 73 74 72 74 61 62 00 # .strtab
|
||||
|
||||
:ELF_section_headers
|
||||
00 00 00 00 # sh_name
|
||||
00 00 00 00 # sh_type
|
||||
00 00 00 00 00 00 00 00 # sh_flags
|
||||
00 00 00 00 00 00 00 00 # sh_addr
|
||||
00 00 00 00 00 00 00 00 # sh_offset
|
||||
00 00 00 00 00 00 00 00 # sh_size
|
||||
00 00 00 00 # sh_link
|
||||
00 00 00 00 # sh_info
|
||||
00 00 00 00 00 00 00 00 # sh_1?
|
||||
00 00 00 00 00 00 00 00 # sh_entsize
|
||||
|
||||
:ELF_section_header_text
|
||||
%ELF_shstr__text>ELF_shstr # sh_name
|
||||
01 00 00 00 # sh_type = SHT_PROGBITS = 1
|
||||
06 00 00 00 00 00 00 00 # sh_flags = SHF-ALLOC|SHF-EXEC =2 | 4 = 6
|
||||
&ELF_text 00 00 00 00 # sh_addr
|
||||
%ELF_text>ELF_base 00 00 00 00 # sh_offset
|
||||
%ELF_data>ELF_text 00 00 00 00 # sh_size
|
||||
00 00 00 00 # sh_link
|
||||
00 00 00 00 # sh_info
|
||||
01 00 00 00 00 00 00 00 # sh_1?
|
||||
00 00 00 00 00 00 00 00 # sh_entsize
|
||||
|
||||
:ELF_section_header_data
|
||||
%ELF_shstr__data>ELF_shstr # sh_name
|
||||
01 00 00 00 # sh_type = SHT_PROGBITS = 1
|
||||
03 00 00 00 00 00 00 00 # sh_flags = SHF-WRITE|SHF-ALLOC = 1 | 2 = 3
|
||||
&ELF_data 00 00 00 00 # sh_addr
|
||||
%ELF_data>ELF_base 00 00 00 00 # sh_offset
|
||||
%ELF_sym>ELF_data 00 00 00 00 # sh_size
|
||||
00 00 00 00 # sh_link
|
||||
00 00 00 00 # sh_info
|
||||
01 00 00 00 00 00 00 00 # sh_1?
|
||||
00 00 00 00 00 00 00 00 # sh_entsize
|
||||
|
||||
:ELF_section_header_comment
|
||||
%ELF_shstr__comment>ELF_shstr # sh_name
|
||||
01 00 00 00 # sh_type = SHT_PROGBITS = 1
|
||||
00 00 00 00 00 00 00 00 # sh_flags
|
||||
&ELF_comment 00 00 00 00 # sh_addr
|
||||
%ELF_comment>ELF_base 00 00 00 00 # sh_offset
|
||||
%ELF_shstr>ELF_comment 00 00 00 00 # sh_size
|
||||
00 00 00 00 # sh_link
|
||||
00 00 00 00 # sh_info
|
||||
01 00 00 00 00 00 00 00 # sh_1?
|
||||
00 00 00 00 00 00 00 00 # sh_entsize
|
||||
|
||||
:ELF_section_header_shstr
|
||||
%ELF_shstr__shstr>ELF_shstr # sh_name
|
||||
03 00 00 00 # sh_type: str-sht-strtab
|
||||
00 00 00 00 00 00 00 00 # sh_flags
|
||||
&ELF_shstr 00 00 00 00 # sh_addr
|
||||
%ELF_shstr>ELF_base 00 00 00 00 # sh_offset
|
||||
%ELF_section_headers>ELF_shstr 00 00 00 00 # sh_size
|
||||
00 00 00 00 # sh_link
|
||||
00 00 00 00 # sh_info
|
||||
01 00 00 00 00 00 00 00 # sh_1?
|
||||
00 00 00 00 00 00 00 00 # sh_entsize
|
||||
|
||||
:ELF_section_header_sym
|
||||
%ELF_shstr__sym>ELF_shstr # sh_name
|
||||
02 00 00 00 # sh_type: str-sht-symtab
|
||||
00 00 00 00 00 00 00 00 # sh_flags
|
||||
&ELF_sym 00 00 00 00 # sh_addr
|
||||
%ELF_sym>ELF_base 00 00 00 00 # sh_offset
|
||||
%ELF_end>ELF_sym 00 00 00 00 # sh_size
|
||||
06 00 00 00 # sh_link:6
|
||||
00 00 00 00 # sh_info
|
||||
01 00 00 00 00 00 00 00 # sh_1?
|
||||
18 00 00 00 00 00 00 00 # sh_entsize
|
||||
|
||||
:ELF_section_header_str
|
||||
%ELF_shstr__str>ELF_shstr # sh_name
|
||||
03 00 00 00 # sh_type: str-sht-strtab
|
||||
00 00 00 00 00 00 00 00 # sh_flags
|
||||
&ELF_str 00 00 00 00 # sh_addr
|
||||
%ELF_str>ELF_base 00 00 00 00 # sh_offset
|
||||
%ELF_sym>ELF_str 00 00 00 00 # sh_size
|
||||
00 00 00 00 # sh_link
|
||||
00 00 00 00 # sh_info
|
||||
01 00 00 00 00 00 00 00 # sh_1?
|
||||
00 00 00 00 00 00 00 00 # sh_entsize
|
||||
|
||||
00 00 00 00 # align
|
||||
00 00 00 00
|
||||
|
||||
00 00 00 00 # align
|
||||
00 00 00 00
|
||||
00 00 00 00
|
||||
00 00 00 00
|
||||
|
||||
:ELF_text
|
|
@ -22,6 +22,7 @@ DEFINE ADD_rbp_to_rax 4801E8
|
|||
DEFINE ADD_rbx_to_rax 4801D8
|
||||
DEFINE AND_rax_rbx 4821D8
|
||||
DEFINE CALL_IMMEDIATE E8
|
||||
DEFINE CALL_rax FFD0
|
||||
DEFINE CMP 4839C3
|
||||
DEFINE COPY_rax_to_rcx 4889C1
|
||||
DEFINE COPY_rax_to_rdi 4889C7
|
||||
|
@ -31,20 +32,33 @@ 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 DIVIDE_rax_by_rbx_into_rax 48F7FB
|
||||
DEFINE JUMP E9
|
||||
DEFINE JUMP_EQ 0F84
|
||||
DEFINE JUMP_NE 0F85
|
||||
DEFINE LOAD_BASE_ADDRESS_rax 488D85
|
||||
DEFINE LOAD_BYTE 8A00
|
||||
DEFINE LOAD_BYTE 0FBE00
|
||||
DEFINE LOAD_EFFECTIVE_ADDRESS_rdi 488DBC24
|
||||
DEFINE LOAD_EFFECTIVE_ADDRESS_rdx 488D9424
|
||||
DEFINE LOAD_EFFECTIVE_ADDRESS_rsi 488DB424
|
||||
DEFINE LOAD_IMMEDIATE_r10 48C7C2
|
||||
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_INTEGER_rdi 488B3F
|
||||
DEFINE LOAD_INTEGER_rdx 488B12
|
||||
DEFINE LOAD_INTEGER_rsi 488B36
|
||||
DEFINE LOAD_RSP_IMMEDIATE_into_rax 488B8424
|
||||
DEFINE MODULUS_rax_from_rbx_into_rbx 48F7FB
|
||||
DEFINE MOVE_rbx_to_rax 4889D8
|
||||
DEFINE MOVE_rdx_to_rax 4889D0
|
||||
DEFINE MOVEZX 480FB6C0
|
||||
DEFINE MULTIPLY_rax_by_rbx_into_rax 48F7E3
|
||||
DEFINE NOP 0000000000000000
|
||||
DEFINE NOT_rax 48F7D0
|
||||
DEFINE OR_rax_rbx 4809D8
|
||||
DEFINE POP_RAX 58
|
||||
DEFINE POP_RBP 5D
|
||||
DEFINE POP_RBX 5B
|
||||
|
@ -63,8 +77,10 @@ DEFINE SETGE 0F9DC0
|
|||
DEFINE SETL 0F9CC0
|
||||
DEFINE SETLE 0F9EC0
|
||||
DEFINE SETNE 0F95C0
|
||||
DEFINE STORE_CHAR 8803
|
||||
DEFINE STORE_INTEGER 488903
|
||||
DEFINE SUBTRACT_rax_from_rbx_into_rbx 4829C3
|
||||
DEFINE SYSCALL 0F05
|
||||
DEFINE TEST 4885C0
|
||||
DEFINE XCHG_rax_rbx 93
|
||||
DEFINE XOR_rbx_rax_into_rax 4831D8
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
void exit(int value);
|
||||
|
||||
void _exit(int value)
|
||||
{
|
||||
exit(value);
|
||||
}
|
||||
|
||||
int waitpid (int pid, int* status_ptr, int options)
|
||||
{
|
||||
/* Uses wait4 with struct rusage *ru set to NULL */
|
||||
asm("LOAD_EFFECTIVE_ADDRESS_rdi %24"
|
||||
"LOAD_INTEGER_rdi"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rsi %16"
|
||||
"LOAD_INTEGER_rsi"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rdx %8"
|
||||
"LOAD_INTEGER_rdx"
|
||||
"LOAD_IMMEDIATE_r10 %0"
|
||||
"LOAD_IMMEDIATE_rax %61"
|
||||
"SYSCALL");
|
||||
}
|
||||
|
||||
|
||||
int execve(char* file_name, char** argv, char** envp)
|
||||
{
|
||||
asm("LOAD_EFFECTIVE_ADDRESS_rdi %24"
|
||||
"LOAD_INTEGER_rdi"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rsi %16"
|
||||
"LOAD_INTEGER_rsi"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rdx %8"
|
||||
"LOAD_INTEGER_rdx"
|
||||
"LOAD_IMMEDIATE_rax %59"
|
||||
"SYSCALL");
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
/* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// CONSTANT stdin 0
|
||||
// CONSTANT stdout 1
|
||||
// CONSTANT stderr 2
|
||||
// CONSTANT EOF 0xFFFFFFFF
|
||||
|
||||
int fgetc(FILE* f)
|
||||
{
|
||||
asm("LOAD_EFFECTIVE_ADDRESS_rdi %8"
|
||||
"LOAD_INTEGER_rdi"
|
||||
"LOAD_IMMEDIATE_rax %0"
|
||||
"PUSH_RAX"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rsi %0"
|
||||
"LOAD_IMMEDIATE_rdx %1"
|
||||
"SYSCALL"
|
||||
"LOAD_IMMEDIATE_rbx %0"
|
||||
"CMP"
|
||||
"POP_RAX"
|
||||
"JUMP_NE %FUNCTION_fgetc_Done"
|
||||
"LOAD_IMMEDIATE_rax %-1"
|
||||
":FUNCTION_fgetc_Done");
|
||||
}
|
||||
|
||||
void fputc(char s, FILE* f)
|
||||
{
|
||||
asm("LOAD_IMMEDIATE_rax %1"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rdi %8"
|
||||
"LOAD_INTEGER_rdi"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rsi %16"
|
||||
"LOAD_IMMEDIATE_rdx %1"
|
||||
"SYSCALL");
|
||||
}
|
||||
|
||||
/* Important values needed for open
|
||||
* O_RDONLY => 0
|
||||
* O_WRONLY => 1
|
||||
* O_RDWR => 2
|
||||
* O_CREAT => 64
|
||||
* O_TRUNC => 512
|
||||
* S_IRWXU => 00700
|
||||
* S_IXUSR => 00100
|
||||
* S_IWUSR => 00200
|
||||
* S_IRUSR => 00400
|
||||
*/
|
||||
|
||||
FILE* open(char* name, int flag, int mode)
|
||||
{
|
||||
asm("LOAD_EFFECTIVE_ADDRESS_rdi %24"
|
||||
"LOAD_INTEGER_rdi"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rsi %16"
|
||||
"LOAD_INTEGER_rsi"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rdx %8"
|
||||
"LOAD_INTEGER_rdx"
|
||||
"LOAD_IMMEDIATE_rax %2"
|
||||
"SYSCALL");
|
||||
}
|
||||
|
||||
FILE* fopen(char* filename, char* mode)
|
||||
{
|
||||
FILE* f;
|
||||
if('w' == mode[0])
|
||||
{ /* 577 is O_WRONLY|O_CREAT|O_TRUNC, 384 is 600 in octal */
|
||||
f = open(filename, 577 , 384);
|
||||
}
|
||||
else
|
||||
{ /* Everything else is a read */
|
||||
f = open(filename, 0, 0);
|
||||
}
|
||||
|
||||
/* Negative numbers are error codes */
|
||||
if(0 > f)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
int close(int fd)
|
||||
{
|
||||
asm("LOAD_EFFECTIVE_ADDRESS_rdi %8"
|
||||
"LOAD_INTEGER_rdi"
|
||||
"LOAD_IMMEDIATE_rax %3"
|
||||
"SYSCALL");
|
||||
}
|
||||
int fclose(FILE* stream)
|
||||
{
|
||||
int error = close(stream);
|
||||
return error;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
int fork()
|
||||
{
|
||||
asm("LOAD_IMMEDIATE_rax %57"
|
||||
"LOAD_IMMEDIATE_rdi %0"
|
||||
"SYSCALL");
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
int getchar()
|
||||
{
|
||||
asm("LOAD_IMMEDIATE_rdi %0"
|
||||
"LOAD_IMMEDIATE_rax %0"
|
||||
"PUSH_RAX"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rsi %0"
|
||||
"LOAD_IMMEDIATE_rdx %1"
|
||||
"SYSCALL"
|
||||
"LOAD_IMMEDIATE_rbx %0"
|
||||
"CMP"
|
||||
"POP_RAX"
|
||||
"JUMP_NE %FUNCTION_getchar_Done"
|
||||
"LOAD_IMMEDIATE_rax %-1"
|
||||
":FUNCTION_getchar_Done");
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* chmod() changes the mode of the file specified whose pathname is given in
|
||||
* pathname, which is dereferenced if it is a symbolic link.
|
||||
* fchmod() changes the mode of the file referred to by the open file
|
||||
* descriptor fd.
|
||||
* The new file mode is specified in mode, which is a bit mask created by
|
||||
* ORing together zero or more of the following:
|
||||
* S_ISUID (04000) set-user-ID (set process effective user ID on execve(2))
|
||||
* S_ISGID (02000) set-group-ID (set process effective group ID on execve(2)
|
||||
* mandatory locking, as described in fcntl(2); take a new file's group from
|
||||
* parent directory, as described in chown(2) and mkdir(2))
|
||||
* S_ISVTX (01000) sticky bit (restricted deletion flag, as described in
|
||||
* unlink(2))
|
||||
* S_IRUSR (00400) read by owner
|
||||
* S_IWUSR (00200) write by owner
|
||||
* S_IXUSR (00100) execute/search by owner ("search" applies for directories
|
||||
* , and means that entries within the directory can be accessed)
|
||||
* S_IRGRP (00040) read by group
|
||||
* S_IWGRP (00020) write by group
|
||||
* S_IXGRP (00010) execute/search by group
|
||||
* S_IROTH (00004) read by others
|
||||
* S_IWOTH (00002) write by others
|
||||
* S_IXOTH (00001) execute/search by others
|
||||
*/
|
||||
|
||||
int chmod(char *pathname, int mode)
|
||||
{
|
||||
asm("LOAD_EFFECTIVE_ADDRESS_rdi %16"
|
||||
"LOAD_INTEGER_rdi"
|
||||
"LOAD_EFFECTIVE_ADDRESS_rsi %8"
|
||||
"LOAD_INTEGER_rsi"
|
||||
"LOAD_IMMEDIATE_rax %90"
|
||||
"SYSCALL");
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
struct utsname
|
||||
{
|
||||
char sysname[65]; /* Operating system name (e.g., "Linux") */
|
||||
char nodename[65]; /* Name within "some implementation-defined network" */
|
||||
char release[65]; /* Operating system release (e.g., "2.6.28") */
|
||||
char version[65]; /* Operating system version */
|
||||
char machine[65]; /* Hardware identifier */
|
||||
};
|
||||
|
||||
int uname(struct utsname* unameData)
|
||||
{
|
||||
asm("LOAD_EFFECTIVE_ADDRESS_rdi %8"
|
||||
"LOAD_INTEGER_rdi"
|
||||
"LOAD_IMMEDIATE_rax %63"
|
||||
"SYSCALL");
|
||||
}
|
|
@ -23,7 +23,7 @@ b773d7ec7c550b71997ce451af7e1ee59fe6597b32adc455b271b7d173d5eae9 test/results/t
|
|||
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
|
||||
c4e5e2ffc3a2c3d4116589fa1369d45e5af91cc69b5d342ef5552dfca992c64b 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
|
||||
|
@ -43,69 +43,89 @@ a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/t
|
|||
3a1de0143bfe2302ab0f7da189a0a14c285efebf7c16d7ea0177751c9e3b2175 test/results/test08-knight-native-binary
|
||||
b824859fd0e39f1417742a1b9a1cec18ade78afdd80ce2c64cb54cdf7683f53a test/results/test08-knight-posix-binary
|
||||
3a099298d2235ad00518bb6e2f2f9e25d429c4fe576dfc9cf083e3e0053bdcc2 test/results/test08-x86-binary
|
||||
b1251d03f35474f9c5cec84d067d97295a47ae34dbd9f12e72a3630127cc1e07 test/results/test09-amd64-binary
|
||||
81cae9bfb57c727bcb16b59d81d9d588e84350b75a20170afa06e3d269029b87 test/results/test09-armv7l-binary
|
||||
b40d198af6c31f1af513ec70c6be9c6daa43cccf48a7191f4d984f81cdfbf623 test/results/test09-knight-native-binary
|
||||
0feaacc13ad24c2b513fd9d46a58c38b1af57e77275c9a148cafb4a0d3cc7b7a test/results/test09-knight-posix-binary
|
||||
9e4a0a6216bb4fde5dcefac91fd7c623e9e00b3e762946e5a47a1b50b4656103 test/results/test09-x86-binary
|
||||
a9cf4422e05075395ad75bbfe4b2659aec4541edd46d8c6b5064d3496b06a0b6 test/results/test10-amd64-binary
|
||||
5df859c88e9cbb2758f823e020d9993d50ba81fae20d469c03ec2b196d55f580 test/results/test10-armv7l-binary
|
||||
1154f39f25dcd6d914e9a542306f95280926baf985d011b2152c7ea0b87ab42d test/results/test10-knight-native-binary
|
||||
c1b5a2a3cd46c5e95e5540e871c2a916e028684ca80f51c001ef489342e27625 test/results/test10-knight-posix-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
|
||||
e5b1330fafc33c866396b341896e7fb52a2c403c90f25f1775bb0981c88b9bef test/results/test100-amd64-binary
|
||||
7dad3a8ee61228623586d154b89a0747dab009f9dcc847360ae2753e6a5416df test/results/test100-armv7l-binary
|
||||
dc04621732e4ea6f771bb6a33188290779a590f6c3bd12fda4ce7524341165db test/results/test100-knight-posix-binary
|
||||
e7f064a169acd5b6a8094f85f3bb195adcfe8d56190042ef595c477c9887abd0 test/results/test100-x86-binary
|
||||
34e6d535e30ef8826a4ad1a4d08b76cfa370c54595599ad3be784b64c9cd8ec5 test/results/test11-amd64-binary
|
||||
d9d465340abbce2d5964a6bc58e6cdd0ef93fb3d0199eaa823c86ec6abd0452a test/results/test11-armv7l-binary
|
||||
955b564d2c89abf2cfc6c80d766cd11479d146b828dec69e654b0958a62d5e6e test/results/test11-knight-native-binary
|
||||
63fd5fbf389d1b19031026df193ec55e98d923b8568007125b80bc246c094496 test/results/test11-knight-posix-binary
|
||||
3fd11bad4a426ce1ff8fd9c6d7d2b943effae9f3f5740b7376e426e9b0555851 test/results/test11-x86-binary
|
||||
dc88f6de5ae892774760843079eab57306bf0f6f683d4999bdec0d43e4e762b2 test/results/test12-amd64-binary
|
||||
fa46dd13a783d7531394603946c9e8784a9a9890b7e6cbfdd1f0b3dfb529017b test/results/test12-armv7l-binary
|
||||
21848cdee9c6f063c295680ae48f7a7677fe783f4892ece00c7504e8441b4c5b test/results/test12-knight-native-binary
|
||||
313536f9209d29d4c3b40f6ada898f81c1fb3b650ca1a84754f90b1db3b9e001 test/results/test12-knight-posix-binary
|
||||
f98ab8e4bb35580e0dde96126d7a56aff66bda208d02c8d89390b40d6cff591c test/results/test12-x86-binary
|
||||
5095e23b0d6680de3e28c1898b66c352761522f42313acb96f6f39bf0707f4bb test/results/test13-amd64-binary
|
||||
8717f4034922836e75c9924edd48f9890a900cdadd322b2fd5949f64544d68c1 test/results/test13-armv7l-binary
|
||||
9d8c4ee9d5c8cad031880f1e15dcb419108e7cb2933c30622afabb8335c85641 test/results/test13-knight-native-binary
|
||||
e50c97ba330823cb5cbe938bb9d1575340b083e60fc42db8edefcfd95851daa2 test/results/test13-knight-posix-binary
|
||||
5051ffca2615144419f8ec1a5d4999486ae81e7781428f59e47e866af97cef92 test/results/test13-x86-binary
|
||||
bcc5f70b76fd7ff1a8ccbc1d13e41044b3a6f2b7158194fc0a669b0ba07d0969 test/results/test14-amd64-binary
|
||||
c447dc62f437bdb045cb260d5965551e805de7ad4c09cc006229543cc9824530 test/results/test14-armv7l-binary
|
||||
156fa1e6b5814da94a542dfe742f77e155d52724b34f75f3513b9e8f6f2503dd test/results/test14-knight-posix-binary
|
||||
a8218958b628066e2fda63d3933f1bf607c358d7bdfe84fc02596393698ea5f6 test/results/test14-x86-binary
|
||||
0526b33e314a881746bb108d0ec68a3f11b96d1b92b287816235f825210bff2a test/results/test15-amd64-binary
|
||||
6bd3ca5cefa19ed620def60bee5eb7fe7d0e11198aa6a4592b5de27cd5401d12 test/results/test15-armv7l-binary
|
||||
9f7c81e278248a3160d80a3f5ca0c39a5505ca9b45adc002e9b527db3e5f084a test/results/test15-knight-posix-binary
|
||||
f24c62fb54b9ab510ce1b3a36d119e3b5d2ed56e33564c83782d828eac6a6773 test/results/test15-x86-binary
|
||||
d8dbd22939091d04ccc969d848b4e4e2a6b5c9a8c91779923830fd6aa1a0f779 test/results/test16-amd64-binary
|
||||
5314508cb2146dc95748e5c0c0fbab48986da7dd42a2603f46006b20045c73b5 test/results/test16-armv7l-binary
|
||||
84f5472ce5711b9cad28fcd4c177eea673047c2561ea010ccb6bf5f50d89c713 test/results/test16-knight-posix-binary
|
||||
aeb94a4142633f20d7be4f8e74f0d5edc9050afb76f49cb504a1c264bf1ef96b test/results/test16-x86-binary
|
||||
edbb413c0a1e97e57c08192190c37345759e05356394d1c9f43b2eb205b65769 test/results/test17-amd64-binary
|
||||
aae309ad68840fbc1685412c4fe42bb54bb9caf20a92b3251cfa4749c8698a0b test/results/test17-armv7l-binary
|
||||
537f6885bf76a95ad322b4dc416d7de0bb73b5bbfc3bc2a9ea096e240b4081b8 test/results/test17-knight-native-binary
|
||||
0323ae8fa9e79cae9a58eec89a80b2c354db276d76c6f50b3bf50840327d4950 test/results/test17-knight-posix-binary
|
||||
56a83f34aa57b10efdea636135491043d8c8b09dc09b451b58c27801ca82990e test/results/test17-x86-binary
|
||||
f63d60a919ff5f5b25fc0e925f104fe0039d537bc0e9aaaf1f187f80741a0083 test/results/test18-amd64-binary
|
||||
122d78f9943f3678a07a9ec82b491e041664b31931ac5056c8a238eb0753e879 test/results/test18-armv7l-binary
|
||||
4da569a63039551da7dc2f8fd1505d7c1661ec1765aae301071ac0c24c2064c3 test/results/test18-knight-native-binary
|
||||
d0f0b1428c8db70806d6e2e5b81aca4b6752c4a581a3fa83da064317ceb605b0 test/results/test18-knight-posix-binary
|
||||
8e3f5e2dfacf07aa3ab4376e9db2649cd51b53ed68e0e9789fbcaaac1277ad64 test/results/test18-x86-binary
|
||||
85112e5009d06e4ee68405d5272bcc7608b0202dca1f6fdfabdb6a9d230625e3 test/results/test19-amd64-binary
|
||||
4e3f590623e2baae4c42e68b6f8f35d9731e4d5a64bbe5112780b8382225f916 test/results/test19-armv7l-binary
|
||||
32ba6ae74a8756fe4b95c65a643513bdd785778f98a878b3ea5459b5aaccaa38 test/results/test19-knight-posix-binary
|
||||
07d8975a384003b5726e1e3c517fba25f55d9c19e4122273303743c94a18bd70 test/results/test19-x86-binary
|
||||
15950e38bab2603bfcb369b9a4941abfc2e37b7cbbd2cf9b22ebfc9aab46d5ad test/results/test20-amd64-binary
|
||||
ef9d0050388ab15454b437bc40c19737cda9211cb3704a0b2619fae232239d7f test/results/test20-armv7l-binary
|
||||
7ae1ba10ff6b6bf34148945ee44b9461aa6d1a16094e77fdf34b76e9a360a5b2 test/results/test20-knight-native-binary
|
||||
6a59795dbb4397d0efaf1ad613d646ec435eec62db30eb758bcf2499d651520e test/results/test20-knight-posix-binary
|
||||
0d1a43723d0482a21028164e33ff116d66302d6042a88eacf08436a351494530 test/results/test20-x86-binary
|
||||
b80de35e17d341cda9cd280437acb6b217841e18a5b01faf86ca461f6bf0d246 test/results/test21-amd64-binary
|
||||
737b2262e54035b5cac20fc43013956a0c4fd144c6b40ffc546ee05a6133922f test/results/test21-armv7l-binary
|
||||
3c096914ca492c60bd53193fcc109549fae170052b347e3e62dabcbd9784691f test/results/test21-knight-posix-binary
|
||||
f5d6430d6fade0d4acdaeda1662d9bfdeff881a75e2c877dc738f3485ddb4e63 test/results/test21-x86-binary
|
||||
120d142803805af2342d9b8db6f2f70b7a7b81fd4890d5fef43b46db1832602e test/results/test22-amd64-binary
|
||||
883b112bca57ddab502af939327765508fa37ea3a588c37094d3798b2267171b test/results/test22-armv7l-binary
|
||||
7ccc16255ce81a9b35934649b5446face10db899cadaf00008c582934eefaa37 test/results/test22-knight-posix-binary
|
||||
f30be64f9bbebb5c1bfa16f584754106de5d95d48b6882b4458beb5e72b2c473 test/results/test22-x86-binary
|
||||
0c836dacd7ef5813b22a435fd8f5072acaadb67bc0d9054314f96ddabda3de59 test/results/test23-amd64-binary
|
||||
b70c97824a6008dd1be8a4360874c794d8d027004cab9b86a53fda95fef2e4cc test/results/test23-armv7l-binary
|
||||
1b86c800067f64ffd6cfd4b39155b81e3b0fc7ffa6d43d1edd75852edd2d583f test/results/test23-knight-posix-binary
|
||||
f25bbe673256a099030a1d7dcf4d1c85fbdc22da3dfb30c11f93ad72e3356414 test/results/test23-x86-binary
|
||||
44d06216e0bf9c2f8dfcb6684f6f6c0c0276f73c78c36a96454be84c8dc066af test/results/test24-amd64-binary
|
||||
1deae7d8b3ed2373afb1dba21d192ce642d17b47483c9ec72f3081089ac46725 test/results/test24-armv7l-binary
|
||||
a1053415b79f08f8bcc9ebda8c9b096ed4e66c483504ba3d7d4dbebad2e3fabf test/results/test24-knight-posix-binary
|
||||
adb392ddd4f3daab1a9afc1eb0bf00cb388a6c45db7754f8455f39757e7f62f6 test/results/test24-x86-binary
|
||||
9e8fe8dd8d1f3fa34e6b1b114de79375893e44d6a4d17f058df6578f118f6457 test/results/test25-amd64-binary
|
||||
ef17edf7febc6da5f1cda6b8c367010ff9fd446df8edcfdaf9570ab4fcc63a7c test/results/test25-armv7l-binary
|
||||
d8aa81fce8064db6697376b140cbf6aeeb91ff6728d1a80173c431bcb0526168 test/results/test25-x86-binary
|
||||
349a6a529151cc2ca4f0acbf7753b5653977abdb7dec676f29f3a63c608fad2c test/results/test26-amd64-binary
|
||||
70480a64dc02b0ef9275c1d69ca61712cc0c649f57dd63a019cb2359dc24f07b test/results/test26-armv7l-binary
|
||||
63d55e89c7c5bd06f9bf2af2408277587ada25e2836a060438256dbdc6b894b5 test/results/test26-x86-binary
|
||||
717c42e1a1a91ef5b67ce298bc92a148418a5dec6761a358a52b22a01f16c928 test/results/test99-amd64-binary
|
||||
4cd7628090622b165d2c2d1d4c089476a6d661d494e2fadb1ad9b0906585cd75 test/results/test99-armv7l-binary
|
||||
eaca2f7f70b75b7503ee040bebd0dc0fa961a25597622356f70faadec759d696 test/results/test99-knight-native-binary
|
||||
bea554c06c8ecdb9eaae2c586a2006487968625b9570cbe305f69959c0e680e7 test/results/test99-knight-posix-binary
|
||||
|
|
|
@ -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 -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/test09/goto.c \
|
||||
-o test/test09/goto.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/test09/goto.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test09/goto.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test09/goto.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test09-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/test09-amd64-binary 2>&1 )
|
||||
[ 42 = $? ] || exit 4
|
||||
[ "$out" = "Hello mes" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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/test10/nested_struct.c \
|
||||
-o test/test10/nested_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/test10/nested_struct.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test10/nested_struct.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test10/nested_struct.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test10-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/test10-amd64-binary 2>&1 )
|
||||
[ 24 = $? ] || exit 4
|
||||
[ "$out" = "35419896642975313541989657891634" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,89 @@
|
|||
#! /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 amd64 \
|
||||
-f test/common_amd64/functions/file.c \
|
||||
-f test/common_amd64/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f test/common_amd64/functions/exit.c \
|
||||
-f functions/match.c \
|
||||
-f functions/in_set.c \
|
||||
-f functions/numerate_number.c \
|
||||
-f functions/file_print.c \
|
||||
-f functions/number_pack.c \
|
||||
-f functions/string.c \
|
||||
-f cc.h \
|
||||
-f cc_reader.c \
|
||||
-f cc_strings.c \
|
||||
-f cc_types.c \
|
||||
-f cc_core.c \
|
||||
-f cc.c \
|
||||
--debug \
|
||||
-o test/test100/cc.M1 || exit 1
|
||||
|
||||
# Build debug footer
|
||||
blood-elf --64 -f test/test100/cc.M1 \
|
||||
-o test/test100/cc-footer.M1 || exit 2
|
||||
|
||||
# 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/test100/cc.M1 \
|
||||
-f test/test100/cc-footer.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test100/cc.hex2 || exit 3
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64-debug.hex2 \
|
||||
-f test/test100/cc.hex2 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
--BaseAddress 0x00600000 \
|
||||
-o test/results/test100-amd64-binary --exec_enable || exit 4
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ]
|
||||
then
|
||||
# Verify that the resulting file works
|
||||
./test/results/test100-amd64-binary --architecture x86 \
|
||||
-f test/common_x86/functions/file.c \
|
||||
-f test/common_x86/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f test/common_x86/functions/exit.c \
|
||||
-f functions/match.c \
|
||||
-f functions/in_set.c \
|
||||
-f functions/numerate_number.c \
|
||||
-f functions/file_print.c \
|
||||
-f functions/number_pack.c \
|
||||
-f functions/string.c \
|
||||
-f cc.h \
|
||||
-f cc_reader.c \
|
||||
-f cc_strings.c \
|
||||
-f cc_types.c \
|
||||
-f cc_core.c \
|
||||
-f cc.c \
|
||||
-o test/test100/proof || exit 5
|
||||
|
||||
. ./sha256.sh
|
||||
out=$(sha256_check test/test100/proof.answer)
|
||||
[ "$out" = "test/test100/proof: OK" ] || exit 6
|
||||
[ ! -e bin/M2-Planet ] && mv test/results/test100-amd64-binary bin/M2-Planet
|
||||
fi
|
||||
exit 0
|
|
@ -1 +1 @@
|
|||
276f2a0a47246aaea1447be06b913cc49e037e3454939728650a68a384973305 test/test100/proof
|
||||
46607975aee72aa608ceab592f0f67eb45c63bb83a0b49ea944a48a79c4aca75 test/test100/proof
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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/test11/break-do.c \
|
||||
-o test/test11/break-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/test11/break-do.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test11/break-do.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test11/break-do.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test11-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/test11-amd64-binary >| test/test11/proof || exit 4
|
||||
out=$(sha256_check test/test11/proof.answer)
|
||||
[ "$out" = "test/test11/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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/test12/break-for.c \
|
||||
-o test/test12/break-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/test12/break-for.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test12/break-for.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test12/break-for.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test12-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/test12-amd64-binary >| test/test12/proof || exit 4
|
||||
out=$(sha256_check test/test12/proof.answer)
|
||||
[ "$out" = "test/test12/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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/test13/break-while.c \
|
||||
-o test/test13/break-while.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/test13/break-while.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test13/break-while.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test13/break-while.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test13-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/test13-amd64-binary >| test/test13/proof || exit 4
|
||||
out=$(sha256_check test/test13/proof.answer)
|
||||
[ "$out" = "test/test13/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -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 amd64 -f test/common_amd64/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_amd64/amd64_defs.M1 \
|
||||
-f test/common_amd64/libc-core.M1 \
|
||||
-f test/test14/basic_args.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test14/basic_args.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test14/basic_args.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test14-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/test14-amd64-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test14/proof || exit 4
|
||||
out=$(sha256_check test/test14/proof-amd64.answer)
|
||||
[ "$out" = "test/test14/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1 @@
|
|||
c7843ff786b6e7b723a88576b9633c6da27009c21b2c465b612950a328723031 test/test14/proof
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -ex
|
||||
# Build the test
|
||||
bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/file.c \
|
||||
-f test/common_amd64/functions/putchar.c \
|
||||
-f test/test15/file_read.c \
|
||||
-o test/test15/file_read.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/test15/file_read.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test15/file_read.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test15/file_read.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test15-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/test15-amd64-binary test/test15/file_read.c >| test/test15/proof || exit 4
|
||||
out=$(sha256_check test/test15/proof.answer)
|
||||
[ "$out" = "test/test15/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -ex
|
||||
# Build the test
|
||||
bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/file.c \
|
||||
-f test/common_amd64/functions/putchar.c \
|
||||
-f test/test16/file_write.c \
|
||||
-o test/test16/file_write.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/test16/file_write.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test16/file_write.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test16/file_write.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test16-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/test16-amd64-binary test/test16/proof || exit 4
|
||||
out=$(sha256_check test/test16/proof.answer)
|
||||
[ "$out" = "test/test16/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,46 @@
|
|||
#! /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 amd64 -f test/common_amd64/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f test/common_amd64/functions/putchar.c \
|
||||
-f test/test17/memset.c \
|
||||
-o test/test17/memset.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/test17/memset.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test17/memset.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test17/memset.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test17-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/test17-amd64-binary >| test/test17/proof || exit 4
|
||||
out=$(sha256_check test/test17/proof.answer)
|
||||
[ "$out" = "test/test17/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,46 @@
|
|||
#! /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 amd64 -f test/common_amd64/functions/file.c \
|
||||
-f test/common_amd64/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f test/test18/math.c \
|
||||
-o test/test18/math.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/test18/math.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test18/math.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test18/math.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test18-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/test18-amd64-binary >| test/test18/proof || exit 4
|
||||
out=$(sha256_check test/test18/proof.answer)
|
||||
[ "$out" = "test/test18/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,50 @@
|
|||
#! /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 amd64 -f test/common_amd64/functions/file.c \
|
||||
-f test/common_amd64/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f test/common_amd64/functions/exit.c \
|
||||
-f functions/match.c \
|
||||
-f functions/in_set.c \
|
||||
-f functions/numerate_number.c \
|
||||
-f test/test19/getopt.c \
|
||||
-o test/test19/getopt.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/test19/getopt.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test19/getopt.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test19/getopt.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test19-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/test19-amd64-binary -f test/test19/input -o test/test19/proof || exit 4
|
||||
out=$(sha256_check test/test19/proof.answer)
|
||||
[ "$out" = "test/test19/proof: OK" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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/test20/struct.c \
|
||||
-o test/test20/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/test20/struct.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test20/struct.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test20/struct.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test20-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/test20-amd64-binary 2>&1 )
|
||||
[ 40 = $? ] || exit 4
|
||||
[ "$out" = "35419896642975313541989657891634" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,67 @@
|
|||
#! /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 -x
|
||||
# Build the test
|
||||
./bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/exit.c \
|
||||
-f test/common_amd64/functions/file.c \
|
||||
-f functions/file_print.c \
|
||||
-f test/common_amd64/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f functions/match.c \
|
||||
-f test/test21/blood-elf.c \
|
||||
--debug \
|
||||
-o test/test21/blood-elf.M1 || exit 1
|
||||
|
||||
# Build debug footer
|
||||
blood-elf --64 -f test/test21/blood-elf.M1 \
|
||||
-o test/test21/blood-elf-footer.M1 || exit 2
|
||||
|
||||
# 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/test21/blood-elf.M1 \
|
||||
-f test/test21/blood-elf-footer.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test21/blood-elf.hex2 || exit 3
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64-debug.hex2 \
|
||||
-f test/test21/blood-elf.hex2 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
--BaseAddress 0x00600000 \
|
||||
-o test/results/test21-amd64-binary \
|
||||
--exec_enable || exit 4
|
||||
|
||||
# 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/test21-amd64-binary --version 2>&1 )
|
||||
[ 0 = $? ] || exit 5
|
||||
[ "$out" = "blood-elf 0.1
|
||||
(Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6
|
||||
|
||||
. ./sha256.sh
|
||||
# Verify that the resulting file works
|
||||
./test/results/test21-amd64-binary -f test/test21/test.M1 -o test/test21/proof || exit 7
|
||||
out=$(sha256_check test/test21/proof.answer)
|
||||
[ "$out" = "test/test21/proof: OK" ] || exit 8
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,74 @@
|
|||
#! /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 -x
|
||||
# Build the test
|
||||
./bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/exit.c \
|
||||
-f test/common_amd64/functions/file.c \
|
||||
-f functions/file_print.c \
|
||||
-f test/common_amd64/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f functions/match.c \
|
||||
-f functions/in_set.c \
|
||||
-f functions/numerate_number.c \
|
||||
-f test/common_amd64/functions/stat.c \
|
||||
-f test/test22/hex2_linker.c \
|
||||
--debug \
|
||||
-o test/test22/hex2_linker.M1 || exit 1
|
||||
|
||||
# Build debug footer
|
||||
blood-elf --64 -f test/test22/hex2_linker.M1 \
|
||||
-o test/test22/hex2_linker-footer.M1 || exit 2
|
||||
|
||||
# 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/test22/hex2_linker.M1 \
|
||||
-f test/test22/hex2_linker-footer.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test22/hex2_linker.hex2 || exit 3
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64-debug.hex2 \
|
||||
-f test/test22/hex2_linker.hex2 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
--BaseAddress 0x00600000 \
|
||||
-o test/results/test22-amd64-binary \
|
||||
--exec_enable || exit 4
|
||||
|
||||
# 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/test22-amd64-binary --version 2>&1 )
|
||||
[ 0 = $? ] || exit 5
|
||||
[ "$out" = "hex2 0.3" ] || exit 6
|
||||
|
||||
. ./sha256.sh
|
||||
# Verify that the resulting file works
|
||||
./test/results/test22-amd64-binary -f test/common_x86/ELF-i386.hex2 \
|
||||
-f test/test22/test.hex2 \
|
||||
--LittleEndian \
|
||||
--architecture x86 \
|
||||
--BaseAddress 0x8048000 \
|
||||
-o test/test22/proof || exit 7
|
||||
out=$(sha256_check test/test22/proof.answer)
|
||||
[ "$out" = "test/test22/proof: OK" ] || exit 8
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,76 @@
|
|||
#! /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 -x
|
||||
# Build the test
|
||||
./bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/exit.c \
|
||||
-f test/common_amd64/functions/file.c \
|
||||
-f functions/file_print.c \
|
||||
-f test/common_amd64/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f functions/match.c \
|
||||
-f functions/in_set.c \
|
||||
-f functions/numerate_number.c \
|
||||
-f functions/string.c \
|
||||
-f test/test23/M1-macro.c \
|
||||
--debug \
|
||||
-o test/test23/M1-macro.M1 || exit 1
|
||||
|
||||
# Build debug footer
|
||||
blood-elf --64 -f test/test23/M1-macro.M1 \
|
||||
-o test/test23/M1-macro-footer.M1 || exit 2
|
||||
|
||||
# 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/test23/M1-macro.M1 \
|
||||
-f test/test23/M1-macro-footer.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test23/M1-macro.hex2 || exit 3
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64-debug.hex2 \
|
||||
-f test/test23/M1-macro.hex2 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
--BaseAddress 0x00600000 \
|
||||
-o test/results/test23-amd64-binary \
|
||||
--exec_enable || exit 4
|
||||
|
||||
# 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/test23-amd64-binary --version 2>&1 )
|
||||
[ 0 = $? ] || exit 5
|
||||
[ "$out" = "M1 0.3" ] || exit 6
|
||||
|
||||
# Verify that the resulting file works
|
||||
./test/results/test23-amd64-binary -f \
|
||||
test/common_x86/x86_defs.M1 \
|
||||
-f test/common_x86/libc-core.M1 \
|
||||
-f test/test21/test.M1 \
|
||||
--LittleEndian \
|
||||
--architecture x86 \
|
||||
-o test/test23/proof || exit 7
|
||||
|
||||
. ./sha256.sh
|
||||
out=$(sha256_check test/test23/proof.answer)
|
||||
[ "$out" = "test/test23/proof: OK" ] || exit 8
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,61 @@
|
|||
#! /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 -x
|
||||
# Build the test
|
||||
./bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/exit.c \
|
||||
-f test/common_amd64/functions/file.c \
|
||||
-f functions/file_print.c \
|
||||
-f test/common_amd64/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f test/common_amd64/functions/uname.c \
|
||||
-f functions/match.c \
|
||||
-f test/test24/get_machine.c \
|
||||
--debug \
|
||||
-o test/test24/get_machine.M1 || exit 1
|
||||
|
||||
# Build debug footer
|
||||
blood-elf --64 -f test/test24/get_machine.M1 \
|
||||
-o test/test24/get_machine-footer.M1 || exit 2
|
||||
|
||||
# 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/test24/get_machine.M1 \
|
||||
-f test/test24/get_machine-footer.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test24/get_machine.hex2 || exit 3
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64-debug.hex2 \
|
||||
-f test/test24/get_machine.hex2 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
--BaseAddress 0x00600000 \
|
||||
-o test/results/test24-amd64-binary \
|
||||
--exec_enable || exit 4
|
||||
|
||||
# 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/test24-amd64-binary ${GET_MACHINE_FLAGS} 2>&1 )
|
||||
[ 0 = $? ] || exit 5
|
||||
[ "$out" = "amd64" ] || exit 6
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,67 @@
|
|||
#! /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 -x
|
||||
# Build the test
|
||||
./bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/exit.c \
|
||||
-f test/common_amd64/functions/file.c \
|
||||
-f functions/file_print.c \
|
||||
-f test/common_amd64/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f functions/match.c \
|
||||
-f functions/in_set.c \
|
||||
-f functions/numerate_number.c \
|
||||
-f test/common_amd64/functions/fork.c \
|
||||
-f test/common_amd64/functions/execve.c \
|
||||
-f test/test25/kaem.c \
|
||||
--debug \
|
||||
-o test/test25/kaem.M1 || exit 1
|
||||
|
||||
# Build debug footer
|
||||
blood-elf --64 -f test/test25/kaem.M1 \
|
||||
-o test/test25/kaem-footer.M1 || exit 2
|
||||
|
||||
# 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/test25/kaem.M1 \
|
||||
-f test/test25/kaem-footer.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test25/kaem.hex2 || exit 3
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64-debug.hex2 \
|
||||
-f test/test25/kaem.hex2 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
--BaseAddress 0x00600000 \
|
||||
-o test/results/test25-amd64-binary \
|
||||
--exec_enable || exit 4
|
||||
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ]
|
||||
then
|
||||
# Verify that the compiled program returns the correct result
|
||||
out=$(./test/results/test25-amd64-binary --version 2>&1 )
|
||||
[ 0 = $? ] || exit 5
|
||||
[ "$out" = "kaem version 0.1" ] || exit 6
|
||||
|
||||
# Verify that the resulting file works
|
||||
out=$(./test/results/test25-amd64-binary --file test/test25/kaem.run)
|
||||
[ "$out" = "hello world" ] || exit 7
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,71 @@
|
|||
#! /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 -x
|
||||
# Build the test
|
||||
./bin/M2-Planet --architecture amd64 -f test/test26/lisp.h \
|
||||
-f test/common_amd64/functions/malloc.c \
|
||||
-f functions/calloc.c \
|
||||
-f functions/in_set.c \
|
||||
-f functions/numerate_number.c \
|
||||
-f functions/match.c \
|
||||
-f test/common_amd64/functions/file.c \
|
||||
-f functions/file_print.c \
|
||||
-f test/common_amd64/functions/exit.c \
|
||||
-f test/test26/lisp.c \
|
||||
-f test/test26/lisp_cell.c \
|
||||
-f test/test26/lisp_eval.c \
|
||||
-f test/test26/lisp_print.c \
|
||||
-f test/test26/lisp_read.c \
|
||||
--debug \
|
||||
-o test/test26/lisp.M1 || exit 1
|
||||
|
||||
# Build debug footer
|
||||
blood-elf --64 -f test/test26/lisp.M1 \
|
||||
-o test/test26/lisp-footer.M1 || exit 2
|
||||
|
||||
# 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/test26/lisp.M1 \
|
||||
-f test/test26/lisp-footer.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test26/lisp.hex2 || exit 3
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64-debug.hex2 \
|
||||
-f test/test26/lisp.hex2 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
--BaseAddress 0x00600000 \
|
||||
-o test/results/test26-amd64-binary \
|
||||
--exec_enable || exit 4
|
||||
|
||||
# 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/test26-amd64-binary --version 2>&1 )
|
||||
[ 0 = $? ] || exit 5
|
||||
[ "$out" = "Slow_Lisp 0.1" ] || exit 6
|
||||
|
||||
# Verify that the resulting file works
|
||||
out=$(./test/results/test26-amd64-binary --file test/test26/test.scm)
|
||||
[ "$out" = "42" ] || exit 7
|
||||
fi
|
||||
exit 0
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
/* Deal with the fact GCC converts the 1 to the size of the structs being iterated over */
|
||||
#define CELL_SIZE 1
|
||||
//CONSTANT CELL_SIZE 16
|
||||
//CONSTANT CELL_SIZE sizeof(struct cell)
|
||||
|
||||
struct cell *free_cells;
|
||||
struct cell *gc_block_start;
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
#! /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 amd64 \
|
||||
-f test/common_amd64/functions/putchar.c \
|
||||
-f test/common_amd64/functions/getchar.c \
|
||||
-f test/common_amd64/functions/exit.c \
|
||||
-f test/common_amd64/functions/malloc.c \
|
||||
-f test/test99/cc500.c \
|
||||
-o test/test99/cc0.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/test99/cc0.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test99/cc0.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test99/cc0.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test99-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 compiled program can compile itself
|
||||
./test/results/test99-amd64-binary < test/test99/cc500.c >| test/test99/cc1 || exit 4
|
||||
out=$(sha256_check test/test99/proof0.answer)
|
||||
[ "$out" = "test/test99/cc1: OK" ] || exit 5
|
||||
|
||||
# Make it executable
|
||||
exec_enable test/test99/cc1
|
||||
|
||||
# Verify that the result of it compiling itself can compile itself
|
||||
./test/test99/cc1 < test/test99/cc500.c >| test/test99/cc2 || exit 6
|
||||
out=$(sha256_check test/test99/proof1.answer)
|
||||
[ "$out" = "test/test99/cc2: OK" ] || exit 7
|
||||
fi
|
||||
exit 0
|
Loading…
Reference in New Issue