Remove test/common_knight/ files and switch knight-posix to M2libc
This commit is contained in:
parent
a9d88e8e6c
commit
fc4c1998aa
|
@ -1,26 +0,0 @@
|
||||||
### 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/>.
|
|
||||||
|
|
||||||
### stage0's hex2 format
|
|
||||||
### !<label> 1 byte relative
|
|
||||||
### $<label> 2 byte address
|
|
||||||
### @<label> 2 byte relative
|
|
||||||
### &<label> 4 byte address
|
|
||||||
### %<label> 4 byte relative
|
|
||||||
|
|
||||||
### if you wish to use this header, you need to add :ELF_end to the end of your
|
|
||||||
### M1 or hex2 files.
|
|
|
@ -1,24 +0,0 @@
|
||||||
/* Copyright (C) 2020 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 access(char* pathname, int mode)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"LOAD R1 R14 4"
|
|
||||||
"ACCESS");
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
/* Copyright (C) 2020 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 chdir(char* path)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"CHDIR");
|
|
||||||
}
|
|
||||||
|
|
||||||
int fchdir(int fd)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"FCHDIR");
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
/* 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 EXIT_FAILURE 1
|
|
||||||
// CONSTANT EXIT_SUCCESS 0
|
|
||||||
|
|
||||||
void exit(int value)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"EXIT");
|
|
||||||
}
|
|
|
@ -1,107 +0,0 @@
|
||||||
/* 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 R1 R14 0"
|
|
||||||
"FGETC");
|
|
||||||
}
|
|
||||||
|
|
||||||
void fputc(char s, FILE* f)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"LOAD R1 R14 4"
|
|
||||||
"FPUTC");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Important values needed for open */
|
|
||||||
// CONSTANT O_RDONLY 0
|
|
||||||
// CONSTANT O_WRONLY 1
|
|
||||||
// CONSTANT O_RDWR 2
|
|
||||||
// CONSTANT O_CREAT 64
|
|
||||||
// CONSTANT O_TRUNC 512
|
|
||||||
/* 00700 in octal is 448*/
|
|
||||||
// CONSTANT S_IRWXU 448
|
|
||||||
/* 00100 in octal is 64 */
|
|
||||||
// CONSTANT S_IXUSR 64
|
|
||||||
/* 00200 in octal is 128 */
|
|
||||||
// CONSTANT S_IWUSR 128
|
|
||||||
/* 00400 in octal is 256 */
|
|
||||||
// CONSTANT S_IRUSR 256
|
|
||||||
|
|
||||||
FILE* open(char* filename, int flag, int mode)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"LOAD R1 R14 4"
|
|
||||||
"LOAD R2 R14 8"
|
|
||||||
"FOPEN"
|
|
||||||
"FALSE R2");
|
|
||||||
}
|
|
||||||
|
|
||||||
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 fclose(FILE* stream)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"FCLOSE");
|
|
||||||
}
|
|
||||||
|
|
||||||
int fflush(FILE *stream){
|
|
||||||
/* We don't buffer, nothing to flush */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CONSTANT SEEK_SET 0
|
|
||||||
// CONSTANT SEEK_CUR 1
|
|
||||||
// CONSTANT SEEK_END 2
|
|
||||||
|
|
||||||
int fseek(FILE* f, long offset, int whence)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"LOAD R1 R14 4"
|
|
||||||
"LOAD R2 R14 8"
|
|
||||||
"FSEEK"
|
|
||||||
"FALSE R2");
|
|
||||||
}
|
|
||||||
|
|
||||||
void rewind(FILE* f)
|
|
||||||
{
|
|
||||||
fseek(f, 0, SEEK_SET);
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
/* 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("LOADUI R1 0"
|
|
||||||
"FGETC");
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
/* Copyright (C) 2020 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include<stdlib.h>
|
|
||||||
//CONSTANT PATH_MAX 4096
|
|
||||||
#define PATH_MAX 4096
|
|
||||||
|
|
||||||
int _getcwd(char* buf, size_t size)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"LOAD R1 R14 4"
|
|
||||||
"GETCWD");
|
|
||||||
}
|
|
||||||
|
|
||||||
char* getcwd(char* buf, size_t size)
|
|
||||||
{
|
|
||||||
int c = _getcwd(buf, size);
|
|
||||||
if(0 == c) return NULL;
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* getwd(char* buf)
|
|
||||||
{
|
|
||||||
return getcwd(buf, PATH_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* get_current_dir_name()
|
|
||||||
{
|
|
||||||
return getcwd(malloc(PATH_MAX), PATH_MAX);
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
/* 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 NULL 0
|
|
||||||
|
|
||||||
void* malloc(int size)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"ADDU R0 R12 R0"
|
|
||||||
"SWAP R0 R12");
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
/* 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 putchar(int c)
|
|
||||||
{
|
|
||||||
asm("LOAD R0 R14 0"
|
|
||||||
"LOADUI R1 1"
|
|
||||||
"FPUTC");
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/* 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 R0 R14 0"
|
|
||||||
"LOAD R1 R14 4"
|
|
||||||
"CHMOD");
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/* 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 R0 R14 0"
|
|
||||||
"UNAME");
|
|
||||||
}
|
|
|
@ -1,266 +0,0 @@
|
||||||
## Copyright (C) 2016 Jeremiah Orians
|
|
||||||
## This file is part of stage0.
|
|
||||||
##
|
|
||||||
## stage0 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.
|
|
||||||
##
|
|
||||||
## stage0 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 stage0. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#Registers
|
|
||||||
DEFINE R0 0
|
|
||||||
DEFINE R1 1
|
|
||||||
DEFINE R2 2
|
|
||||||
DEFINE R3 3
|
|
||||||
DEFINE R4 4
|
|
||||||
DEFINE R5 5
|
|
||||||
DEFINE R6 6
|
|
||||||
DEFINE R7 7
|
|
||||||
DEFINE R8 8
|
|
||||||
DEFINE R9 9
|
|
||||||
DEFINE R10 A
|
|
||||||
DEFINE R11 B
|
|
||||||
DEFINE R12 C
|
|
||||||
DEFINE R13 D
|
|
||||||
DEFINE R14 E
|
|
||||||
DEFINE R15 F
|
|
||||||
|
|
||||||
# 4OP Integer Group
|
|
||||||
DEFINE ADD.CI 0100
|
|
||||||
DEFINE ADD.CO 0101
|
|
||||||
DEFINE ADD.CIO 0102
|
|
||||||
DEFINE ADDU.CI 0103
|
|
||||||
DEFINE ADDU.CO 0104
|
|
||||||
DEFINE ADDU.CIO 0105
|
|
||||||
DEFINE SUB.BI 0106
|
|
||||||
DEFINE SUB.BO 0107
|
|
||||||
DEFINE SUB.BIO 0108
|
|
||||||
DEFINE SUBU.BI 0109
|
|
||||||
DEFINE SUBU.BO 010A
|
|
||||||
DEFINE SUBU.BIO 010B
|
|
||||||
DEFINE MULTIPLY 010C
|
|
||||||
DEFINE MULTIPLYU 010D
|
|
||||||
DEFINE DIVIDE 010E
|
|
||||||
DEFINE DIVIDEU 010F
|
|
||||||
DEFINE MUX 0110
|
|
||||||
DEFINE NMUX 0111
|
|
||||||
DEFINE SORT 0112
|
|
||||||
DEFINE SORTU 0113
|
|
||||||
|
|
||||||
# 3OP Integer Group
|
|
||||||
DEFINE ADD 05000
|
|
||||||
DEFINE ADDU 05001
|
|
||||||
DEFINE SUB 05002
|
|
||||||
DEFINE SUBU 05003
|
|
||||||
DEFINE CMP 05004
|
|
||||||
DEFINE CMPU 05005
|
|
||||||
DEFINE MUL 05006
|
|
||||||
DEFINE MULH 05007
|
|
||||||
DEFINE MULU 05008
|
|
||||||
DEFINE MULUH 05009
|
|
||||||
DEFINE DIV 0500A
|
|
||||||
DEFINE MOD 0500B
|
|
||||||
DEFINE DIVU 0500C
|
|
||||||
DEFINE MODU 0500D
|
|
||||||
DEFINE MAX 05010
|
|
||||||
DEFINE MAXU 05011
|
|
||||||
DEFINE MIN 05012
|
|
||||||
DEFINE MINU 05013
|
|
||||||
DEFINE AND 05020
|
|
||||||
DEFINE OR 05021
|
|
||||||
DEFINE XOR 05022
|
|
||||||
DEFINE NAND 05023
|
|
||||||
DEFINE NOR 05024
|
|
||||||
DEFINE XNOR 05025
|
|
||||||
DEFINE MPQ 05026
|
|
||||||
DEFINE LPQ 05027
|
|
||||||
DEFINE CPQ 05028
|
|
||||||
DEFINE BPQ 05029
|
|
||||||
DEFINE SAL 05030
|
|
||||||
DEFINE SAR 05031
|
|
||||||
DEFINE SL0 05032
|
|
||||||
DEFINE SR0 05033
|
|
||||||
DEFINE SL1 05034
|
|
||||||
DEFINE SR1 05035
|
|
||||||
DEFINE ROL 05036
|
|
||||||
DEFINE ROR 05037
|
|
||||||
DEFINE LOADX 05038
|
|
||||||
DEFINE LOADX8 05039
|
|
||||||
DEFINE LOADXU8 0503A
|
|
||||||
DEFINE LOADX16 0503B
|
|
||||||
DEFINE LOADXU16 0503C
|
|
||||||
DEFINE LOADX32 0503D
|
|
||||||
DEFINE LOADXU32 0503E
|
|
||||||
DEFINE STOREX 05048
|
|
||||||
DEFINE STOREX8 05049
|
|
||||||
DEFINE STOREX16 0504A
|
|
||||||
DEFINE STOREX32 0504B
|
|
||||||
DEFINE CMPJUMP.G 05050
|
|
||||||
DEFINE CMPJUMP.GE 05051
|
|
||||||
DEFINE CMPJUMP.E 05052
|
|
||||||
DEFINE CMPJUMP.NE 05053
|
|
||||||
DEFINE CMPJUMP.LE 05054
|
|
||||||
DEFINE CMPJUMP.L 05055
|
|
||||||
DEFINE CMPJUMPU.G 05060
|
|
||||||
DEFINE CMPJUMPU.GE 05061
|
|
||||||
DEFINE CMPJUMPU.LE 05064
|
|
||||||
DEFINE CMPJUMPU.L 05065
|
|
||||||
|
|
||||||
# 2OP Integer Group
|
|
||||||
DEFINE NEG 090000
|
|
||||||
DEFINE ABS 090001
|
|
||||||
DEFINE NABS 090002
|
|
||||||
DEFINE SWAP 090003
|
|
||||||
DEFINE COPY 090004
|
|
||||||
DEFINE MOVE 090005
|
|
||||||
DEFINE NOT 090006
|
|
||||||
DEFINE BRANCH 090100
|
|
||||||
DEFINE CALL 090101
|
|
||||||
DEFINE PUSHR 090200
|
|
||||||
DEFINE PUSH8 090201
|
|
||||||
DEFINE PUSH16 090202
|
|
||||||
DEFINE PUSH32 090203
|
|
||||||
DEFINE POPR 090280
|
|
||||||
DEFINE POP8 090281
|
|
||||||
DEFINE POPU8 090282
|
|
||||||
DEFINE POP16 090283
|
|
||||||
DEFINE POPU16 090284
|
|
||||||
DEFINE POP32 090285
|
|
||||||
DEFINE POPU32 090286
|
|
||||||
DEFINE CMPSKIP.G 090300
|
|
||||||
DEFINE CMPSKIP.GE 090301
|
|
||||||
DEFINE CMPSKIP.E 090302
|
|
||||||
DEFINE CMPSKIP.NE 090303
|
|
||||||
DEFINE CMPSKIP.LE 090304
|
|
||||||
DEFINE CMPSKIP.L 090305
|
|
||||||
DEFINE CMPSKIPU.G 090380
|
|
||||||
DEFINE CMPSKIPU.GE 090381
|
|
||||||
DEFINE CMPSKIPU.LE 090384
|
|
||||||
DEFINE CMPSKIPU.L 090385
|
|
||||||
|
|
||||||
# 1OP Group
|
|
||||||
DEFINE READPC 0D00000
|
|
||||||
DEFINE READSCID 0D00001
|
|
||||||
DEFINE FALSE 0D00002
|
|
||||||
DEFINE TRUE 0D00003
|
|
||||||
DEFINE JSR_COROUTINE 0D01000
|
|
||||||
DEFINE RET 0D01001
|
|
||||||
DEFINE PUSHPC 0D02000
|
|
||||||
DEFINE POPPC 0D02001
|
|
||||||
|
|
||||||
# 2OPI Group
|
|
||||||
DEFINE SET.G E10000
|
|
||||||
DEFINE SET.GE E10001
|
|
||||||
DEFINE SET.E E10002
|
|
||||||
DEFINE SET.NE E10003
|
|
||||||
DEFINE SET.LE E10004
|
|
||||||
DEFINE SET.L E10005
|
|
||||||
DEFINE ADDI E1000E
|
|
||||||
DEFINE ADDUI E1000F
|
|
||||||
DEFINE SUBI E10010
|
|
||||||
DEFINE SUBUI E10011
|
|
||||||
DEFINE CMPI E10012
|
|
||||||
DEFINE LOAD E10013
|
|
||||||
DEFINE LOAD8 E10014
|
|
||||||
DEFINE LOADU8 E10015
|
|
||||||
DEFINE LOAD16 E10016
|
|
||||||
DEFINE LOADU16 E10017
|
|
||||||
DEFINE LOAD32 E10018
|
|
||||||
DEFINE LOADU32 E10019
|
|
||||||
DEFINE CMPUI E1001F
|
|
||||||
DEFINE STORE E10020
|
|
||||||
DEFINE STORE8 E10021
|
|
||||||
DEFINE STORE16 E10022
|
|
||||||
DEFINE STORE32 E10023
|
|
||||||
DEFINE ANDI E100B0
|
|
||||||
DEFINE ORI E100B1
|
|
||||||
DEFINE XORI E100B2
|
|
||||||
DEFINE NANDI E100B3
|
|
||||||
DEFINE NORI E100B4
|
|
||||||
DEFINE XNORI E100B5
|
|
||||||
DEFINE CMPJUMPI.G E100C0
|
|
||||||
DEFINE CMPJUMPI.GE E100C1
|
|
||||||
DEFINE CMPJUMPI.E E100C2
|
|
||||||
DEFINE CMPJUMPI.NE E100C3
|
|
||||||
DEFINE CMPJUMPI.LE E100C4
|
|
||||||
DEFINE CMPJUMPI.L E100C5
|
|
||||||
DEFINE CMPJUMPUI.G E100D0
|
|
||||||
DEFINE CMPJUMPUI.GE E100D1
|
|
||||||
DEFINE CMPJUMPUI.LE E100D4
|
|
||||||
DEFINE CMPJUMPUI.L E100D5
|
|
||||||
|
|
||||||
# 1OPI Group
|
|
||||||
DEFINE JUMP.C E0002C0
|
|
||||||
DEFINE JUMP.B E0002C1
|
|
||||||
DEFINE JUMP.O E0002C2
|
|
||||||
DEFINE JUMP.G E0002C3
|
|
||||||
DEFINE JUMP.GE E0002C4
|
|
||||||
DEFINE JUMP.E E0002C5
|
|
||||||
DEFINE JUMP.NE E0002C6
|
|
||||||
DEFINE JUMP.LE E0002C7
|
|
||||||
DEFINE JUMP.L E0002C8
|
|
||||||
DEFINE JUMP.Z E0002C9
|
|
||||||
DEFINE JUMP.NZ E0002CA
|
|
||||||
DEFINE JUMP.P E0002CB
|
|
||||||
DEFINE JUMP.NP E0002CC
|
|
||||||
DEFINE CALLI E0002D0
|
|
||||||
DEFINE LOADI E0002D1
|
|
||||||
DEFINE LOADUI E0002D2
|
|
||||||
DEFINE SALI E0002D3
|
|
||||||
DEFINE SARI E0002D4
|
|
||||||
DEFINE SL0I E0002D5
|
|
||||||
DEFINE SR0I E0002D6
|
|
||||||
DEFINE SL1I E0002D7
|
|
||||||
DEFINE SR1I E0002D8
|
|
||||||
DEFINE LOADR E0002E0
|
|
||||||
DEFINE LOADR8 E0002E1
|
|
||||||
DEFINE LOADRU8 E0002E2
|
|
||||||
DEFINE LOADR16 E0002E3
|
|
||||||
DEFINE LOADRU16 E0002E4
|
|
||||||
DEFINE LOADR32 E0002E5
|
|
||||||
DEFINE LOADRU32 E0002E6
|
|
||||||
DEFINE STORER E0002F0
|
|
||||||
DEFINE STORER8 E0002F1
|
|
||||||
DEFINE STORER16 E0002F2
|
|
||||||
DEFINE STORER32 E0002F3
|
|
||||||
DEFINE CMPSKIPI.G E000A00
|
|
||||||
DEFINE CMPSKIPI.GE E000A01
|
|
||||||
DEFINE CMPSKIPI.E E000A02
|
|
||||||
DEFINE CMPSKIPI.NE E000A03
|
|
||||||
DEFINE CMPSKIPI.LE E000A04
|
|
||||||
DEFINE CMPSKIPI.L E000A05
|
|
||||||
DEFINE CMPSKIPUI.G E000A10
|
|
||||||
DEFINE CMPSKIPUI.GE E000A11
|
|
||||||
DEFINE CMPSKIPUI.LE E000A14
|
|
||||||
DEFINE CMPSKIPUI.L E000A15
|
|
||||||
|
|
||||||
# 0OPI Group
|
|
||||||
DEFINE JUMP 3C00
|
|
||||||
|
|
||||||
# HALCODE Group
|
|
||||||
DEFINE FOPEN 42000002
|
|
||||||
DEFINE FCLOSE 42000003
|
|
||||||
DEFINE FSEEK 42000008
|
|
||||||
DEFINE ACCESS 42000015
|
|
||||||
DEFINE EXIT 4200003C
|
|
||||||
DEFINE UNAME 4200003F
|
|
||||||
DEFINE GETCWD 4200004F
|
|
||||||
DEFINE CHDIR 42000050
|
|
||||||
DEFINE FCHDIR 42000051
|
|
||||||
DEFINE CHMOD 4200005A
|
|
||||||
DEFINE FGETC 42100100
|
|
||||||
DEFINE FPUTC 42100200
|
|
||||||
|
|
||||||
# 0OP Group
|
|
||||||
DEFINE NOP 00000000
|
|
||||||
DEFINE HALT FFFFFFFF
|
|
||||||
|
|
||||||
# M2-Planet Standard
|
|
||||||
DEFINE NULL 00000000
|
|
|
@ -1,33 +0,0 @@
|
||||||
## 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/>.
|
|
||||||
|
|
||||||
:_start
|
|
||||||
;; Kernel Setup R12 as HEAP pointer after end of the stack
|
|
||||||
;; 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
|
|
||||||
LOADR R0 4
|
|
||||||
JUMP 4
|
|
||||||
&FUNCTION_main
|
|
||||||
CALL R0 R15
|
|
||||||
|
|
||||||
;; Exit to kernel
|
|
||||||
EXIT ; Return what is in R0
|
|
|
@ -182,5 +182,5 @@ ba2e2e1bbe66fea15d5984678175229fcb0adc6faa394be2cfde8bea1d3026de test/results/t
|
||||||
034a085bc57ce50806b126614a2b0756630568e1f17165364482a5386f7e0e11 test/results/test1000-aarch64-binary
|
034a085bc57ce50806b126614a2b0756630568e1f17165364482a5386f7e0e11 test/results/test1000-aarch64-binary
|
||||||
5cb4bcb5eba5bef9869d8b29c58269019f6acad2e65cd6f1bcf0567ef157bf46 test/results/test1000-amd64-binary
|
5cb4bcb5eba5bef9869d8b29c58269019f6acad2e65cd6f1bcf0567ef157bf46 test/results/test1000-amd64-binary
|
||||||
0c03746a3e963815ae9723649d289102b8eee9ecbc96d455b85f7f687c5953be test/results/test1000-armv7l-binary
|
0c03746a3e963815ae9723649d289102b8eee9ecbc96d455b85f7f687c5953be test/results/test1000-armv7l-binary
|
||||||
f384c9d740cf4645c6bb4e64b54ced79fc12765362bb8a8c4d9979a8f2e0f45d test/results/test1000-knight-posix-binary
|
3ca7e7adfeacc965d34bda0f7ec5b1ce3457cbda3475c3406deafb768568d7c0 test/results/test1000-knight-posix-binary
|
||||||
8fbde579279c7c7a00601ac574468cebe67d9f807ea83a02b00b5496c0d70609 test/results/test1000-x86-binary
|
8fbde579279c7c7a00601ac574468cebe67d9f807ea83a02b00b5496c0d70609 test/results/test1000-x86-binary
|
||||||
|
|
|
@ -49,7 +49,12 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
vm --POSIX-MODE --rom test/results/test0000-knight-posix-binary --memory 2M
|
||||||
|
[ 42 = $? ] || exit 3
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
./test/results/test0000-knight-posix-binary
|
./test/results/test0000-knight-posix-binary
|
||||||
|
|
|
@ -53,7 +53,13 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
out=$(vm --POSIX-MODE --rom test/results/test0001-knight-posix-binary --memory 2M)
|
||||||
|
[ 42 = $? ] || exit 3
|
||||||
|
[ "$out" = "Hello mes" ] || exit 4
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0001-knight-posix-binary 2>&1)
|
out=$(./test/results/test0001-knight-posix-binary 2>&1)
|
||||||
|
|
|
@ -53,7 +53,13 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
out=$(vm --POSIX-MODE --rom test/results/test0002-knight-posix-binary --memory 2M)
|
||||||
|
[ 42 = $? ] || exit 4
|
||||||
|
[ "$out" = "Hello mes" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0002-knight-posix-binary 2>&1 )
|
out=$(./test/results/test0002-knight-posix-binary 2>&1 )
|
||||||
|
|
|
@ -53,7 +53,13 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
out=$(vm --POSIX-MODE --rom test/results/test0003-knight-posix-binary --memory 2M)
|
||||||
|
[ 42 = $? ] || exit 3
|
||||||
|
[ "$out" = "Hello mes" ] || exit 4
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0003-knight-posix-binary 2>&1 )
|
out=$(./test/results/test0003-knight-posix-binary 2>&1 )
|
||||||
|
|
|
@ -53,7 +53,13 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
out=$(vm --POSIX-MODE --rom test/results/test0004-knight-posix-binary --memory 2M)
|
||||||
|
[ 42 = $? ] || exit 4
|
||||||
|
[ "$out" = "Hello mes" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0004-knight-posix-binary 2>&1 )
|
out=$(./test/results/test0004-knight-posix-binary 2>&1 )
|
||||||
|
|
|
@ -53,7 +53,13 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
out=$(vm --POSIX-MODE --rom test/results/test0005-knight-posix-binary --memory 2M)
|
||||||
|
[ 42 = $? ] || exit 3
|
||||||
|
[ "$out" = "Hello mes" ] || exit 4
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0005-knight-posix-binary 2>&1 )
|
out=$(./test/results/test0005-knight-posix-binary 2>&1 )
|
||||||
|
|
|
@ -53,7 +53,14 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
vm --POSIX-MODE --rom test/results/test0006-knight-posix-binary --memory 2M >| test/test0006/proof || exit 4
|
||||||
|
out=$(sha256_check test/test0006/proof.answer)
|
||||||
|
[ "$out" = "test/test0006/proof: OK" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
|
|
@ -53,7 +53,14 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
vm --POSIX-MODE --rom test/results/test0007-knight-posix-binary --memory 2M >| test/test0007/proof || exit 4
|
||||||
|
out=$(sha256_check test/test0007/proof.answer)
|
||||||
|
[ "$out" = "test/test0007/proof: OK" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
|
|
@ -53,7 +53,13 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
out=$(vm --POSIX-MODE --rom test/results/test0008-knight-posix-binary --memory 2M)
|
||||||
|
[ 16 = $? ] || exit 4
|
||||||
|
[ "$out" = "35419896642975313541989657891634" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0008-knight-posix-binary 2>&1 )
|
out=$(./test/results/test0008-knight-posix-binary 2>&1 )
|
||||||
|
|
|
@ -53,7 +53,13 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
out=$(vm --POSIX-MODE --rom test/results/test0009-knight-posix-binary --memory 2M)
|
||||||
|
[ 42 = $? ] || exit 4
|
||||||
|
[ "$out" = "Hello mes" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0009-knight-posix-binary 2>&1 )
|
out=$(./test/results/test0009-knight-posix-binary 2>&1 )
|
||||||
|
|
|
@ -53,7 +53,13 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
out=$(vm --POSIX-MODE --rom test/results/test0010-knight-posix-binary --memory 2M)
|
||||||
|
[ 12 = $? ] || exit 4
|
||||||
|
[ "$out" = "35419896642975313541989657891634" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0010-knight-posix-binary 2>&1 )
|
out=$(./test/results/test0010-knight-posix-binary 2>&1 )
|
||||||
|
|
|
@ -53,7 +53,15 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
vm --POSIX-MODE --rom test/results/test0011-knight-posix-binary --memory 2M >| test/test0011/proof || exit 4
|
||||||
|
out=$(sha256_check test/test0011/proof.answer)
|
||||||
|
[ "$out" = "test/test0011/proof: OK" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
|
|
@ -53,7 +53,15 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
vm --POSIX-MODE --rom test/results/test0012-knight-posix-binary --memory 2M >| test/test0012/proof || exit 4
|
||||||
|
out=$(sha256_check test/test0012/proof.answer)
|
||||||
|
[ "$out" = "test/test0012/proof: OK" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
|
|
@ -53,7 +53,15 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
vm --POSIX-MODE --rom test/results/test0013-knight-posix-binary --memory 2M >| test/test0013/proof || exit 4
|
||||||
|
out=$(sha256_check test/test0013/proof.answer)
|
||||||
|
[ "$out" = "test/test0013/proof: OK" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
|
|
@ -53,12 +53,36 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
./test/results/test0014-knight-posix-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test0014/proof || exit 4
|
execve_image \
|
||||||
|
./test/results/test0014-knight-posix-binary \
|
||||||
|
314 \
|
||||||
|
1 \
|
||||||
|
5926 \
|
||||||
|
5 \
|
||||||
|
35897 \
|
||||||
|
932384626 \
|
||||||
|
43 \
|
||||||
|
383279 \
|
||||||
|
50288 \
|
||||||
|
419 \
|
||||||
|
71693 \
|
||||||
|
99375105 \
|
||||||
|
820974944 \
|
||||||
|
>| ${TMPDIR}/image || exit 4
|
||||||
|
vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M >| test/test0014/proof || exit 5
|
||||||
out=$(sha256_check test/test0014/proof-knight-posix.answer)
|
out=$(sha256_check test/test0014/proof-knight-posix.answer)
|
||||||
[ "$out" = "test/test0014/proof: OK" ] || exit 5
|
[ "$out" = "test/test0014/proof: OK" ] || exit 6
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
./test/results/test0014-knight-posix-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test0014/proof || exit 5
|
||||||
|
out=$(sha256_check test/test0014/proof-knight-posix.answer)
|
||||||
|
[ "$out" = "test/test0014/proof: OK" ] || exit 6
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -53,12 +53,24 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "Knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
./test/results/test0015-knight-posix-binary test/test0015/file_read.c >| test/test0015/proof || exit 4
|
execve_image \
|
||||||
|
./test/results/test0015-knight-posix-binary \
|
||||||
|
test/test0015/file_read.c \
|
||||||
|
>| ${TMPDIR}/image || exit 4
|
||||||
|
vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M >| test/test0015/proof || exit 5
|
||||||
out=$(sha256_check test/test0015/proof.answer)
|
out=$(sha256_check test/test0015/proof.answer)
|
||||||
[ "$out" = "test/test0015/proof: OK" ] || exit 5
|
[ "$out" = "test/test0015/proof: OK" ] || exit 6
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "Knight" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
./test/results/test0015-knight-posix-binary test/test0015/file_read.c >| test/test0015/proof || exit 5
|
||||||
|
out=$(sha256_check test/test0015/proof.answer)
|
||||||
|
[ "$out" = "test/test0015/proof: OK" ] || exit 6
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -53,12 +53,24 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
./test/results/test0016-knight-posix-binary test/test0016/proof || exit 4
|
execve_image \
|
||||||
|
./test/results/test0016-knight-posix-binary \
|
||||||
|
test/test0016/proof \
|
||||||
|
>| ${TMPDIR}/image || exit 4
|
||||||
|
vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M || exit 5
|
||||||
out=$(sha256_check test/test0016/proof.answer)
|
out=$(sha256_check test/test0016/proof.answer)
|
||||||
[ "$out" = "test/test0016/proof: OK" ] || exit 5
|
[ "$out" = "test/test0016/proof: OK" ] || exit 6
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
./test/results/test0016-knight-posix-binary test/test0016/proof || exit 5
|
||||||
|
out=$(sha256_check test/test0016/proof.answer)
|
||||||
|
[ "$out" = "test/test0016/proof: OK" ] || exit 6
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -53,7 +53,15 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
vm --POSIX-MODE --rom ./test/results/test0017-knight-posix-binary --memory 2M >| test/test0017/proof || exit 4
|
||||||
|
out=$(sha256_check test/test0017/proof.answer)
|
||||||
|
[ "$out" = "test/test0017/proof: OK" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
|
|
@ -53,7 +53,15 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
vm --POSIX-MODE --rom ./test/results/test0018-knight-posix-binary --memory 2M >| test/test0018/proof || exit 4
|
||||||
|
out=$(sha256_check test/test0018/proof.answer)
|
||||||
|
[ "$out" = "test/test0018/proof: OK" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
|
|
@ -57,12 +57,25 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
./test/results/test0019-knight-posix-binary -f test/test0019/input -o test/test0019/proof || exit 4
|
execve_image \
|
||||||
|
./test/results/test0019-knight-posix-binary \
|
||||||
|
-f test/test0019/input \
|
||||||
|
-o test/test0019/proof \
|
||||||
|
>| ${TMPDIR}/image || exit 4
|
||||||
|
vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M || exit 5
|
||||||
out=$(sha256_check test/test0019/proof.answer)
|
out=$(sha256_check test/test0019/proof.answer)
|
||||||
[ "$out" = "test/test0019/proof: OK" ] || exit 5
|
[ "$out" = "test/test0019/proof: OK" ] || exit 6
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
./test/results/test0019-knight-posix-binary -f test/test0019/input -o test/test0019/proof || exit 5
|
||||||
|
out=$(sha256_check test/test0019/proof.answer)
|
||||||
|
[ "$out" = "test/test0019/proof: OK" ] || exit 6
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -53,7 +53,14 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
# Verify that the resulting file works
|
||||||
|
out=$(vm --POSIX-MODE --rom ./test/results/test0020-knight-posix-binary --memory 2M)
|
||||||
|
[ 20 = $? ] || exit 4
|
||||||
|
[ "$out" = "35419896642975313541989657891634" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0020-knight-posix-binary 2>&1 )
|
out=$(./test/results/test0020-knight-posix-binary 2>&1 )
|
||||||
|
|
|
@ -55,7 +55,14 @@ hex2 \
|
||||||
|| exit 4
|
|| exit 4
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
vm --POSIX-MODE --rom ./test/results/test0021-knight-posix-binary --memory 2M
|
||||||
|
[ 0 = $? ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
|
|
@ -56,7 +56,16 @@ hex2 \
|
||||||
|| exit 4
|
|| exit 4
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
vm --POSIX-MODE --rom ./test/results/test0022-knight-posix-binary --memory 2M >| test/test0022/proof
|
||||||
|
[ 0 = $? ] || exit 5
|
||||||
|
out=$(sha256_check test/test0022/proof.answer)
|
||||||
|
[ "$out" = "test/test0022/proof: OK" ] || exit 6
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
|
|
@ -53,7 +53,20 @@ hex2 \
|
||||||
|| exit 4
|
|| exit 4
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
execve_image \
|
||||||
|
./test/results/test0023-knight-posix-binary \
|
||||||
|
test/test0023/question \
|
||||||
|
>| ${TMPDIR}/image || exit 4
|
||||||
|
vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M >| test/test0023/proof
|
||||||
|
[ 0 = $? ] || exit 5
|
||||||
|
out=$(sha256_check test/test0023/proof.answer)
|
||||||
|
[ "$out" = "test/test0023/proof: OK" ] || exit 6
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
|
|
@ -49,7 +49,13 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
# Verify that the resulting file works
|
||||||
|
vm --POSIX-MODE --rom ./test/results/test0024-knight-posix-binary --memory 2M
|
||||||
|
[ 42 = $? ] || exit 3
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
./test/results/test0024-knight-posix-binary
|
./test/results/test0024-knight-posix-binary
|
||||||
|
|
|
@ -55,18 +55,41 @@ hex2 \
|
||||||
|| exit 4
|
|| exit 4
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
# Verify that the resulting file works
|
||||||
|
execve_image \
|
||||||
|
./test/results/test0100-knight-posix-binary \
|
||||||
|
--version \
|
||||||
|
>| ${TMPDIR}/image || exit 5
|
||||||
|
out=$(vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M)
|
||||||
|
[ 0 = $? ] || exit 6
|
||||||
|
[ "$out" = "blood-elf 0.1
|
||||||
|
(Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 7
|
||||||
|
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
execve_image \
|
||||||
|
./test/results/test0100-knight-posix-binary \
|
||||||
|
-f test/test0100/test.M1 \
|
||||||
|
-o test/test0100/proof \
|
||||||
|
>| ${TMPDIR}/image || exit 8
|
||||||
|
vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M || exit 9
|
||||||
|
out=$(sha256_check test/test0100/proof.answer)
|
||||||
|
[ "$out" = "test/test0100/proof: OK" ] || exit 10
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0100-knight-posix-binary --version 2>&1 )
|
out=$(./test/results/test0100-knight-posix-binary --version 2>&1 )
|
||||||
[ 0 = $? ] || exit 5
|
[ 0 = $? ] || exit 5
|
||||||
[ "$out" = "blood-elf 0.1
|
[ "$out" = "blood-elf 0.1
|
||||||
(Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6
|
(Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 7
|
||||||
|
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
./test/results/test0100-knight-posix-binary -f test/test0100/test.M1 -o test/test0100/proof || exit 7
|
./test/results/test0100-knight-posix-binary -f test/test0100/test.M1 -o test/test0100/proof || exit 9
|
||||||
out=$(sha256_check test/test0100/proof.answer)
|
out=$(sha256_check test/test0100/proof.answer)
|
||||||
[ "$out" = "test/test0100/proof: OK" ] || exit 8
|
[ "$out" = "test/test0100/proof: OK" ] || exit 10
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -57,12 +57,38 @@ hex2 \
|
||||||
|| exit 4
|
|| exit 4
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
# Verify that the compiled program returns the correct result
|
||||||
|
execve_image \
|
||||||
|
./test/results/test0101-knight-posix-binary \
|
||||||
|
--version \
|
||||||
|
>| ${TMPDIR}/image || exit 5
|
||||||
|
out=$(vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M)
|
||||||
|
[ 0 = $? ] || exit 6
|
||||||
|
[ "$out" = "hex2 0.3" ] || exit 7
|
||||||
|
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
execve_image \
|
||||||
|
./test/results/test0101-knight-posix-binary \
|
||||||
|
-f test/common_x86/ELF-i386.hex2 \
|
||||||
|
-f test/test0101/test.hex2 \
|
||||||
|
--LittleEndian \
|
||||||
|
--architecture x86 \
|
||||||
|
--BaseAddress 0x8048000 \
|
||||||
|
-o test/test0101/proof \
|
||||||
|
>| ${TMPDIR}/image || exit 8
|
||||||
|
vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M || exit 9
|
||||||
|
out=$(sha256_check test/test0101/proof.answer)
|
||||||
|
[ "$out" = "test/test0101/proof: OK" ] || exit 10
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0101-knight-posix-binary --version 2>&1 )
|
out=$(./test/results/test0101-knight-posix-binary --version 2>&1 )
|
||||||
[ 0 = $? ] || exit 5
|
[ 0 = $? ] || exit 6
|
||||||
[ "$out" = "hex2 0.3" ] || exit 6
|
[ "$out" = "hex2 0.3" ] || exit 7
|
||||||
|
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
|
@ -73,8 +99,8 @@ then
|
||||||
--architecture x86 \
|
--architecture x86 \
|
||||||
--BaseAddress 0x8048000 \
|
--BaseAddress 0x8048000 \
|
||||||
-o test/test0101/proof \
|
-o test/test0101/proof \
|
||||||
|| exit 7
|
|| exit 9
|
||||||
out=$(sha256_check test/test0101/proof.answer)
|
out=$(sha256_check test/test0101/proof.answer)
|
||||||
[ "$out" = "test/test0101/proof: OK" ] || exit 8
|
[ "$out" = "test/test0101/proof: OK" ] || exit 10
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -59,12 +59,39 @@ hex2 \
|
||||||
|| exit 4
|
|| exit 4
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
# Verify that the compiled program returns the correct result
|
||||||
|
execve_image \
|
||||||
|
./test/results/test0102-knight-posix-binary \
|
||||||
|
--version \
|
||||||
|
>| ${TMPDIR}/image || exit 5
|
||||||
|
out=$(vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M)
|
||||||
|
[ 0 = $? ] || exit 6
|
||||||
|
[ "$out" = "M1 1.0.0" ] || exit 7
|
||||||
|
|
||||||
|
# Verify that the resulting file works
|
||||||
|
execve_image \
|
||||||
|
./test/results/test0102-knight-posix-binary \
|
||||||
|
-f test/common_x86/x86_defs.M1 \
|
||||||
|
-f test/common_x86/libc-core.M1 \
|
||||||
|
-f test/test0100/test.M1 \
|
||||||
|
--little-endian \
|
||||||
|
--architecture x86 \
|
||||||
|
-o test/test0102/proof \
|
||||||
|
>| ${TMPDIR}/image || exit 8
|
||||||
|
vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M || exit 9
|
||||||
|
|
||||||
|
. ./sha256.sh
|
||||||
|
out=$(sha256_check test/test0102/proof.answer)
|
||||||
|
[ "$out" = "test/test0102/proof: OK" ] || exit 8
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0102-knight-posix-binary --version 2>&1 )
|
out=$(./test/results/test0102-knight-posix-binary --version 2>&1 )
|
||||||
[ 0 = $? ] || exit 5
|
[ 0 = $? ] || exit 6
|
||||||
[ "$out" = "M1 1.0.0" ] || exit 6
|
[ "$out" = "M1 1.0.0" ] || exit 7
|
||||||
|
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
./test/results/test0102-knight-posix-binary \
|
./test/results/test0102-knight-posix-binary \
|
||||||
|
@ -74,7 +101,7 @@ then
|
||||||
--little-endian \
|
--little-endian \
|
||||||
--architecture x86 \
|
--architecture x86 \
|
||||||
-o test/test0102/proof \
|
-o test/test0102/proof \
|
||||||
|| exit 7
|
|| exit 9
|
||||||
|
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
out=$(sha256_check test/test0102/proof.answer)
|
out=$(sha256_check test/test0102/proof.answer)
|
||||||
|
|
|
@ -55,11 +55,22 @@ hex2 \
|
||||||
|| exit 4
|
|| exit 4
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
# Verify that the resulting file works
|
||||||
|
execve_image \
|
||||||
|
./test/results/test0103-knight-posix-binary \
|
||||||
|
${GET_MACHINE_FLAGS} \
|
||||||
|
>| ${TMPDIR}/image || exit 5
|
||||||
|
out=$(vm --POSIX-MODE --rom ${TMPDIR}/image --memory 2M)
|
||||||
|
[ 0 = $? ] || exit 6
|
||||||
|
[ "$out" = "knight" ] || exit 7
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the compiled program returns the correct result
|
# Verify that the compiled program returns the correct result
|
||||||
out=$(./test/results/test0103-knight-posix-binary ${GET_MACHINE_FLAGS} 2>&1 )
|
out=$(./test/results/test0103-knight-posix-binary ${GET_MACHINE_FLAGS} 2>&1 )
|
||||||
[ 0 = $? ] || exit 5
|
[ 0 = $? ] || exit 6
|
||||||
[ "$out" = "knight*" ] || exit 6
|
[ "$out" = "knight" ] || exit 7
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -53,11 +53,19 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
. ./sha256.sh
|
||||||
|
# Verify that the resulting file works
|
||||||
|
vm --POSIX-MODE --rom ./test/results/test0106-knight-posix-binary --memory 2M < test/test0106/cc500.c >| test/test0106/cc1 || exit 4
|
||||||
|
out=$(sha256_check test/test0106/proof0.answer)
|
||||||
|
[ "$out" = "test/test0106/cc1: OK" ] || exit 5
|
||||||
|
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
# Verify that the compiled program can compile itself
|
# Verify that the compiled program can compile itself
|
||||||
./test/results/test0106-binary < test/test0106/cc500.c >| test/test0106/cc1 || exit 4
|
./test/results/test0106-knight-posix-binary < test/test0106/cc500.c >| test/test0106/cc1 || exit 4
|
||||||
out=$(sha256_check test/test0106/proof0.answer)
|
out=$(sha256_check test/test0106/proof0.answer)
|
||||||
[ "$out" = "test/test0106/cc1: OK" ] || exit 5
|
[ "$out" = "test/test0106/cc1: OK" ] || exit 5
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -24,10 +24,7 @@ mkdir -p ${TMPDIR}
|
||||||
# Build the test
|
# Build the test
|
||||||
./bin/M2-Planet \
|
./bin/M2-Planet \
|
||||||
--architecture knight-posix \
|
--architecture knight-posix \
|
||||||
-f test/common_knight/functions/file.c \
|
-f M2libc/knight/Linux/bootstrap.c \
|
||||||
-f test/common_knight/functions/malloc.c \
|
|
||||||
-f functions/calloc.c \
|
|
||||||
-f test/common_knight/functions/exit.c \
|
|
||||||
-f functions/match.c \
|
-f functions/match.c \
|
||||||
-f functions/in_set.c \
|
-f functions/in_set.c \
|
||||||
-f functions/numerate_number.c \
|
-f functions/numerate_number.c \
|
||||||
|
@ -50,8 +47,8 @@ mkdir -p ${TMPDIR}
|
||||||
|
|
||||||
# Macro assemble with libc written in M1-Macro
|
# Macro assemble with libc written in M1-Macro
|
||||||
M1 \
|
M1 \
|
||||||
-f test/common_knight/knight_defs.M1 \
|
-f M2libc/knight/knight_defs.M1 \
|
||||||
-f test/common_knight/libc-core.M1 \
|
-f M2libc/knight/libc-core.M1 \
|
||||||
-f ${TMPDIR}/cc.M1 \
|
-f ${TMPDIR}/cc.M1 \
|
||||||
--big-endian \
|
--big-endian \
|
||||||
--architecture knight-posix \
|
--architecture knight-posix \
|
||||||
|
@ -60,7 +57,7 @@ M1 \
|
||||||
|
|
||||||
# Resolve all linkages
|
# Resolve all linkages
|
||||||
hex2 \
|
hex2 \
|
||||||
-f test/common_knight/ELF-knight.hex2 \
|
-f M2libc/knight/ELF-knight.hex2 \
|
||||||
-f ${TMPDIR}/cc.hex2 \
|
-f ${TMPDIR}/cc.hex2 \
|
||||||
--big-endian \
|
--big-endian \
|
||||||
--architecture knight-posix \
|
--architecture knight-posix \
|
||||||
|
@ -69,7 +66,46 @@ hex2 \
|
||||||
|| exit 3
|
|| exit 3
|
||||||
|
|
||||||
# Ensure binary works if host machine supports test
|
# Ensure binary works if host machine supports test
|
||||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] && [ ! -z "${KNIGHT_EMULATION}" ]
|
||||||
|
then
|
||||||
|
# Verify that the resulting file works
|
||||||
|
execve_image \
|
||||||
|
./test/results/test1000-knight-posix-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 functions/require.c \
|
||||||
|
-f cc.h \
|
||||||
|
-f cc_globals.c \
|
||||||
|
-f cc_reader.c \
|
||||||
|
-f cc_strings.c \
|
||||||
|
-f cc_types.c \
|
||||||
|
-f cc_core.c \
|
||||||
|
-f cc_macro.c \
|
||||||
|
-f cc.c \
|
||||||
|
--bootstrap-mode \
|
||||||
|
-o test/test1000/proof \
|
||||||
|
>| ${TMPDIR}/image \
|
||||||
|
|| exit 4
|
||||||
|
|
||||||
|
vm \
|
||||||
|
--POSIX-MODE \
|
||||||
|
--rom ${TMPDIR}/image \
|
||||||
|
--memory 10M \
|
||||||
|
|| exit 5
|
||||||
|
|
||||||
|
. ./sha256.sh
|
||||||
|
out=$(sha256_check test/test1000/proof.answer)
|
||||||
|
[ "$out" = "test/test1000/proof: OK" ] || exit 6
|
||||||
|
elif [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
|
||||||
then
|
then
|
||||||
# Verify that the resulting file works
|
# Verify that the resulting file works
|
||||||
./test/results/test1000-knight-posix-binary \
|
./test/results/test1000-knight-posix-binary \
|
||||||
|
@ -95,11 +131,10 @@ then
|
||||||
-f cc.c \
|
-f cc.c \
|
||||||
--bootstrap-mode \
|
--bootstrap-mode \
|
||||||
-o test/test1000/proof \
|
-o test/test1000/proof \
|
||||||
|| exit 4
|
|| exit 7
|
||||||
|
|
||||||
. ./sha256.sh
|
. ./sha256.sh
|
||||||
out=$(sha256_check test/test1000/proof.answer)
|
out=$(sha256_check test/test1000/proof.answer)
|
||||||
[ "$out" = "test/test1000/proof: OK" ] || exit 5
|
[ "$out" = "test/test1000/proof: OK" ] || exit 8
|
||||||
[ ! -e bin/M2-Planet ] && mv test/results/test1000-knight-posix-binary bin/M2-Planet
|
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue