From f19d7b78d6c641a5a1ecae7198aae262ffa04da3 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 23 Oct 2019 18:08:50 +0200 Subject: [PATCH] kaem.run: New file. * kaem.run: New file. * lib/m2/missing.hex2: New file. --- kaem.run | 127 ++++++++++++++++++++++++++++++++++++++++++++ lib/m2/abtol.c | 2 +- lib/m2/missing.hex2 | 24 +++++++++ lib/m2/ntoab.c | 2 +- lib/m2/strncmp.c | 2 +- 5 files changed, 154 insertions(+), 3 deletions(-) create mode 100644 kaem.run create mode 100644 lib/m2/missing.hex2 diff --git a/kaem.run b/kaem.run new file mode 100644 index 00000000..72124bc5 --- /dev/null +++ b/kaem.run @@ -0,0 +1,127 @@ +#!/bin/bash +# Copyright (C) 2019 Jeremiah Orians +# This file is part of Gnu Mes +# +# Gnu Mes 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. +# +# Gnu Mes 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 Gnu Mes. If not, see . + +# Usage: +# kaem --verbose --strict +# bin/mes-m2 --boot scaffold/boot/14-exit.scm +# bin/mes-m2 --boot scaffold/boot/15-display.scm + +M2-Planet \ + --debug \ + --architecture x86 \ + -f lib/linux/x86-mes-m2/crt1.c \ + -f lib/linux/x86-mes-m2/mini.c \ + -f lib/m2/exit.c \ + -f lib/m2/write.c \ + -f lib/linux/x86-mes-m2/syscall.c \ + -f include/linux/x86/syscall.h \ + -f lib/m2/brk.c \ + -f lib/m2/malloc.c \ + -f lib/m2/memset.c \ + -f lib/m2/read.c \ + -f lib/m2/fdgetc.c \ + -f lib/stdio/getchar.c \ + -f lib/m2/putchar.c \ + -f lib/m2/open.c \ + -f lib/m2/mes_open.c \ + -f lib/m2/strlen.c \ + -f lib/m2/eputs.c \ + \ + -f include/mes/mes.h.m2 \ + -f include/mes/m2.h.m2 \ + -f include/mes/builtins.h.m2 \ + -f include/mes/constants.h.m2 \ + -f include/mes/symbols.h.m2 \ + \ + -f lib/mes/__assert_fail.c \ + -f lib/mes/assert_msg.c \ + \ + -f lib/m2/fdputc.c \ + -f lib/m2/strncmp.c \ + -f lib/m2/getenv.c \ + -f lib/mes/fdputs.c.m2 \ + -f lib/m2/ntoab.c \ + -f lib/ctype/isdigit.c.m2 \ + -f lib/ctype/isxdigit.c.m2 \ + -f lib/ctype/isspace.c.m2 \ + -f lib/ctype/isnumber.c.m2 \ + -f lib/m2/abtol.c \ + -f lib/m2/atoi.c \ + -f lib/m2/memcpy.c.m2 \ + -f lib/stdlib/free.c \ + -f lib/stdlib/realloc.c.m2 \ + -f lib/m2/strcpy.c.m2 \ + -f lib/mes/itoa.c.m2 \ + -f lib/mes/fdungetc.c.m2 \ + -f lib/m2/setenv.c.m2 \ + -f lib/m2/access.c.m2 \ + -f lib/m2/chmod.c.m2 \ + -f lib/m2/isatty.c.m2 \ + -f lib/m2/fork.c.m2 \ + -f lib/m2/execve.c.m2 \ + -f lib/m2/execv.c.m2 \ + -f lib/m2/waitpid.c.m2 \ + -f lib/m2/clock_gettime.c.m2 \ + -f lib/m2/time.c.m2 \ + -f lib/m2/getcwd.c.m2 \ + -f lib/m2/dup.c.m2 \ + -f lib/m2/dup2.c.m2 \ + -f lib/m2/unlink.c.m2 \ + -f lib/m2/strcmp.c.m2 \ + -f lib/m2/memcmp.c.m2 \ + -f src/builtins.c.m2 \ + -f src/display.c.m2 \ + -f src/eval-apply.c.m2 \ + -f src/gc.c.m2 \ + -f src/hash.c.m2 \ + -f src/lib.c.m2 \ + -f src/math.c.m2 \ + -f src/mes.c.m2 \ + -f src/module.c.m2 \ + -f src/posix.c.m2 \ + -f src/reader.c.m2 \ + -f src/string.c.m2 \ + -f src/struct.c.m2 \ + -f src/symbols.c.m2 \ + -f src/vector.c.m2 \ + -o bin/mes.M1 + +blood-elf -f bin/mes.M1 -o bin/mes.blood-elf-M1 + +M1 \ + --LittleEndian \ + --architecture x86 \ + -f lib/m2/x86/x86_defs.M1 \ + -f lib/x86-mes/x86.M1 \ + -f lib/linux/x86-mes-m2/crt1.M1 \ + -f bin/mes.M1 \ + -f bin/mes.blood-elf-M1 \ + -o bin/mes.hex2 + +hex2 \ + --LittleEndian \ + --architecture x86 \ + --BaseAddress 0x1000000 \ + --exec_enable \ + -f lib/x86-mes/elf32-header.hex2 \ + -f bin/mes.hex2 \ + -f lib/m2/missing.hex2 \ + -o bin/mes-m2 + +echo Running mes-m2 +./bin/mes-m2 --boot scaffold/boot/14-exit.scm +#./bin/mes-m2 --boot scaffold/boot/15-display.scm diff --git a/lib/m2/abtol.c b/lib/m2/abtol.c index 48be4fc9..22378a65 100644 --- a/lib/m2/abtol.c +++ b/lib/m2/abtol.c @@ -21,7 +21,7 @@ #include #include -long +int abtol (char **p, int base) { char *s = p[0]; diff --git a/lib/m2/missing.hex2 b/lib/m2/missing.hex2 new file mode 100644 index 00000000..90948ea1 --- /dev/null +++ b/lib/m2/missing.hex2 @@ -0,0 +1,24 @@ +:FUNCTION_execve +C3 +:FUNCTION_access +C3 +:FUNCTION_chmod +C3 +:FUNCTION_isatty +C3 +:FUNCTION_fork +C3 +:FUNCTION_waitpid +C3 +:FUNCTION_clock_gettime +C3 +:FUNCTION_time +C3 +:FUNCTION_getcwd +C3 +:FUNCTION_dup +C3 +:FUNCTION_dup2 +C3 +:FUNCTION_unlink +C3 diff --git a/lib/m2/ntoab.c b/lib/m2/ntoab.c index 5a88c06e..35afaf86 100644 --- a/lib/m2/ntoab.c +++ b/lib/m2/ntoab.c @@ -25,7 +25,7 @@ char *__itoa_buf; char * -ntoab (long x, int base, int signed_p) +ntoab (int x, int base, int signed_p) { if (! __itoa_buf) __itoa_buf = malloc (20); diff --git a/lib/m2/strncmp.c b/lib/m2/strncmp.c index b4270074..44fe15bf 100644 --- a/lib/m2/strncmp.c +++ b/lib/m2/strncmp.c @@ -19,7 +19,7 @@ */ int -strncmp (char const *a, char const *b, size_t size) +strncmp (char *a, char *b, int size) { if (size == 0) return 0;