Compare commits

..

No commits in common. "wip-riscv" and "master" have entirely different histories.

218 changed files with 1164 additions and 6583 deletions

5
.gitignore vendored
View File

@ -1,5 +1,5 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2016,2017,2019,2020,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2016,2017,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -64,8 +64,6 @@
/lib/x86-mes/0exit-42
/lib/x86-mes/exit-42
/m2
/lib/tests/*/[0-9a][0-9a-z]-*
!/lib/tests/*/*.c
!/lib/tests/*/*.exit
@ -82,7 +80,6 @@
/scaffold/tiny-mes
/scaffold/argv-m2
/scaffold/env-m2
/scaffold/hello-m2
/scaffold/main-m2
/scaffold/micro-mes-m2

View File

@ -1 +0,0 @@
Janneke Nieuwenhuizen <janneke@gnu.org>

View File

@ -36,10 +36,6 @@ lib/div.c (__mesabi_log2i)
W. J. van der Laan <laanwj@protonmail.com>
Bugfixes for logand, 64bit build, and va_arg
RISC-V port
Andrius Štikonas <andrius@stikonas.eu>
Rewrite the RISC-V port to use new word-based macros.
List of imported files
@ -95,7 +91,7 @@ lib/m2/x86/x86_defs.M1
lib/m2/x86/ELF-x86.hex2
* legalese
Copyright © 2016,2017,2018,2019,2020,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright

View File

@ -1,7 +1,7 @@
-*- org -*-
#+TITLE: Building and Installing GNU Mes
Copyright © 2016,2017,2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@ -27,12 +27,12 @@ similar way.
*** Other GNU/Linux
- [[https://savannah.gnu.org/projects/mescc-tools/][mescc-tools]], 1.4.0 is known to work.
- [[https://github.com/oriansj/m2-planet][M2-Planet]] (optional), 1.11.0 is known to work.
- [[https://github.com/oriansj/m2-planet][M2-Planet]] (optional), 1.9.0 is known to work.
- [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 1.00.2 is known to work.
- GNU Gcc, 7.5.0 is known to work.
- GNU Guile, version 3.0.4 is known to work.
- GNU Guile, version 3.0.4 is know to work.
- SH, /bin/sh, GNU Bash 5.0.16 is known to work.
- GNU coreutils.
- GNU coreutils
- sed, GNU sed 4.8 is known to work.
** Build it

15
NEWS
View File

@ -10,21 +10,6 @@ Copyright © 2016,2017,2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <jan
Please send Mes bug reports to bug-mes@gnu.org.
* Changes in 0.25 since 0.24.2
** Core
*** Support for riscv64-linux.
** Build
*** Support M2-Planet build for x86_64-linux.
*** Building with M2-Planet-1.11.0 is now supported.
*** The requirement for M2-Planet's --bootstrap-mode was dropped.
** Noteworthy bug fixes
*** In the REPL, `include', `load', and `,use MODULE' now work.
*** Using mes' `access' with R_OK now respects read permissions.
*** On 64bit, displayed values are no longer truncated.
*** On 64bit, MesCC now correctly supports 8-byte immediate values.
*** MesCC now initializes struct fields to 0.
*** The MesCC test suite passes with gcc >= 10
An array overflow bug was fixed in `63-struct-cell.c'.
* Changes in 0.24.2 since 0.24.1
** Build
*** A number of compile warnings have been fixed.

View File

@ -22,9 +22,7 @@ to your config.scm and run guix system reconfigure.
For example (note: ARM is no longer a 'port', see HACKING)
#+BEGIN_SRC bash
guix shell --system=armhf-linux --pure bash coreutils diffutils findutils gawk gcc-toolchain grep git-minimal guile gzip help2man make mescc-tools nyacc@1.00.2 openssh-sans-x pkg-config sed tar texinfo
guix shell --system=aarch64-linux --pure bash coreutils diffutils findutils gawk gcc-toolchain grep git-minimal guile gzip help2man m2-planet make mescc-tools nyacc@1.00.2 openssh-sans-x pkg-config sed tar texinfo
guix shell --system=riscv64-linux --pure bash coreutils diffutils findutils gawk gcc-toolchain grep git-minimal guile gzip help2man m2-planet make mescc-tools nyacc@1.00.2 openssh-sans-x pkg-config sed tar texinfo
guix shell --system=armhf-linux --pure bash coreutils diffutils findutils gawk gcc-toolchain grep git guile gzip help2man make mescc-tools nyacc openssh-sans-x pkg-config sed tar texinfo
#+END_SRC
** Try it
@ -77,7 +75,7 @@ a Reduced Binary seed, thus significantly reducing the Trusted Computing
Base (TCB), strategic decisions about the build process can start.
* Legalese
Copyright © 2019,2022,2023 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]>
Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright

26
README
View File

@ -4,11 +4,11 @@
#+SUBTITLE: Maxwell Equations of Software
[[https://www.gnu.org/software/mes][GNU Mes]] is a Scheme interpreter and C compiler for bootstrapping the GNU
System. It has helped to decimate the number and size of binary seeds
that were used in the bootstrap of [[https://www.gnu.org/software/guix][GNU Guix]] 1.0. Recently, version
0.24.2 has realized the first [[https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-building-from-source-all-the-way-down/][Full Source Bootstrap]] for Guix. The final
goal is to help create a full source bootstrap as part of the
[[https://bootstrappable.org][bootstrappable builds]] effort for any UNIX-like operating system.
System. Since version 0.22 it has again helped to halve the size of
opaque, uninspectable binary seeds that are currently being used in the
[[https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25][Further Reduced Binary Seed bootstrap]] of [[https://www.gnu.org/software/guix][GNU Guix]]. The final goal is to
help create a full-source bootstrap as part of the [[https://bootstrappable.org][bootstrappable builds]]
effort for UNIX-like operating systems.
The Scheme interpreter is written in ~5,000 LOC of simple C, and the C
compiler written in Scheme and these are mutual self-hosting. Mes can
@ -20,14 +20,14 @@ R7RS ellipsis, Matt Wette's [[https://www.nongnu.org/nyacc][Nyacc]] --and test s
support a REPL and a C99 compiler: mescc.
Mes + MesCC + Mes C Library can build a [[https://gitlab.com/janneke/tinycc][bootstrappable TinyCC]] that is
self-hosting. Using this bootstrappable-tcc and the Mes C library we
can build an ancient version of the GNU tools triplet: glibc-2.2.5,
self-hosting. Using this tcc and the Mes C library we now have a
Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5,
binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for
i686-linux, x86_64-linux, armhf-linux and aarch64-linux.
Mes was inspired by The Maxwell Equations of Software: [[https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf][LISP-1.5]] -- John
McCarthy page 13, Guix's source/binary packaging transparency and
Jeremiah Orians's [[https://github.com/oriansj/stage0][stage0]], a ~500-byte self-hosting hex assembler.
Mes is inspired by The Maxwell Equations of Software: [[https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf][LISP-1.5]] -- John
McCarthy page 13, GNU Guix's source/binary packaging transparency and
Jeremiah Orians's [[https://github.com/oriansj/stage0][stage0]] ~500 byte self-hosting hex assembler.
We are very grateful to NLNet for sponsoring the [[https://nlnet.nl/project/GNUMes][Reduced Binary Seed
bootstrap]], the [[https://nlnet.nl/project/GNUMes-arm][ARM port]], and the [[https://nlnet.nl/project/GNUMes-ARM_RISC-V][Full Source Bootstrap.]]
@ -67,8 +67,8 @@ General Public Licence version 3 or later. See the file [[file:COPYING][COPYING
* Links
[0] https://www.gnu.org/software/mes
[1] https://www.gnu.org/software/guix
[2] https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-building-from-source-all-the-way-down/
[1] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25
[2] https://www.gnu.org/software/guix
[3] https://bootstrappable.org
[4] https://github.com/oriansj/m2-planet
[5] https://savannah.nongnu.org/projects/mescc-tools
@ -83,7 +83,7 @@ General Public Licence version 3 or later. See the file [[file:COPYING][COPYING
[14] https://nlnet.nl/project/GNUMes-ARM_RISC-V
* Legalese
Copyright © 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]>
Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright

View File

@ -85,7 +85,7 @@ PHONY_TARGETS:=\
.PHONY: $(PHONY_TARGETS)
X86_ARCH_HEADERS = $(wildcard $(srcdest)include/linux/x86/*.h)
X86_ARCH_HEADERS = $(wildcard $(scrdest)include/linux/x86/*.h)
ARCH_HEADERS = $(X86_ARCH_HEADERS:$(srcdest)include/linux/x86/%=include/arch/%)
default: all
@ -170,14 +170,10 @@ uninstall:
doc/version.texi: ${srcdest}doc/mes.texi GNUmakefile
@mkdir -p $(@D)
timestamp=$$({ git log --pretty=format:%ct -- $< \
|| date +%s -r $<; } \
| sort -n -r | head -n 1); \
dmy=$$(date --date="@$$timestamp" "+%-d %B %Y"); \
(set `LANG=' \
echo "@set UPDATED $$dmy"; \
echo "@set UPDATED-MONTH $$my"; \
echo "@set EDITION $(VERSION)"; \
(set `LANG= date -r $< +'%d %B %Y'`;\
echo "@set UPDATED $$1 $$2 $$3"; \
echo "@set UPDATED-MONTH $$2 $$3"; \
echo "@set EDITION $(VERSION)"; \
echo "@set VERSION $(VERSION)") > $@
doc: doc/version.texi
@ -231,10 +227,6 @@ man: doc/mes.1 doc/mescc.1 doc/mesar.1
%: %.o
%: %.c
# help2man reproducibility
SOURCE_DATE_EPOCH=$(shell git show HEAD --format=%ct --no-patch 2>/dev/null || echo 0)
export SOURCE_DATE_EPOCH
doc/mes.1: src/${program_prefix}mes | build
MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) \
--name="Scheme interpreter for bootstrapping the GNU system" \
@ -294,7 +286,7 @@ TARBALL_VERSION=$(COMMIT:v%=%)
TARBALL_DIR:=$(PACKAGE)-$(TARBALL_VERSION)
TARBALL:=$(TARBALL_DIR).tar.gz
# Be friendly to Debian; avoid using EPOCH
MTIME=$(SOURCE_DIR_EPOCH)
MTIME=$(shell git show HEAD --format=%ct --no-patch 2>/dev/null)
# Reproducible tarball
TAR_FLAGS=--sort=name --mtime=@$(MTIME) --owner=0 --group=0 --numeric-owner --mode=go=rX,u+rw,a-s
@ -406,7 +398,7 @@ gen-announce:
$(GEN_ANNOUNCE) \
--release-type=beta \
--package-name=mes \
--previous-version='0.24.2' \
--previous-version='0.24.1' \
--current-version=$(VERSION) \
--gpg-key-id=$(GPG_KEY_ID) \
--url-directory=https://ftp.gnu.org/gnu/mes \

View File

@ -1,7 +1,7 @@
#! @SHELL@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -54,18 +54,16 @@ AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include"
AM_CFLAGS="-L ${srcdest}lib"
mkdir -p $mes_cpu-mes
cp ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c .
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS crt1.c
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
cp crt1.o $mes_cpu-mes
cp crt1.s $mes_cpu-mes
objects=
for c in $libc_mini_SOURCES; do
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
o=$b.o
o=$(basename $c .c).o
if test ! -e $o -o ${srcdest}$c -nt $o; then
echo " CC $c"
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
fi
objects="$objects $o"
done
@ -74,11 +72,10 @@ $AR crD $mes_cpu-mes/libc-mini.a $objects
objects=
for c in $libmescc_SOURCES; do
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
o=$b.o
o=$(basename $c .c).o
if test ! -e $o -o ${srcdest}$c -nt $o; then
echo " CC $c"
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
fi
objects="$objects $o"
done
@ -87,11 +84,10 @@ $AR crD $mes_cpu-mes/libmescc.a $objects
objects=
for c in $libc_SOURCES; do
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
o=$b.o
o=$(basename $c .c).o
if test ! -e $o -o ${srcdest}$c -nt $o; then
echo " CC $c"
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
fi
objects="$objects $o"
done
@ -100,11 +96,10 @@ $AR crD $mes_cpu-mes/libc.a $objects
objects=
for c in $libc_tcc_SOURCES; do
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
o=$b.o
o=$(basename $c .c).o
if test ! -e $o -o ${srcdest}$c -nt $o; then
echo " CC $c"
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
fi
objects="$objects $o"
done
@ -118,11 +113,10 @@ AM_CFLAGS="-L ${srcdest}lib"
objects=
for c in $mes_SOURCES; do
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
o=$b.o
o=$(basename $c .c).o
if test ! -e $o -o ${srcdest}$c -nt $o; then
echo " CC $c"
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
fi
objects="$objects $o"
done

View File

@ -2,7 +2,6 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
#
# This file is part of GNU Mes.
#
@ -39,8 +38,6 @@ module/mescc/armv4/as.scm
module/mescc/armv4/info.scm
module/mescc/i386/as.scm
module/mescc/i386/info.scm
module/mescc/riscv64/as.scm
module/mescc/riscv64/info.scm
module/mescc/x86_64/as.scm
module/mescc/x86_64/info.scm
module/mescc/info.scm

View File

@ -1,7 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -26,8 +26,7 @@
trap 'test -f .log && cat .log' EXIT
mkdir -p $mes_cpu-mes
cp ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c .
compile crt1.c
compile lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
cp crt1.o $mes_cpu-mes
if test -e crt1.s; then
cp crt1.s $mes_cpu-mes

View File

@ -1,7 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018,2019,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -54,9 +54,15 @@ trace "TEST exit-42"
[ $r != 42 ] && echo " => $r"
[ $r = 42 ]
if $numbered_arch; then
stage0_cpu_flag="--Architecture $stage0_arch";
else
stage0_cpu_flag="--architecture $stage0_cpu";
fi
trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2" $HEX2\
--little-endian\
--architecture $stage0_cpu\
$stage0_cpu_flag\
--base-address 0x1000000\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2\
@ -69,7 +75,7 @@ trace "TEST 0exit-42"
trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2" $HEX2\
--little-endian\
--architecture $stage0_cpu\
$stage0_cpu_flag\
--base-address 0x1000000\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2\
@ -95,7 +101,7 @@ trace "TEST hello-mes"
trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2" $HEX2\
--little-endian\
--architecture $stage0_cpu\
$stage0_cpu_flag\
--base-address 0x1000000\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2\
@ -108,7 +114,7 @@ trace "TEST 0hello-mes"
trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2" $HEX2\
--little-endian\
--architecture $stage0_cpu\
$stage0_cpu_flag\
--base-address 0x1000000\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2\

View File

@ -1,7 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -102,10 +102,7 @@ fi
)
if test -n "$M2_PLANET" && (test "$mes_cpu" == "x86" \
|| test "$mes_cpu" == "x86_64" \
|| test "$mes_cpu" == "arm" \
|| test "$mes_cpu" == "riscv64" \
); then
|| test "$mes_cpu" == "arm"); then
(
. ${srcdest}build-aux/trace.sh
if [ -z "$V" -o "$V" = 0 ]; then
@ -116,7 +113,6 @@ if test -n "$M2_PLANET" && (test "$mes_cpu" == "x86" \
trace "KAEM scaffold/main.kaem" kaem --strict $__verbose -f scaffold/main.kaem
trace "KAEM scaffold/hello.kaem" kaem --strict $__verbose -f scaffold/hello.kaem
trace "KAEM scaffold/argv.kaem" kaem --strict $__verbose -f scaffold/argv.kaem
trace "KAEM scaffold/env.kaem" kaem --strict $__verbose -f scaffold/env.kaem
trace "KAEM scaffold/read.kaem" kaem --strict $__verbose -f scaffold/read.kaem
trace "KAEM kaem.run" kaem --strict $__verbose
)
@ -154,6 +150,7 @@ fi
${SHELL} ${srcdest}build-aux/build-lib.sh
${SHELL} ${srcdest}build-aux/build-source-lib.sh
if $bootstrap; then
rm -f globals.* # FIXME: avoid name clash with globals from lib
${SHELL} ${srcdest}build-aux/build-mes.sh
cp -f bin/mes-mescc ../bin
cp -f bin/mes ../bin

View File

@ -1,5 +1,5 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -18,12 +18,8 @@
objects=
compile () {
if test $(dirname $1) = "."; then
c=$1
else
c=${srcdest}$1
fi
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
c=${srcdest}$1
b=$(basename $c .c)
o=$b.o
objects="$objects $o"
if test ! -e $o -o $c -nt $o; then
@ -38,7 +34,7 @@ archive () {
sources="$@"
objects=
for c in $sources; do
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
b=$(basename $c .c)
o=$b.o
compile $c
done

View File

@ -1,5 +1,5 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019,2020,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -18,24 +18,20 @@
case "$mes_cpu" in
arm)
cc_cpu=arm
stage0_arch=40
stage0_cpu=armv7l
;;
x86_64)
cc_cpu=x86_64
stage0_arch=2
stage0_cpu=amd64
;;
x86)
cc_cpu=i386
stage0_arch=1
stage0_cpu=x86
;;
riscv64)
cc_cpu=riscv64
stage0_cpu=riscv64
;;
*)
stage0_arch=1
stage0_cpu=$mes_cpu
cc_cpu=$mes_cpu
;;
esac

View File

@ -1,9 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018,2019,2020,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
# Copyright © 2023 Ekaitz Zarraga <ekaitz@elenq.tech>
# Copyright © 2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -48,7 +46,6 @@ lib/tests/scaffold/13-if-neq.c
lib/tests/scaffold/14-if-goto.c
lib/tests/scaffold/15-if-not-f.c
lib/tests/scaffold/16-if-t.c
lib/tests/scaffold/16-cast.c
lib/tests/scaffold/17-compare-char.c
lib/tests/scaffold/17-compare-ge.c
lib/tests/scaffold/17-compare-gt.c
@ -66,7 +63,6 @@ lib/tests/scaffold/17-compare-or.c
lib/tests/scaffold/17-compare-and-or.c
lib/tests/scaffold/17-compare-assign.c
lib/tests/scaffold/17-compare-call.c
lib/tests/scaffold/17-compare-rotated.c
lib/tests/scaffold/18-assign-shadow.c
lib/tests/scaffold/20-while.c
lib/tests/scaffold/21-char-array-simple.c
@ -101,14 +97,12 @@ lib/tests/scaffold/43-for-do-while.c
lib/tests/scaffold/44-switch.c
lib/tests/scaffold/44-switch-fallthrough.c
lib/tests/scaffold/44-switch-body-fallthrough.c
lib/tests/scaffold/44-switch-body-fallthrough-not-default.c
lib/tests/scaffold/45-void-call.c
lib/tests/scaffold/46-function-static.c
lib/tests/scaffold/47-function-expression.c
lib/tests/scaffold/48-global-static.c
lib/tests/assert/50-assert.c
lib/tests/mes/50-itoa.c
lib/tests/scaffold/50-compare-rotated-weird.c
lib/tests/posix/50-getenv.c
lib/tests/stdlib/50-malloc.c
lib/tests/string/50-memcmp.c
@ -138,8 +132,6 @@ lib/tests/scaffold/63-struct-cell.c
lib/tests/scaffold/64-make-cell.c
lib/tests/scaffold/65-read.c
lib/tests/scaffold/66-local-char-array.c
lib/tests/scaffold/67-m1-overflow-check.c
lib/tests/scaffold/68-truncate-shift.c
"
tcc_tests="
@ -198,7 +190,6 @@ lib/tests/scaffold/7u-inc-byte-word.c
lib/tests/scaffold/7u-struct-func.c
lib/tests/scaffold/7u-struct-size10.c
lib/tests/scaffold/7u-vstack.c
lib/tests/scaffold/7v-struct-initialize-zeroes.c
lib/tests/scaffold/70-array-in-struct-init.c
lib/tests/scaffold/70-struct-short-enum-init.c
lib/tests/scaffold/70-struct-post.c
@ -253,6 +244,8 @@ if test $compiler = mescc; then
xfail_tests="$xfail_tests
lib/tests/scaffold/17-compare-unsigned-char-le.c
lib/tests/scaffold/17-compare-unsigned-short-le.c
lib/tests/scaffold/66-local-char-array.c
lib/tests/scaffold/72-typedef-struct-def-local.c
lib/tests/scaffold/70-ternary-arithmetic-argument.c
lib/tests/mes/90-abtod.c
lib/tests/mes/90-dtoab.c
@ -297,12 +290,6 @@ lib/tests/scaffold/70-extern.c
lib/tests/stdio/80-sscanf.c
lib/tests/posix/90-execlp.c
lib/tests/string/90-snprintf.c
"
fi
if test $mes_cpu = riscv64; then
xfail_tests="$xfail_tests
lib/tests/scaffold/70-extern.c
"
fi
fi
@ -311,7 +298,7 @@ fi
if test -n "$bootstrap"; then
TESTS="${TESTS-$mes_tests$tcc_tests}"
else
TESTS="${TESTS-$mes_tests$tcc_tests$gnu_tests}"
TESTS="${TESTS-$mes_tests$tcc_test$gnu_tests}"
fi
# Allow for make check xfail_tests=lib/tests/setjmp/80-setjmp.c

View File

@ -1,5 +1,5 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -57,6 +57,7 @@ abs_top_srcdir="@abs_top_srcdir@"
arch="@arch@"
build="@build@"
host="@host@"
numbered_arch=${numbered_arch-"@numbered_arch@"}
bootstrap=${bootstrap-@bootstrap@}
compiler=${compiler-@compiler@}
@ -97,7 +98,6 @@ export CC
export DIFF
export SHELL
export V
export cc_cpu
export colors
export compiler
export courageous

View File

@ -1,7 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2019,2020,2021,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2019,2020,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -30,7 +30,6 @@ fi
. ./config.sh
libc_mini_shared_SOURCES="
lib/mes/__init_io.c
lib/mes/eputs.c
lib/mes/oputs.c
"
@ -75,7 +74,7 @@ libc_mini_SOURCES="$libc_mini_shared_SOURCES"
if test $mes_libc = mes; then
libc_mini_SOURCES="$libc_mini_SOURCES
lib/mes/write.c
lib/mes/mini-write.c
"
fi
@ -216,7 +215,6 @@ lib/linux/malloc.c
lib/linux/_read.c
lib/linux/time.c
lib/linux/unlink.c
lib/linux/wait4.c
lib/linux/waitpid.c
lib/linux/$mes_cpu-mes-$compiler/syscall.c
lib/linux/getpid.c

View File

@ -1,5 +1,5 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -43,7 +43,6 @@ export moduledir
export sysconfdir
export bootstrap
export cc_cpu
export compiler
export courageous
export mes_system

View File

@ -48,6 +48,7 @@ sed -ri \
include/mes/mes.h \
include/mes/symbols.h \
include/mes/builtins.h \
include/m2/lib.h \
src/builtins.c \
src/cc.c \
src/core.c \

18
configure vendored
View File

@ -6,7 +6,6 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
;;; GNU Mes --- Maxwell Equations of Software
;;; Copyright © 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020 Vagrant Cascadian <vagrant@reproducible-builds.org>
;;; Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
;;;
;;; configure: This file is part of GNU Mes.
;;;
@ -539,12 +538,12 @@ Some influential environment variables:
(mes-cpu (cond ((member mes-cpu '("i386" "i486" "i586" "i686")) "x86")
((member mes-cpu '("arm" "armv4" "armv7l")) "arm")
(else mes-cpu)))
(mes-bits (if (member mes-cpu '("x86_64" "riscv64")) "64"
(mes-bits (if (member mes-cpu '("x86_64")) "64"
"32"))
(mes-libc (if system-libc? "system" "mes"))
(mes-kernel (car (filter
(compose not
(cut member <> '("pc" "portbld" "unknown" "redhat")))
(cut member <> '("pc" "portbld" "unknown")))
(cdr host-type-list))))
(mes-kernel (if (string-prefix? "freebsd" mes-kernel) "freebsd" mes-kernel))
(mes-compiler (cond (gcc? "gcc") (tcc? "gcc") (mescc? "mescc") (else "bootstrap")))
@ -557,7 +556,12 @@ Some influential environment variables:
(and (file-exists? "/bin/sh") "/bin/sh")
(file-name "sh" deps)
"sh"))
(hex2 (file-name "hex2" deps)))
(hex2 (file-name "hex2" deps))
(numbered-arch? (begin
(stdout "checking for stage0 architecture flag... ")
(let ((numbered? (and hex2 (string-contains (gulp-pipe (string-append hex2 " --help 2>&1" )) "--Architecture 12345"))))
(stdout (if numbered? "numbered\n" "named\n"))
numbered?))))
(define* (substitute file-name pairs
#:key (target (if (string-suffix? ".in" file-name)
@ -575,9 +579,7 @@ Some influential environment variables:
(when (and (not (member mes-system '("arm-linux-mes"
"x86-linux-mes"
"x86_64-linux-mes"
"riscv32-linux-mes"
"riscv64-linux-mes")))
"x86_64-linux-mes")))
(not with-courage?))
(stderr "platform not supported: ~a
See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
@ -653,6 +655,7 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
("@LDFLAGS@" . ,(or (getenv "LDFLAGS") "-static -g"))
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
("@numbered_arch@" . ,(if numbered-arch? "true" "false"))
,@(map
(lambda (o)
@ -721,6 +724,7 @@ GNU Mes is configured for
libc: " mes-libc "
kernel: " mes-kernel "
system: " mes-system "
tools: " (if numbered-arch? "numbered" "named") " arch
bootstrap: " (if with-bootstrap? "yes" "no") "
courageous: " (if with-courage? "yes" "no") "

View File

@ -99,6 +99,13 @@ else
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')}
fi
numbered_arch=false
mes_tools=named
if ( $HEX2 --help 2>&1 ) | grep -q "\-\-Architecture 12345"; then
numbered_arch=true
mes_tools=numbered
fi
bindir=$(eval echo ${bindir-$prefix/bin})
datadir=$(eval echo ${datadir-$prefix/share})
docdir=$(eval echo ${docdir-$datadir/doc/mes})
@ -165,6 +172,7 @@ subst () {
-e s,"@M2_PLANET@,$M2_PLANET,"\
-e s,"@KAEM@,$KAEM,"\
-e s,"@MES_FOR_BUILD@,$MES_FOR_BUILD,"\
-e s,"@numbered_arch@,$numbered_arch,"\
-e s,"@SHELL@,$SHELL,"\
$1 > $2
}

View File

@ -10,7 +10,7 @@ Mes has now been ported to M2-Planet and can be bootstrapped using
stage0-posix[0], starting from the 357-byte hex0 binary of the
bootstrap-seeds[1], as was promised at FOSDEM'21[2].
We are excited that the NlNet Foundation[4] is again sponsoring this
We are exciteda that the NlNet Foundation[4] is again sponsoring this
work!
What's next?

View File

@ -61,8 +61,8 @@ Enjoy!
Here are the SHA1 and SHA256 checksums:
30b0ce4cd37c87dca37b85a6c19646001881be46 mes-0.24.2.tar.gz
7ddae0854e46ebfa18c13ab37e64839a7b86ea88aeed366a8d017efd11dae86e mes-0.24.2.tar.gz
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.2.tar.gz
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.2.tar.gz
[*] Use a .sig file to verify that the corresponding file (without the
.sig suffix) is intact. First, be sure to download both the .sig file

View File

@ -1,108 +0,0 @@
Subject: GNU Mes 0.25 released
<#secure method=pgpmime mode=sign>
We are happy to announce the release of GNU Mes 0.25!
Although it's been only four months since the previous release, this
release represents 70 commits over two years by five people. This
release brings RISC-V64-linux support.
We are excited that the NLnet Foundation is sponsoring this work!
What's next?
Bringing the Full Source Bootstrap to NixOS. Full Guile compatible
module support, and support for running Gash and Gash-Utils. Support
for bootstrapping gcc-4.6.4, and a Full Source Bootstrap for
armhf-linux, and riscv64-linux.
Enjoy!
* About
GNU Mes is a Scheme interpreter and C compiler for bootstrapping the
GNU System. It has helped to decimate the number and size of binary
seeds that were used in the bootstrap of GNU Guix 1.0. Recently,
version 0.24.2 has realized the first Full Source Bootstrap for Guix
<https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-building-from-source-all-the-way-down/>.
The final goal is to help create a full source bootstrap as part of
the bootstrappable builds effort <https://bootstrappable.org> for any
UNIX-like operating system.
Mes + MesCC + Mes C Library can build a bootstrappable TinyCC
<https://gitlab.com/janneke/tinycc> that is self-hosting. Using this
bootstrappable-tcc and the Mes C library we can build an ancient
version of the GNU tools triplet: glibc-2.2.5, binutils-2.20.1,
gcc-2.95.3. This is enough to bootstrap Guix for i686-linux,
x86_64-linux, armhf-linux and aarch64-linux.
Mes was inspired by The Maxwell Equations of Software: LISP-1.5 --
John McCarthy page 13, Guix's source/binary packaging transparency and
Jeremiah Orians's Stage0 <https://github.com/oriansj/stage0>, a
~500-byte self-hosting hex assembler.
* Download
git clone git://git.savannah.gnu.org/mes.git
Here are the compressed sources and a GPG detached signature[*]:
https://ftp.gnu.org/gnu/mes/mes-0.25.tar.gz
https://ftp.gnu.org/gnu/mes/mes-0.25.tar.gz.sig
Use a mirror for higher download bandwidth:
https://ftpmirror.gnu.org/mes/mes-0.25.tar.gz
https://ftpmirror.gnu.org/mes/mes-0.25.tar.gz.sig
Here are the SHA1 and SHA256 checksums:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.25.tar.gz
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.25.tar.gz
[*] Use a .sig file to verify that the corresponding file (without the
.sig suffix) is intact. First, be sure to download both the .sig file
and the corresponding tarball. Then, run a command like this:
gpg --verify mes-0.25.tar.gz.sig
If that command fails because you don't have the required public key,
or that public key has expired, try the following commands to update
or refresh it, and then rerun the 'gpg --verify' command.
gpg --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273
Alternatively, Mes can be installed or updated using Guix:
guix pull
guix install mes
* Changes in 0.25 since 0.24.2
** Core
*** Support for riscv64-linux.
** Build
*** Support M2-Planet build for x86_64-linux.
*** Building with M2-Planet-1.11.0 is now supported.
*** The requirement for M2-Planet's --bootstrap-mode was dropped.
** Noteworthy bug fixes
*** In the REPL, `include', `load', and `,use MODULE' now work.
*** Using mes' `access' with R_OK now respects read permissions.
*** On 64bit, displayed values are no longer truncated.
*** On 64bit, MesCC now correctly supports 8-byte immediate values.
*** MesCC now initializes struct fields to 0.
*** The MesCC test suite passes with gcc >= 10
An array overflow bug was fixed in `63-struct-cell.c'.
Join bug-mes@gnu.org and #bootstrappable on irc.libera.chat for
discussions.
Thanks to everyone who contributed to this release:
7 Andrius Štikonas
1 Efraim Flashner
1 Emily Trau
5 Ekaitz Zarraga
49 Janneke Nieuwenhuizen
15 W. J. van der Laan

View File

@ -1,80 +1,107 @@
digraph "Guix bag" {
"/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" [label = "gcc-core-mesboot0@2.95.3", shape = box, fontname = sans];
"/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" [color = darkgoldenrod];
"/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" [color = darkgoldenrod];
"/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" [color = darkgoldenrod];
"/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" [color = darkgoldenrod];
"/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [color = darkgoldenrod];
"/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkgoldenrod];
"/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkgoldenrod];
"/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkgoldenrod];
"/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkgoldenrod];
"/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" [label = "binutils-mesboot0@2.20.1a", shape = box, fontname = sans];
"/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" [color = darkgoldenrod];
"/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" [color = darkgoldenrod];
"/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" [color = darkgoldenrod];
"/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [color = darkgoldenrod];
"/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkgoldenrod];
"/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkgoldenrod];
"/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkgoldenrod];
"/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkgoldenrod];
"/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" [label = "gzip-mesboot@1.2.4", shape = box, fontname = sans];
"/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = peachpuff4];
"/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = peachpuff4];
"/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = peachpuff4];
"/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = peachpuff4];
"/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = peachpuff4];
"/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [label = "tcc-boot0@0.9.26-1136-g5bba73cc", shape = box, fontname = sans];
"/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" [color = cyan3];
"/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" [color = cyan3];
"/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = cyan3];
"/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = cyan3];
"/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = cyan3];
"/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = cyan3];
"/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" [label = "mes-boot@0.24.2", shape = box, fontname = sans];
"/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" [color = darkseagreen];
"/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkseagreen];
"/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkseagreen];
"/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkseagreen];
"/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkseagreen];
"/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" [label = "stage0-posix@1.4", shape = box, fontname = sans];
"/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/7zxbgnrnhvm7g8bz1m5knpsbdfxzxl9g-bootstrap-seeds-1.0.0.drv" [color = darkviolet];
"/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkviolet];
"/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkviolet];
"/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkviolet];
"/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkviolet];
"/gnu/store/7zxbgnrnhvm7g8bz1m5knpsbdfxzxl9g-bootstrap-seeds-1.0.0.drv" [label = "bootstrap-seeds@1.0.0", shape = ellipse, fontname = sans];
"/gnu/store/7zxbgnrnhvm7g8bz1m5knpsbdfxzxl9g-bootstrap-seeds-1.0.0.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkgoldenrod];
"/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [label = "bootar@1b", shape = box, fontname = sans];
"/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = peachpuff4];
"/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [label = "guile-bootstrap@2.0", shape = ellipse, fontname = sans];
"/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [label = "gash-boot@0.3.0", shape = box, fontname = sans];
"/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkseagreen];
"/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkseagreen];
"/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [label = "gash-utils-boot@0.2.0", shape = box, fontname = sans];
"/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkviolet];
"/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkviolet];
"/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkviolet];
"/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" [label = "patch-mesboot@2.5.9", shape = box, fontname = sans];
"/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [color = blue];
"/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = blue];
"/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = blue];
"/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = blue];
"/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = blue];
"/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = blue];
"/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [label = "make-mesboot0@3.80", shape = box, fontname = sans];
"/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = dimgrey];
"/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = dimgrey];
"/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = dimgrey];
"/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = dimgrey];
"/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = dimgrey];
"/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" [label = "tcc-boot@0.9.27", shape = box, fontname = sans];
"/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" [color = blue];
"/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [color = blue];
"/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = blue];
"/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = blue];
"/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = blue];
"/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = blue];
"/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = blue];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" [label = "gcc-core-mesboot0@2.95.3", shape = box, fontname = sans];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = red];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = red];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" [label = "binutils-mesboot0@2.14", shape = box, fontname = sans];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = cyan3];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = cyan3];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [label = "bash-mesboot0@2.05b", shape = box, fontname = sans];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = darkgoldenrod];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = darkgoldenrod];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkgoldenrod];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkgoldenrod];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkgoldenrod];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkgoldenrod];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [label = "make-mesboot0@3.80", shape = box, fontname = sans];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = magenta];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = magenta];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = magenta];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = magenta];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = magenta];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [label = "tcc-boot0@0.9.26-1103-g6e62e0e", shape = box, fontname = sans];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" [color = darkseagreen];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/a6nbjivhxp65wqj5s8rz0fnmwzqxmhry-bootstrap-mescc-tools-0.5.2.drv" [color = darkseagreen];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkseagreen];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkseagreen];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkseagreen];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkseagreen];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" [label = "mes-boot@0.22", shape = box, fontname = sans];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" [color = peachpuff4];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/a6nbjivhxp65wqj5s8rz0fnmwzqxmhry-bootstrap-mescc-tools-0.5.2.drv" [color = peachpuff4];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = peachpuff4];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = peachpuff4];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = peachpuff4];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = peachpuff4];
"/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" [label = "bootstrap-mes-rewired@0.19", shape = box, fontname = sans];
"/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" -> "/gnu/store/r7bbw2ywmgqp6m5a1hp0fs4lhc51w3sq-bootstrap-mes-0.drv" [color = cyan3];
"/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = cyan3];
"/gnu/store/r7bbw2ywmgqp6m5a1hp0fs4lhc51w3sq-bootstrap-mes-0.drv" [label = "bootstrap-mes@0", shape = box, fontname = sans];
"/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [label = "gash-boot@0.2.0", shape = box, fontname = sans];
"/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkviolet];
"/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkviolet];
"/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [label = "bootar@1a", shape = box, fontname = sans];
"/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue];
"/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [label = "guile-bootstrap@2.0", shape = box, fontname = sans];
"/gnu/store/a6nbjivhxp65wqj5s8rz0fnmwzqxmhry-bootstrap-mescc-tools-0.5.2.drv" [label = "bootstrap-mescc-tools@0.5.2", shape = box, fontname = sans];
"/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [label = "gash-utils-boot@0.1.0", shape = box, fontname = sans];
"/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = blue];
"/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = blue];
"/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue];
"/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [label = "bzip2-mesboot@1.0.8", shape = box, fontname = sans];
"/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = blue];
"/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = blue];
"/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = blue];
"/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = blue];
"/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = blue];
"/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue];
"/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [label = "gzip-mesboot@1.2.4", shape = box, fontname = sans];
"/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = red];
"/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = red];
"/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red];
"/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = red];
"/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = red];
"/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [label = "patch-mesboot@2.5.9", shape = box, fontname = sans];
"/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = darkseagreen];
"/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = darkseagreen];
"/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkseagreen];
"/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkseagreen];
"/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkseagreen];
"/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkseagreen];
"/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [label = "sed-mesboot0@1.18", shape = box, fontname = sans];
"/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = darkgoldenrod];
"/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = darkgoldenrod];
"/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkgoldenrod];
"/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkgoldenrod];
"/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkgoldenrod];
"/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkgoldenrod];
"/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [label = "tcc-boot@0.9.27", shape = box, fontname = sans];
"/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = blue];
"/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = blue];
"/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = blue];
"/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = blue];
"/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = blue];
"/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = blue];
"/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue];
}

View File

@ -13,7 +13,7 @@
@set OPENPGP-SIGNING-KEY-ID 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273
@copying
Copyright @copyright{} 2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen@*
Copyright @copyright{} 2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen@*
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@ -93,11 +93,7 @@ Bootstrapping
* The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk.
* Invoking mes:: Running Mes, a minimalist Guile lookalike.
* Invoking mescc:: Running the MesCC bootstrap compiler.
* Invoking mesar:: Running the MesCC bootstrap archiver.
The Mes Bootstrap Process
* Full Source Bootstrap Deployments::
* Invoking mesar::
Invoking mes
@ -160,8 +156,8 @@ essential freedoms:
@item
The freedom to study how the program works, and change it so it does
your computing as you wish (freedom 1). Access to the source code
is a precondition for this.
your computing as you wish (freedom 1). Access to the source code is
a precondition for this.
@item
The freedom to redistribute copies so you can help others (freedom
@ -169,8 +165,8 @@ essential freedoms:
@item
The freedom to distribute copies of your modified versions to others
(freedom 3). By doing this you can give the whole community a
chance to benefit from your changes. Access to the source code is a
(freedom 3). By doing this you can give the whole community a chance
to benefit from your changes. Access to the source code is a
precondition for this.
@end enumerate
@end quotation
@ -329,21 +325,12 @@ from source.
@node Full Source Bootstrap
@section Full Source Bootstrap
@quotation
The holy grail for bootstrappability will be connecting @code{hex0} to
@code{mes}.
@author Carl Dong
@end quotation
Reduction of binary seeds is great, but there is an obvious target: we
cannot allow any binary seeds in our software stack. Not even in the
bootstrap binary seed. Maybe that is a bit too strong: we want to have
the absolute minimum of binary seeds and all binary seeds need to be
inspectable and must be reviewed. How big would the absolute minimal
set be? During the Guix 1.5 development series we managed to close the
gap between @code{stage0-posix} and @code{mes}. We refer to this as the
@emph{Full-Source Bootstrap}.
set be?
@menu
* Stage0:: The Magical Self-Hosting Hex Assembler.
@ -578,7 +565,7 @@ The following dependencies are optional:
@itemize
Support for building the bootstrap @file{bin/mes-m2} depends on
@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.11.0.
@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.9.0.
@end itemize
@cindex Guile, compatibility
@ -608,7 +595,7 @@ Bootstrapping Mes depends on the following packages:
@itemize
@item a POSIX-compatible shell
@item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.4.0,
@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.11.0.
@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.9.0.
@item @url{https://savannah.gnu.org/projects/nyacc/, NYACC}, version 1.00.2,
@end itemize
@ -697,17 +684,17 @@ responsibility.
* The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk.
* Invoking mes:: Running Mes, a minimalist Guile lookalike.
* Invoking mescc:: Running the MesCC bootstrap compiler.
* Invoking mesar:: Running the MesCC bootstrap archiver.
* Invoking mesar::
@end menu
@node The Mes Bootstrap Process
@section The Mes Bootstrap Process
The Full Source Bootstrap currently adopted by Guix@footnote{See
The Reduced Binary Seed bootstrap currently adopted by Guix@footnote{See
@file{gnu/packages/commencement.scm} in the @var{master} branch in Guix
git
@url{https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/commencement.scm}}.
In its intiial form it is only available for x86-linux.
In its intiial form it is only available for x86-linux and armhf-linux.
Currently, it goes like this:
@ -715,48 +702,48 @@ Currently, it goes like this:
gcc-mesboot (4.9.4)
^
|
(...)
glibc-mesboot (2.16.0)
^
|
binutils-mesboot (2.20.1a), glibc-mesboot (2.2.5),
gcc-core-mesboot (2.95.3)
gcc-mesboot1 (4.7.4)
^
|
patch-mesboot (2.5.9)
binutils-mesboot (2.20.1a)
^
|
bootstrappable-tcc (0.9.26+31 patches)
gcc-mesboot0 (2.95.3)
^
|
gnu-make-mesboot0 (3.80)
glibc-mesboot0 (2.2.5)
^
|
gzip-mesboot (1.2.4)
gcc-core-mesboot (2.95.3)
^
|
tcc-boot (0.9.27)
make-mesboot0, diffutils-mesboot, binutils-mesboot0 (2.20.1a)
^
|
mes-boot (0.24.2)
tcc-boot
^
|
stage0-posix (hex0..M2-Planet)
tcc-boot0
^
|
gash-boot, gash-utils-boot
mes-boot
^
|
*
bootstrap-seeds (357-bytes for x86)
~~~
[bootstrap-guile-2.0.9 driver (~25 MiB)]
gash-boot, gash-utils-boot
^
|
*
bootstrap-mescc-tools, bootstrap-mes (~12 MiB)
bootstrap-guile (~48 MiB)
@end verbatim
@c This graph is generated from Guix master, doing:
@c This graph is generated from wip-bootstrap, doing:
@c guix graph --type=bag -e '(@@ (gnu packages commencement) gcc-core-mesboot0)' \
@c | sed -re 's,((bootstrap-seeds|guile-bootstrap).*shape =) box,\1 ellipse,' \
@c > doc/images/gcc-mesboot-graph.dot
@c guix graph --type=bag -e '(@@ (gnu packages commencement) gcc-core-mesboot0)' > doc/images/gcc-mesboot-graph.dot
@c dot -T png doc/images/gcc-mesboot-graph.dot > doc/images/gcc-mesboot-graph.png
Here's a generated dependency diagram to for the initial bootstrap gcc
@ -764,6 +751,12 @@ that builds the rest of Guix.
@image{images/gcc-mesboot-graph,6in,,Reference graph of the gcc-core-mesboot0}
Work is ongoing to remove these binary seeds that were intentionally
injected by our own doing as temporary shortcut
@example
bootstrap-mescc-tools (seed), bootstrap-mes (seed)
@end example
For now, this additional non-bootstrapped dependencies (i.e., binary
seeds) are taken for granted
@ -771,53 +764,7 @@ seeds) are taken for granted
bootstrap-guile
@end example
Our next priority is to eleminate the dependency on
@code{bootstrap-guile} for @code{Gash} and @code{Gash-Utils}, and thus
for @code{Mes}.
@menu
* Full Source Bootstrap Deployments::
@end menu
@node Full Source Bootstrap Deployments
@subsection Full Source Bootstrap Deployments
@table @code
@item GNU Guix
Reference implementation of the Full Source Bootstrap for
@code{i686-linux} and @code{x86_64-linux}
@url{https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-building-from-source-all-the-way-down/,Guix FSB, building from source all the way down}.
@item Bitcoin Core
The first application of Guix' Reduced Binary Seed Bootstrap was done in
bitcoin core
@url{https://github.com/bitcoin/bitcoin/blob/master/contrib/guix/README.md,
Bootstrappable Bitcoin Core Builds}.
@item Live Bootstrap
The @url{https://github.com/fosslinux/live-bootstrap/,live-bootstrap}
has no dependency on @code{guile-bootstrap}, and removes and bootstraps
generated autotools and flex/bison files.
@item Freedesktop SDK
The Freedesktop SDK used to have an informal dependency on its previous
version being installed in binary from. This dependency was mostly
broken in
@url{https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/merge_requests/11557,
bootstrap freedesktop binary seed}, they still have a dependency on
binary Rust.
@item Full Source Bootstrap from Git
Building on the Live Bootstrap, but building most everything from Git
@url{https://github.com/schierlm/FullSourceBootstrapFromGit, FSB from Git}.
@item NixOS
Implementation of a FSB has started
@url{https://github.com/NixOS/nixpkgs/pull/227914,NixOS 256b bootstrap
(in progress)}.
@end table
Our next priority is to eleminate these one by one.
@node Invoking mes
@section Invoking mes

View File

@ -31,7 +31,6 @@
#:use-module (gnu packages commencement)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gdb)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages guile)
#:use-module (gnu packages man)
@ -67,9 +66,8 @@
(base32
"0z2ni2qn2np1walcaqlxz8sinzb78d4hiq9glddzf26wxc226hs4"))))
(build-system gnu-build-system)
(supported-systems '("i686-linux" "x86_64-linux"
"armhf-linux" "aarch64-linux"
"riscv32-linux" "riscv64-linux"))
(supported-systems
'("aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux"))
(native-inputs (list which))
(arguments
`(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
@ -87,41 +85,35 @@ get_machine.")
(license gpl3+)))
(define-public m2-planet
(let ((version "1.10.0")
(revision "1")
(commit "c82fb8c3530e93fd49efe60da785ffff827ea4d"))
(package
(name "m2-planet")
(version (git-version version revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/oriansj/m2-planet")
(commit commit)
(recursive? #t))) ;for M2libc
(file-name (git-file-name name version))
(sha256
(base32
"1fy6ll8z96y6xzyi7zfgsn07rxxvfm600i8f8vwc57266a3sds9j"))))
(native-inputs (list mescc-tools))
(build-system gnu-build-system)
(supported-systems '("i686-linux" "x86_64-linux"
"armhf-linux" "aarch64-linux"
"riscv32-linux" "riscv64-linux"))
(arguments
`(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
(string-append "CC=" ,(cc-for-target)))
#:tests? #f
#:phases (modify-phases %standard-phases
(delete 'bootstrap)
(delete 'configure))))
(synopsis "The PLAtform NEutral Transpiler")
(description
"M2-Planet, The PLAtform NEutral Transpiler, when combined with
(package
(name "m2-planet")
(version "1.9.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/oriansj/m2-planet")
(commit (string-append "Release_" version))
(recursive? #t))) ;for M2libc
(file-name (git-file-name name version))
(sha256
(base32
"0cgvvq91cbxxm93k8ayyvhpaf3c2lv10qw4wyqwn3hc1qb1cfyvr"))))
(native-inputs (list mescc-tools))
(build-system gnu-build-system)
(arguments
`(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
(string-append "CC=" ,(cc-for-target)))
#:tests? #f
#:phases (modify-phases %standard-phases
(delete 'bootstrap)
(delete 'configure))))
(synopsis "The PLAtform NEutral Transpiler")
(description
"M2-Planet, The PLAtform NEutral Transpiler, when combined with
mescc-tools compiles a subset of the C language into working binaries
with introspective steps inbetween.")
(home-page "https://github.com/oriansj/m2-planet")
(license gpl3+))))
(home-page "https://github.com/oriansj/m2-planet")
(license gpl3+)))
(define-public nyacc-0.99
(package
@ -246,7 +238,7 @@ Guile.")
(license gpl3+)))
(define-public mes.git
(let ((version #!mes!# "0.24.2")
(let ((version #!mes!# "0.24.2")
(revision "0")
(commit (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ))))
(package
@ -255,7 +247,4 @@ Guile.")
(version (string-append version "-" revision "." (string-take commit 7)))
(source (local-file %source-dir
#:recursive? #t
#:select? (git-predicate %source-dir)))
(native-inputs
`(("gdb" ,gdb)
,@(package-native-inputs mes))))))
#:select? (git-predicate %source-dir))))))

View File

@ -1,8 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* Copyright © 2023 Emily Trau <emily@downunderctf.com>
*
* This file is part of GNU Mes.
*
@ -42,17 +40,12 @@
#define O_APPEND 0x400
#ifdef __arm__
#define O_DIRECTORY 0x4000
#define O_TMPFILE 0x404000
#define O_DIRECTORY 0x4000
/*#define O_DIRECT 0x10000*/
#else
#define O_DIRECTORY 0x10000
#define O_TMPFILE 0x410000
#define O_DIRECTORY 0x10000
#endif
#define AT_FDCWD -100
#define AT_SYMLINK_NOFOLLOW 0x100
#define AT_REMOVEDIR 0x200
#elif __GNU__
#define O_RDONLY 1
#define O_WRONLY 2
@ -76,11 +69,8 @@
#define creat(file_name, mode) open (file_name, O_WRONLY | O_CREAT | O_TRUNC, mode)
int dup (int old);
int dup2 (int old, int new);
#if !__M2__
int fcntl (int filedes, int command, ...);
int open (char const *s, int flags, ...);
#endif
#endif // ! SYSTEM_LIBC

View File

@ -1,111 +0,0 @@
#+COMMENT: -*- org -*-
#+TITLE: Linux System Calls
|---------------+----------+-----+--------+-----+---------|
| name | old | x86 | x86_64 | arm | riscv64 |
|---------------+----------+-----+--------+-----+---------|
| libc-mini | | | | | |
|---------------+----------+-----+--------+-----+---------|
| exit | | 1 | 60 | 1 | 1 |
| write | | 4 | 1 | 4 | 4 |
|---------------+----------+-----+--------+-----+---------|
| libc | | | | | |
|---------------+----------+-----+--------+-----+---------|
| fork | | 2 | 57 | 2 | 2 |
| read | | 3 | 0 | 3 | 3 |
| open | | 5 | 2 | 5 | 5 |
| waitpid | | 7 | | | |
| wait4 | waitpid | 114 | 61 | 114 | 114 |
| execve | | 11 | 59 | 11 | 11 |
| chmod | | 15 | 90 | 15 | 15 |
| access | | 33 | 21 | 33 | 33 |
| brk | | 45 | 12 | 45 | 45 |
| ioctl | | 54 | 16 | 54 | 54 |
| fsync | | 118 | 74 | 118 | 118 |
| getcwd | | 183 | 79 | 183 | 183 |
| dup | | 41 | 32 | 41 | 41 |
| dup2 | | 63 | 33 | 63 | 63 |
| unlink | | 10 | 87 | 10 | 10 |
| gettimeofday | time | 78 | 96 | 78 | 78 |
| clock_gettime | | 265 | 228 | 263 | 260 |
| time | | 13 | 201 | 13 | |
|---------------+----------+-----+--------+-----+---------|
| libc+tcc | | | | | |
|---------------+----------+-----+--------+-----+---------|
| close | | 6 | 3 | 6 | 6 |
| lseek | | 19 | 8 | 19 | 19 |
| rmdir | | 40 | 84 | 40 | 40 |
| stat | | 106 | 4 | 106 | 106 |
|---------------+----------+-----+--------+-----+---------|
| libc+GNU | | | | | |
|---------------+----------+-----+--------+-----+---------|
| chdir | | 12 | 80 | 12 | 12 |
| link | | 9 | 86 | 9 | 9 |
| getpid | | 20 | 39 | 20 | 20 |
| getuid | | 24 | 102 | 24 | 199 |
| kill | | 37 | 62 | 37 | 37 |
| rename | | 38 | 82 | 38 | 38 |
| mkdir | | 39 | 83 | 39 | 39 |
| pipe | | 42 | 22 | 42 | 42 |
| getgid | | 47 | 104 | 47 | 200 |
| signal | | 48 | | | 48 |
| sigaction | | 67 | | 67 | 67 |
| rt_sigaction | | 174 | 13 | 174 | 174 |
| signal | | 48 | | | 48 |
| fcntl | | 55 | 72 | 55 | 55 |
| getrusage | | 77 | 98 | 77 | 77 |
| lstat | | 107 | 6 | 107 | 107 |
| setitimer | | 104 | 38 | 104 | 104 |
| fstat | | 108 | 5 | 108 | 108 |
| nanosleep | | 162 | 35 | 162 | 162 |
| getdents | | 141 | 78 | 141 | 141 |
|---------------+----------+-----+--------+-----+---------|
| GNU+bash | | | | | |
|---------------+----------+-----+--------+-----+---------|
| setuid | | 23 | 105 | 23 | 213 |
| geteuid | | 49 | 107 | 49 | 201 |
| getegid | | 50 | 108 | 50 | 202 |
| setgid | | 46 | 106 | 46 | 214 |
| getppid | | 64 | 110 | 64 | 64 |
|---------------+----------+-----+--------+-----+---------|
| GNU+make | | | | | |
|---------------+----------+-----+--------+-----+---------|
| sigprocmask | | 126 | | 126 | 126 |
|---------------+----------+-----+--------+-----+---------|
| GNU+tar | | | | | |
|---------------+----------+-----+--------+-----+---------|
| symlink | | 83 | 88 | 83 | 83 |
| readlink | | 85 | 89 | 85 | 85 |
| mknod | | 14 | 133 | 14 | 14 |
|---------------+----------+-----+--------+-----+---------|
| new | | | | | |
|---------------+----------+-----+--------+-----+---------|
| clone | fork | 120 | 56 | 120 | 120 |
| getdents64 | getdents | 220 | 217 | 217 | 220 |
| openat | open | 295 | 257 | 322 | 288 |
| mkdirat | mkdir | 296 | 258 | 323 | 289 |
| mknodat | mknod | 297 | 259 | 324 | 290 |
| unlinkat | rmdir | 301 | 263 | 328 | 294 |
| unlinkat | unlink | 301 | 263 | 328 | 294 |
| renameat | rename | 302 | 264 | 329 | 295 |
| linkat | link | 303 | 265 | 330 | 296 |
| symlinkat | symlink | 304 | 266 | 331 | 297 |
| readlinkat | readlink | 305 | 267 | 332 | 298 |
| fchmodat | chmod | 306 | 268 | 333 | 299 |
| faccessat | access | 307 | 269 | 334 | 300 |
| dup3 | dup2 | 330 | 292 | 358 | 326 |
| pipe2 | pipe | 331 | 293 | 359 | 325 |
|---------------+----------+-----+--------+-----+---------|
* Sources
https://github.com/torvalds/linux/blob/v4.19/arch/arm/tools/syscall.tbl
https://github.com/torvalds/linux/blob/v4.19/arch/x86/entry/syscalls/syscall_32.tbl
https://github.com/torvalds/linux/blob/v4.19/arch/x86/entry/syscalls/syscall_64.tbl
* Legalese
Copyright © 2022 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.

View File

@ -18,39 +18,54 @@
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
/* Commentary:
* See https://github.com/torvalds/linux/blob/v4.19/arch/arm/tools/syscall.tbl
*
* Code:
*/
#ifndef __MES_LINUX_ARM_SYSCALL_H
#define __MES_LINUX_ARM_SYSCALL_H 1
/* See https://github.com/torvalds/linux/blob/v4.19/arch/arm/tools/syscall.tbl */
/* libc-mini */
#ifndef SYS_exit
// CONSTANT SYS_exit 0x01
#define SYS_exit 0x01
#endif
#ifndef SYS_write
// CONSTANT SYS_write 0x04
#define SYS_write 0x04
#endif
/* libc */
// CONSTANT SYS_fork 0x02
#define SYS_fork 0x02
// CONSTANT SYS_read 0x03
#define SYS_read 0x03
// CONSTANT SYS_open 0x05
#define SYS_open 0x05
//#define SYS_waitpid
// CONSTANT SYS_wait4 0x72
#define SYS_wait4 0x72
// CONSTANT SYS_execve 0x0b
#define SYS_execve 0x0b
// CONSTANT SYS_chmod 0x0f
#define SYS_chmod 0x0f
// CONSTANT SYS_access 0x21
#define SYS_access 0x21
// CONSTANT SYS_brk 0x2d
#define SYS_brk 0x2d
// CONSTANT SYS_ioctl 0x36
#define SYS_ioctl 0x36
// CONSTANT SYS_fsync 0x76
#define SYS_fsync 0x76
// CONSTANT SYS_getcwd 0xb7
#define SYS_getcwd 0xb7
// CONSTANT SYS_dup 0x29
#define SYS_dup 0x29
// CONSTANT SYS_dup2 0x3f
#define SYS_dup2 0x3f
// CONSTANT SYS_unlink 0x0a
#define SYS_unlink 0x0a
// CONSTANT SYS_gettimeofday 0x4e
#define SYS_gettimeofday 0x4e
// CONSTANT SYS_clock_gettime 0x107
#define SYS_clock_gettime 0x107
/* libc+tcc */

View File

@ -1,46 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_LINUX_RISCV32_KERNEL_STAT_H
#define __MES_LINUX_RISCV32_KERNEL_STAT_H 1
// *INDENT-OFF*
struct stat
{
unsigned long st_dev;
unsigned long st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned long st_rdev;
long st_size; /* Linux: unsigned long; glibc: off_t (i.e. signed) */
unsigned long st_blksize;
unsigned long st_blocks;
time_t st_atime; /* Linux: unsigned long; glibc: time_t */
unsigned long st_atime_usec;
time_t st_mtime; /* Linux: unsigned long; glibc: time_t */
unsigned long st_mtime_usec;
time_t st_ctime; /* Linux: unsigned long; glibc: time_t */
unsigned long st_ctime_usec;
unsigned long __foo0;
unsigned long __foo1;
};
#endif // __MES_LINUX_RISCV32_KERNEL_STAT_H

View File

@ -1,46 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_LINUX_RISCV64_KERNEL_STAT_H
#define __MES_LINUX_RISCV64_KERNEL_STAT_H 1
// *INDENT-OFF*
struct stat
{
unsigned long st_dev;
unsigned long st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned long st_rdev;
long st_size;
unsigned long st_blksize;
unsigned long st_blocks;
time_t st_atime;
unsigned long st_atime_usec;
time_t st_mtime;
unsigned long st_mtime_usec;
time_t st_ctime;
unsigned long st_ctime_usec;
unsigned long __foo0;
unsigned long __foo1;
};
#endif // __MES_LINUX_RISCV64_KERNEL_STAT_H

View File

@ -1,101 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_LINUX_RISCV_SYSCALL_H
#define __MES_LINUX_RISCV_SYSCALL_H 1
/** RISC-V uses the asm-generic syscalls (asm-generic/unistd.h) with the
following configuration for 64-bit:
* #define __ARCH_WANT_NEW_STAT
* #define __ARCH_WANT_SET_GET_RLIMIT
* #define __ARCH_WANT_SYS_CLONE3
*/
#define MAKESTRING(s) #s
#define MAKESTRING2(s) MAKESTRING (rd_a7 ! ## s addi)
#define RISCV_SYSCALL(s) MAKESTRING2 (s)
// libc-mini
#ifndef SYS_exit
#define SYS_exit 93
#endif
#ifndef SYS_write
#define SYS_write 64
#endif
// libc
#define SYS_clone 220
#define SYS_read 63
#define SYS_openat 56
#define SYS_wait4 260
#define SYS_execve 221
#define SYS_fchmodat 53
#define SYS_faccessat 48
#define SYS_brk 214
#define SYS_ioctl 29
#define SYS_fsync 82
// libc+tcc
#define SYS_close 57
#define SYS_lseek 62
#define SYS_unlinkat 35
#define SYS_gettimeofday 169
#define SYS_getcwd 17
// libc+gnu
#define SYS_chdir 49
#define SYS_linkat 37
#define SYS_getpid 172
#define SYS_getuid 174
#define SYS_kill 129
#define SYS_renameat2 276
#define SYS_mkdirat 34
#define SYS_dup 23
#define SYS_pipe2 59
#define SYS_getgid 176
#define SYS_rt_sigaction 134
#define SYS_fcntl 25
#define SYS_dup3 24
#define SYS_getrusage 165
#define SYS_newfstatat 79
#define SYS_setitimer 103
#define SYS_fstat 80
#define SYS_nanosleep 101
#define SYS_getdents64 61
#define SYS_clock_gettime 113
// bash
#define SYS_setuid 146
#define SYS_geteuid 175
#define SYS_getegid 177
#define SYS_setgid 144
#define SYS_getppid 173
// make+POSIX
#define SYS_rt_sigprocmask 135
// tar
#define SYS_symlinkat 36
#define SYS_readlinkat 78
#define SYS_mknodat 33
#endif // __MES_LINUX_RISCV_SYSCALL_H

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -27,7 +26,6 @@ long _sys_call1 (long sys_call, long one);
long _sys_call2 (long sys_call, long one, long two);
long _sys_call3 (long sys_call, long one, long two, long three);
long _sys_call4 (long sys_call, long one, long two, long three, long four);
long _sys_call5 (long sys_call, long one, long two, long three, long four, long five);
long _sys_call6 (long sys_call, long one, long two, long three, long four, long five, long six);
#endif //__MES_SYSCALL_H

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -17,40 +17,55 @@
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
/* Commentary:
* See https://github.com/torvalds/linux/blob/v4.19/arch/x86/entry/syscalls/syscall_32.tbl
*
* Code:
*/
#ifndef __MES_LINUX_X86_SYSCALL_H
#define __MES_LINUX_X86_SYSCALL_H 1
/* libc-mini */
#ifndef SYS_exit
// CONSTANT SYS_exit 0x01
#define SYS_exit 0x01
#endif
#ifndef SYS_write
// CONSTANT SYS_write 0x04
#define SYS_write 0x04
#endif
/* libc */
// CONSTANT SYS_fork 0x02
#define SYS_fork 0x02
// CONSTANT SYS_read 0x03
#define SYS_read 0x03
// CONSTANT SYS_open 0x05
#define SYS_open 0x05
// CONSTANT SYS_waitpid 0x07
#define SYS_waitpid 0x07
// CONSTANT SYS_wait4 0x72
#define SYS_wait4 0x72
// CONSTANT SYS_execve 0x0b
#define SYS_execve 0x0b
// CONSTANT SYS_chmod 0x0f
#define SYS_chmod 0x0f
// CONSTANT SYS_access 0x21
#define SYS_access 0x21
// CONSTANT SYS_brk 0x2d
#define SYS_brk 0x2d
// CONSTANT SYS_ioctl 0x36
#define SYS_ioctl 0x36
// CONSTANT SYS_fsync 0x76
#define SYS_fsync 0x76
// CONSTANT SYS_getcwd 0xb7
#define SYS_getcwd 0xb7
// CONSTANT SYS_dup 0x29
#define SYS_dup 0x29
// CONSTANT SYS_dup2 0x3f
#define SYS_dup2 0x3f
// CONSTANT SYS_unlink 0x0a
#define SYS_unlink 0x0a
// CONSTANT SYS_gettimeofday 0x4e
#define SYS_gettimeofday 0x4e
// CONSTANT SYS_clock_gettime 0x109
#define SYS_clock_gettime 0x109
// CONSTANT SYS_time 0x0d
#define SYS_time 0x0d
/* libc+tcc */

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -17,21 +17,12 @@
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
/* Commentary:
* See https://github.com/torvalds/linux/blob/v4.19/arch/x86/entry/syscalls/syscall_64.tbl
*
* Code:
*/
#ifndef __MES_LINUX_X86_64_SYSCALL_H
#define __MES_LINUX_X86_64_SYSCALL_H 1
// libc-mini
#ifndef SYS_write
#define SYS_write 0x01
#endif
#ifndef SYS_exit
#define SYS_exit 0x3c
#endif
// #define SYS_write 0x01
// #define SYS_exit 0x3c
// libc
#define SYS_fork 0x39
@ -45,19 +36,16 @@
#define SYS_brk 0x0c
#define SYS_ioctl 0x10
#define SYS_fsync 0x4a
#define SYS_getcwd 0x4f
#define SYS_dup 0x20
#define SYS_dup2 0x21
#define SYS_unlink 0x57
#define SYS_gettimeofday 0x60
#define SYS_clock_gettime 0xe4
#define SYS_time 0xc9
// libc+tcc
#define SYS_close 0x03
#define SYS_time 0xc9
#define SYS_lseek 0x08
#define SYS_unlink 0x57
#define SYS_rmdir 0x54
#define SYS_gettimeofday 0x60
#define SYS_stat 0x04
#define SYS_getcwd 0x4f
// libc+gnu
#define SYS_chdir 0x50
@ -67,17 +55,20 @@
#define SYS_kill 0x3e
#define SYS_rename 0x52
#define SYS_mkdir 0x53
#define SYS_dup 0x20
#define SYS_pipe 0x16
#define SYS_getgid 0x68
#define SYS_rt_sigaction 0x0d
#define SYS_rt_sigreturn 0x0f
#define SYS_fcntl 0x48
#define SYS_dup2 0x21
#define SYS_getrusage 0x62
#define SYS_lstat 0x06
#define SYS_setitimer 0x26
#define SYS_fstat 0x05
#define SYS_nanosleep 0x33
#define SYS_getdents 0x4e
#define SYS_clock_gettime 0xe4
// bash
#define SYS_setuid 0x69

70
include/m2/lib.h Normal file
View File

@ -0,0 +1,70 @@
/*
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __M2_LIB_H
#define __M2_LIB_H
char **environ;
int __stdin;
int __stdout;
int __stderr;
int errno;
// CONSTANT EOF 0xffffffff
// CONSTANT __FILEDES_MAX 512
char* cast_intp_to_charp (int *i);
char* cast_long_to_charp (long i);
long cast_charp_to_long (char const *);
long cast_int_to_long (int i);
long cast_voidp_to_long (void const *);
char *itoa (int number);
char *ltoa (long number);
int __ungetc_p (int filedes);
int eputs (char *s);
int oputs (char *s);
int puts (char *s);
size_t strlen (char *s);
ssize_t _write ();
ssize_t write (int filedes, void *buffer, size_t size);
void __ungetc_clear (int filedes);
void __ungetc_init ();
void __ungetc_set (int filedes, int c);
struct timezone
{
int tz_minuteswest;
int tz_dsttime;
};
struct timespec
{
long tv_sec;
long tv_nsec;
};
struct timeval
{
long tv_sec;
long tv_usec;
};
#endif /* __M2_LIB_H */

View File

@ -20,13 +20,6 @@
#ifndef __M2_TYPES_H
#define __M2_TYPES_H 1
// FIXME M2_Planet chokes on -1, even inside #if ! __M2__
#if __arm__ || __i386__
#define EOF 0xffffffff
#else
#define EOF 0xffffffffffffffff
#endif
/*
#ifndef __MES_CLOCK_T
#define __MES_CLOCK_T

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -23,32 +23,76 @@
/* Cell types */
// CONSTANT TCHAR 0
#define TCHAR 0
// CONSTANT TBYTES 1
#define TBYTES 1
// CONSTANT TCLOSURE 2
#define TCLOSURE 2
// CONSTANT TCONTINUATION 3
#define TCONTINUATION 3
// CONSTANT TKEYWORD 4
#define TKEYWORD 4
// CONSTANT TMACRO 5
#define TMACRO 5
// CONSTANT TNUMBER 6
#define TNUMBER 6
// CONSTANT TPAIR 7
#define TPAIR 7
// CONSTANT TPORT 8
#define TPORT 8
// CONSTANT TREF 9
#define TREF 9
// CONSTANT TSPECIAL 10
#define TSPECIAL 10
// CONSTANT TSTRING 11
#define TSTRING 11
// CONSTANT TSTRUCT 12
#define TSTRUCT 12
// CONSTANT TSYMBOL 13
#define TSYMBOL 13
// CONSTANT TVALUES 14
#define TVALUES 14
// CONSTANT TVARIABLE 15
#define TVARIABLE 15
// CONSTANT TVECTOR 16
#define TVECTOR 16
// CONSTANT TBROKEN_HEART 17
#define TBROKEN_HEART 17
/* Struct types */
// CONSTANT STRUCT_TYPE 0
#define STRUCT_TYPE 0
// CONSTANT STRUCT_PRINTER 1
#define STRUCT_PRINTER 1
// CONSTANT GC_FRAME_SIZE 5
#define GC_FRAME_SIZE 5
// CONSTANT GC_FRAME_PROCEDURE 4
#define GC_FRAME_PROCEDURE 4
// CONSTANT STDIN 0
// CONSTANT STDOUT 1
// CONSTANT STDERR 2
/* Unknown type 1
// CONSTANT EOF -1
*/
// CONSTANT O_RDONLY 0
// CONSTANT O_WRONLY 1
// CONSTANT O_CREAT 0x40
// CONSTANT O_TRUNC 0x200
// CONSTANT PATH_MAX 1024
// CONSTANT __FILEDES_MAX 512
// CONSTANT S_IRUSR 00400
// CONSTANT S_IWUSR 00200
// CONSTANT CLOCK_PROCESS_CPUTIME_ID 2
#endif /* __MES_CONSTANTS_H */

View File

@ -1,29 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_LIB_CC_H
#define __MES_LIB_CC_H
#define EOF -1
#if __TINYC__ || SYSTEM_LIBC
#define __raise(x) -1
#endif
#endif //__MES_LIB_CC_H

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2020,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -25,33 +25,26 @@
#include <mes/config.h>
#endif
// CONSTANT STDIN 0
#ifndef STDIN
#define STDIN 0
#endif
// CONSTANT STDOUT 1
#ifndef STDOUT
#define STDOUT 1
#endif
// CONSTANT STDERR 2
#ifndef STDERR
#define STDERR 2
#endif
/* M2-Planet does not support pointer arithmetic. Explicitly compensate
for that by multiplying with M2_PTR_SIZE when using (char)
pointers. */
#if __M2__
#define M2_PTR_SIZE sizeof (void*)
#else
#define M2_PTR_SIZE 1
#endif
extern char **environ;
extern int __stdin;
extern int __stdout;
extern int __stderr;
void __init_io ();
int eputs (char const *s);
int puts (char const *s);
int oputs (char const *s);
@ -70,14 +63,10 @@ int oputs (char const *s);
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
#undef size_t
#if __M2__
typedef unsigned size_t;
#else
typedef unsigned long size_t;
#endif
#endif
#endif
#endif
#ifndef _SSIZE_T
#define _SSIZE_T

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -22,10 +22,6 @@
#define __MES_LIB_H
#include <mes/lib-mini.h>
#include <mes/lib-cc.h>
#define __FILEDES_MAX 512
extern char *__brk;
char *cast_intp_to_charp (int const *i);
char *cast_long_to_charp (long i);
@ -38,11 +34,14 @@ void __ungetc_init ();
void __ungetc_clear (int filedes);
void __ungetc_set (int filedes, int c);
int __ungetc_p (int filedes);
double abtod (char const **p, int base);
long abtol (char const **p, int base);
char *dtoab (double number, int base, int signed_p);
char *itoa (int number);
char *ltoa (long number);
char *ltoab (long x, int base);
char *ntoab (long number, unsigned base, int signed_p);
char *ultoa (unsigned long number);
char *utoa (unsigned number);
int eputc (int c);
int fdgetc (int fd);
@ -62,11 +61,10 @@ char *search_path (char const *file_name);
ssize_t _read (int fd, void *buffer, size_t size);
void assert_msg (int check, char *msg);
long __mesabi_imod (long a, long b);
long __mesabi_idiv (long a, long b);
void *__memcpy (void *dest, void const *src, size_t n);
void *__memmove (void *dest, void const *src, size_t n);
void *__memset (void *s, int c, size_t n);
extern char *__brk;
extern void (*__call_at_exit) (void);
#define __FILEDES_MAX 512
#if !SYSTEM_LIBC
void __assert_fail (char const *s, char const *file, unsigned line,
@ -75,20 +73,18 @@ ssize_t __buffered_read (int filedes, void *buffer, size_t size);
size_t __buffered_read_clear (int filedes);
void _exit (int code);
long brk (void *addr);
#ifndef __raise
int __raise (int signal);
#endif
#endif // !SYSTEM_LIBC
#if !__M2__
extern void (*__call_at_exit) (void);
double abtod (char const **p, int base);
char *dtoab (double number, int base, int signed_p);
char *ultoa (unsigned long number);
long __mesabi_imod (long a, long b);
long __mesabi_idiv (long a, long b);
unsigned long __mesabi_umod (unsigned long a, unsigned long b);
unsigned long __mesabi_udiv (unsigned long a, unsigned long b);
unsigned long __mesabi_uldiv (unsigned long a, unsigned long b,
unsigned long *remainder);
#endif
void *__memcpy (void *dest, void const *src, size_t n);
void *__memmove (void *dest, void const *src, size_t n);
void *__memset (void *s, int c, size_t n);
int __raise (int signal);
#endif //__MES_LIB_H

View File

@ -53,15 +53,6 @@ struct scm
};
};
/* M2-Planet does not support pointer arithmetic. Explicitly compensate
for that by multiplying with M2_CELL_SIZE when using cell
pointers. */
#if __M2__
#define M2_CELL_SIZE sizeof (struct scm)
#else
#define M2_CELL_SIZE 1
#endif
/* mes */
extern char *g_datadir;
extern int g_debug;

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -137,8 +137,14 @@ extern struct scm *cell_type_broken_heart;
extern struct scm *cell_symbol_program;
extern struct scm *cell_symbol_test;
// CONSTANT SYMBOL_MAX 114
#define SYMBOL_MAX 114
// CONSTANT CELL_UNSPECIFIED 7
#define CELL_UNSPECIFIED 7
// CONSTANT CELL_SYMBOL_RECORD_TYPE 82
#define CELL_SYMBOL_RECORD_TYPE 82
#endif /* __MES_SYMBOLS_H */

View File

@ -29,12 +29,9 @@
#define _SIGSET_NITEMS (_NSIG / (8 * sizeof(unsigned long)))
#if !__M2__
typedef struct
{
typedef struct {
unsigned long items[_SIGSET_NITEMS];
} sigset_t;
#endif
typedef long stack_t;
#include <sys/types.h>
@ -94,7 +91,6 @@ typedef long stack_t;
#define SA_NOMASK SA_NODEFER
#define SA_ONESHOT SA_RESETHAND
#if !__M2__ // lacks short, casts
typedef struct siginfo_t
{
int si_signo;
@ -124,7 +120,7 @@ typedef struct siginfo_t
} siginfo_t;
// *INDENT-ON*
#if __M2__ || __MESC__
#if __MESC__
typedef long sighandler_t;
#else
typedef void (*sighandler_t) (int);
@ -259,7 +255,6 @@ int sigemptyset (sigset_t * set);
#endif
int sigprocmask (int how, sigset_t const *set, sigset_t * oldset);
#endif // !__M2__
#endif //! SYSTEM_LIBC
#endif // __MES_SIGNAL_H

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -27,19 +26,7 @@
#define va_arg8(ap, type) va_arg(ap, type)
#elif __GNUC__ && __riscv
// GCC on RISC-V always passes arguments in registers. Implementing these macros without
// the use of built-ins would be very involved.
typedef __builtin_va_list va_list;
#define va_start(v,l) __builtin_va_start(v,l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l)
#define va_arg8(ap, type) va_arg(ap, type)
#define va_copy(d,s) __builtin_va_copy(d,s)
#else // ! SYSTEM_LIBC && ! __riscv
#else // ! SYSTEM_LIBC
#include <sys/types.h>

View File

@ -87,7 +87,7 @@ typedef unsigned uintmax_t;
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#if __i386__ || __arm__ || __riscv_xlen == 32
#if __i386__ || __arm__
#define LONG_MIN INT_MIN
#define LONG_MAX INT_MAX
#define UINT_MAX UINT32_MAX
@ -95,7 +95,7 @@ typedef unsigned uintmax_t;
#define LLONG_MIN INT64_MIN
#define LLONG_MAX INT64_MAX
#define SIZE_MAX UINT32_MAX
#elif __x86_64__ || __riscv_xlen == 64
#elif __x86_64__
#define LONG_MIN INT64_MIN
#define LONG_MAX INT64_MAX
#define UINT_MAX UINT32_MAX

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -65,33 +65,30 @@ int ferror (FILE * stream);
int fflush (FILE * stream);
int fgetc (FILE * stream);
char *fgets (char *s, int size, FILE * stream);
int fprintf (FILE * stream, char const *format, ...);
int fpurge (FILE * stream);
int fputc (int c, FILE * stream);
int fputs (char const *s, FILE * stream);
int fscanf (FILE * stream, char const *template, ...);
int fseek (FILE * stream, long offset, int whence);
int getc (FILE * stream);
int getchar (void);
char *getlogin (void);
int printf (char const *format, ...);
int putc (int c, FILE * stream);
int putchar (int c);
int puts (char const *s);
int remove (char const *file_name);
int setvbuf (FILE * stream, char *buf, int mode, size_t size);
int snprintf (char *str, size_t size, char const *format, ...);
int sprintf (char *str, char const *format, ...);
int sscanf (char const *str, char const *format, ...);
int ungetc (int c, FILE * stream);
long ftell (FILE * stream);
size_t fread (void *ptr, size_t size, size_t count, FILE * stream);
size_t freadahead (FILE * fp);
size_t fwrite (void const *ptr, size_t size, size_t count, FILE * stream);
#if !__M2__
int fprintf (FILE * stream, char const *format, ...);
int fscanf (FILE * stream, char const *template, ...);
int printf (char const *format, ...);
int snprintf (char *str, size_t size, char const *format, ...);
int sprintf (char *str, char const *format, ...);
int sscanf (char const *str, char const *format, ...);
#endif // !__M2__
#endif // ! SYSTEM_LIBC
#endif // __MES_STDIO_H

View File

@ -28,13 +28,8 @@
#define TCGETS 0x5401
#define TCGETA 0x5405
#if __M2__
int ioctl (int fd, unsigned request, long data);
int ioctl3 (int fd, unsigned request, long data);
#else
int ioctl (int fd, unsigned long request, ...);
int ioctl3 (int fd, unsigned long request, long data);
#endif
#endif // ! SYSTEM_LIBC

View File

@ -32,20 +32,20 @@ struct rusage
{
struct timeval ru_utime;
struct timeval ru_stime;
long ru_maxrss;
long ru_ixrss;
long ru_idrss;
long ru_isrss;
long ru_minflt;
long ru_majflt;
long ru_nswap;
long ru_inblock;
long ru_oublock;
long ru_msgsnd;
long ru_msgrcv;
long ru_nsignals;
long ru_nvcsw;
long ru_nivcsw;
long int ru_maxrss;
long int ru_ixrss;
long int ru_idrss;
long int ru_isrss;
long int ru_minflt;
long int ru_majflt;
long int ru_nswap;
long int ru_inblock;
long int ru_oublock;
long int ru_msgsnd;
long int ru_msgrcv;
long int ru_nsignals;
long int ru_nvcsw;
long int ru_nivcsw;
};
#define RUSAGE_SELF 0

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,8 +20,6 @@
#ifndef __MES_SYS_TYPES_H
#define __MES_SYS_TYPES_H 1
#include <mes/lib-cc.h>
#if SYSTEM_LIBC
#undef __MES_SYS_TYPES_H
#include_next <sys/types.h>
@ -33,6 +31,10 @@
#define __MESCCLIB__ 15
#endif
#ifndef EOF
#define EOF -1
#endif
#ifndef NULL
#define NULL 0
#endif
@ -64,23 +66,15 @@ typedef unsigned gid_t;
#ifndef __MES_INO_T
#define __MES_INO_T
#undef ino_t
#if __M2__
typedef unsigned ino_t;
#else
typedef unsigned long ino_t;
#endif
#endif
#if __SIZEOF_LONG_LONG__ == 8
#ifndef __MES_INO64_T
#define __MES_INO64_T
#undef ino64_t
#if __M2__
typedef unsigned ino64_t;
#else
typedef unsigned long long ino64_t;
#endif
#endif
#endif // __SIZEOF_LONG_LONG__ == 8
#if !defined (__MES_INTPTR_T) && !defined (__intptr_t_defined)
@ -89,12 +83,8 @@ typedef unsigned long long ino64_t;
#undef intptr_t
typedef long intptr_t;
#undef uintptr_t
#if __M2__
typedef unsigned uintptr_t;
#else
typedef unsigned long uintptr_t;
#endif
#endif
#ifndef __MES_OFF_T
#define __MES_OFF_T
@ -106,12 +96,8 @@ typedef long off_t;
#ifndef __MES_OFF64_T
#define __MES_OFF64_T
#undef off64_t
#if __M2__
typedef unsigned off64_t;
#else
typedef unsigned long long off64_t;
#endif
#endif
#endif // __SIZEOF_LONG_LONG__ == 8
#ifndef __MES_PID_T
@ -140,13 +126,9 @@ typedef long sigval_t;
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
#undef size_t
#if __M2__
typedef unsigned size_t;
#else
typedef unsigned long size_t;
#endif
#endif
#endif
#ifndef __MES_SSIZE_T
#define __MES_SSIZE_T

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,8 +20,6 @@
#ifndef __MES_SYS_WAIT_H
#define __MES_SYS_WAIT_H 1
#include <sys/resource.h>
#if SYSTEM_LIBC
#undef __MES_SYS_WAIT_H
#include_next <sys/wait.h>
@ -37,8 +35,6 @@ typedef int pid_t;
pid_t waitpid (pid_t pid, int *status_ptr, int options);
pid_t wait (int *status_ptr);
pid_t wait4 (pid_t pid, int *wstatus, int options,
struct rusage *rusage);
#endif // ! SYSTEM_LIBC

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -27,8 +27,8 @@
#ifndef __MES_TIME_T
#define __MES_TIME_T 1
typedef long clockid_t;
typedef long time_t;
typedef long int clockid_t;
typedef long int time_t;
#endif
struct tm

View File

@ -1,25 +0,0 @@
#! /bin/sh
# Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# 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 <http://www.gnu.org/licenses/>.
# Usage:
# kaem --verbose --strict
cc_cpu=arm
mes_cpu=arm
stage0_cpu=armv7l
kaem --verbose --strict

View File

@ -1,26 +0,0 @@
#! /bin/sh
# Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# 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 <http://www.gnu.org/licenses/>.
# Usage:
# kaem --verbose --strict
cc_cpu=riscv64
mes_cpu=riscv64
stage0_cpu=riscv64
blood_elf_flag=--64
kaem --verbose --strict

View File

@ -1,6 +1,5 @@
#! /bin/sh
# Copyright © 2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
#
# This file is part of GNU Mes.
#
@ -20,53 +19,41 @@
# Usage:
# kaem --verbose --strict
cc_cpu=${cc_cpu:-i386}
mes_cpu=${mes_cpu:-x86}
stage0_cpu=${stage0_cpu:-x86}
blood_elf_flag=${blood_elf_flag:---little-endian}
mkdir -p m2
M2-Planet \
--bootstrap-mode \
--debug \
--architecture ${stage0_cpu} \
-D __${cc_cpu}__=1 \
-D __linux__=1 \
-f include/mes/config.h \
-f include/mes/lib-mini.h \
-f include/mes/lib.h \
-f include/m2/lib.h \
-f lib/linux/${mes_cpu}-mes-m2/crt1.c \
-f lib/mes/__init_io.c \
-f lib/linux/${mes_cpu}-mes-m2/_exit.c \
-f lib/linux/${mes_cpu}-mes-m2/_write.c \
-f lib/mes/globals.c \
-f lib/m2/cast.c \
-f lib/stdlib/exit.c \
-f lib/mes/write.c \
-f include/linux/${mes_cpu}/syscall.h \
-f lib/m2/exit.c \
-f lib/mes/mini-write.c \
-f lib/linux/${mes_cpu}-mes-m2/syscall.c \
-f include/linux/${mes_cpu}/syscall.h \
-f lib/stub/__raise.c \
-f lib/linux/brk.c \
-f lib/linux/malloc.c \
-f lib/m2/malloc.c \
-f lib/string/memset.c \
-f lib/linux/read.c \
-f lib/m2/read.c \
-f lib/mes/fdgetc.c \
-f lib/stdio/getchar.c \
-f lib/stdio/putchar.c \
-f lib/stub/__buffered_read.c \
-f include/fcntl.h \
-f lib/linux/_open3.c \
-f lib/linux/open.c \
-f lib/mes/mes_open.c \
-f lib/m2/open.c \
-f lib/m2/mes_open.c \
-f lib/string/strlen.c \
-f lib/mes/eputs.c \
-f lib/mes/fdputc.c \
-f lib/mes/eputc.c \
\
-f include/time.h \
-f include/sys/time.h \
-f include/m2/types.h \
-f include/sys/types.h \
-f include/mes/mes.h \
-f include/mes/builtins.h \
-f include/mes/constants.h \
@ -97,22 +84,17 @@ M2-Planet \
-f lib/linux/access.c \
-f include/linux/m2/kernel-stat.h \
-f include/sys/stat.h \
-f lib/linux/chmod.c \
-f lib/m2/chmod.c \
-f lib/linux/ioctl3.c \
-f include/sys/ioctl.h \
-f lib/m2/isatty.c \
-f include/signal.h \
-f lib/linux/fork.c \
-f lib/m2/execve.c \
-f lib/m2/execv.c \
-f include/sys/resource.h \
-f lib/linux/wait4.c \
-f lib/linux/waitpid.c \
-f lib/m2/waitpid.c \
-f lib/linux/gettimeofday.c \
-f lib/linux/clock_gettime.c \
-f lib/m2/clock_gettime.c \
-f lib/m2/time.c \
-f lib/linux/_getcwd.c \
-f include/limits.h \
-f lib/m2/getcwd.c \
-f lib/linux/dup.c \
-f lib/linux/dup2.c \
@ -130,7 +112,6 @@ M2-Planet \
-f src/math.c \
-f src/mes.c \
-f src/module.c \
-f include/signal.h \
-f src/posix.c \
-f src/reader.c \
-f src/stack.c \
@ -140,7 +121,7 @@ M2-Planet \
-f src/vector.c \
-o m2/mes.M1
blood-elf ${blood_elf_flag} --little-endian -f m2/mes.M1 -o m2/mes.blood-elf-M1
blood-elf --little-endian -f m2/mes.M1 -o m2/mes.blood-elf-M1
M1 \
--architecture ${stage0_cpu} \

View File

@ -1,25 +0,0 @@
#! /bin/sh
# Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# 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 <http://www.gnu.org/licenses/>.
# Usage:
# kaem --verbose --strict
cc_cpu=i386
mes_cpu=x86
stage0_cpu=x86
kaem --verbose --strict

View File

@ -1,27 +0,0 @@
#! /bin/sh
# Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
# 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 <http://www.gnu.org/licenses/>.
# Usage:
# kaem --verbose --strict
cc_cpu=x86_64
mes_cpu=x86_64
stage0_cpu=amd64
blood_elf_flag=--64
kaem --verbose --strict

View File

@ -269,7 +269,6 @@ DEFINE lsl____%r0,%r0,%r1 1001a0e1 # lsl %r0, %r0, %r1
DEFINE lsl____%r0,%r0,$i8 90a0e31009a0e1 # mov r9, #xx; lsl %r0, %r0, %r9
DEFINE lsl____%r1,%r1,$i8 90a0e31119a0e1 # mov r9, #xx; lsl %r1, %r1, %r9
DEFINE lsr____%r0,%r0,%r1 3001a0e1 # lsr %r0, %r0, %r1
DEFINE asr____%r0,%r0,%r1 5001a0e1 # asr %r0, %r0, %r1
DEFINE ldr____%r0,(%sp,#$i8) 009de5 # ldr r0, [r13+xx]
DEFINE ldr____%r1,(%sp,#$i8) 109de5 # ldr r1, [r13+xx]
#DEFINE add____%r2,%r0,%r1,lsl#4 012280e0

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2019,2020,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include "mes/lib-mini.h"
#define SYS_write "0x04"
#define SYS_exit "0x01"
// *INDENT-OFF*
ssize_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,20 +19,45 @@
*/
#include <mes/lib-mini.h>
int main (int argc, char *argv[], char *envp[]);
//int main (int argc, char *argv[], char *envp[]);
// *INDENT-OFF*
void
_start ()
{
asm (
"mov %ebp,%eax\n\t"
"add $4,%eax\n\t"
"mov (%eax),%eax\n\t"
"add $3,%eax\n\t"
"shl $2,%eax\n\t"
"add %ebp,%eax\n\t"
"push %eax\n\t"
"mov $0,%%eax\n\t"
"mov %%eax,%0\n"
: "=r" (__stdin)
: //no inputs ""
);
asm (
"mov $1,%%eax\n\t"
"mov %%eax,%0\n"
: "=r" (__stdout)
: //no inputs ""
);
asm (
"mov $2,%%eax\n\t"
"mov %%eax,%0\n"
: "=r" (__stderr)
: //no inputs ""
);
asm (
"mov %%ebp,%%eax\n\t"
"add $4,%%eax\n\t"
"mov (%%eax),%%eax\n\t"
"add $3,%%eax\n\t"
"shl $2,%%eax\n\t"
"add %%ebp,%%eax\n\t"
"mov %%eax,%0\n\t"
"push %%eax\n\t"
: "=r" (environ)
: //no inputs ""
);
asm (
"mov %ebp,%eax\n\t"
"add $8,%eax\n\t"
"push %eax\n\t"
@ -42,7 +67,6 @@ _start ()
"mov (%eax),%eax\n\t"
"push %eax\n\t"
"call __init_io\n\t"
"call main\n\t"
"push %eax\n\t"

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019,2021,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,11 +19,21 @@
*/
#include "mes/lib-mini.h"
int main (int argc, char *argv[], char *envp[]);
int
_start ()
{
asm ("mov____$i8,%eax !0");
asm ("mov____%eax,0x32 &__stdin");
asm ("mov____$i8,%eax !1");
asm ("mov____%eax,0x32 &__stdout");
asm ("mov____$i8,%eax !2");
asm ("mov____%eax,0x32 &__stderr");
asm ("mov____%ebp,%eax");
asm ("add____$i8,%eax !4");
@ -32,6 +42,7 @@ _start ()
asm ("shl____$i8,%eax !0x02");
asm ("add____%ebp,%eax");
asm ("mov____%eax,0x32 &environ");
asm ("push___%eax");
asm ("mov____%ebp,%eax");
@ -43,7 +54,6 @@ _start ()
asm ("mov____(%eax),%eax");
asm ("push___%eax");
__init_io ();
main ();
asm ("mov____%eax,%ebx");

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2023 Janneke Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of Mes.
*
@ -19,13 +19,13 @@
*/
#include <gnu/hurd.h>
int main (int argc, char *argv[], char *envp[]);
char **environ;
int __stdin;
int __stdout;
int __stderr;
int main ();
void _exit (int status);
void _hurd_start (void);

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -27,15 +26,7 @@
int
_open3 (char const *file_name, int flags, int mask)
{
long long_file_name = cast_charp_to_long (file_name);
#if defined (SYS_open)
int r = _sys_call3 (SYS_open, long_file_name, flags, mask);
#elif defined (SYS_openat)
int r = _sys_call4 (SYS_openat, AT_FDCWD, long_file_name, flags, mask);
#else
#error No usable open syscall
#endif
__ungetc_init ();
int r = _sys_call3 (SYS_open, (long) file_name, (int) flags, (int) mask);
if (r > 2)
{
__ungetc_clear (r);

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -22,18 +21,11 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <fcntl.h>
int
access (char const *file_name, int how)
{
long long_file_name = cast_charp_to_long (file_name);
long long_how = cast_int_to_long (how);
#if defined (SYS_access)
return _sys_call2 (SYS_access, long_file_name, long_how);
#elif defined (SYS_faccessat)
return _sys_call3 (SYS_faccessat, AT_FDCWD, long_file_name, long_how);
#else
#error No usable access sysall
#endif
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019,2020,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2019,2020 Danny Milosavljevic <dannym@scratchpost.org>
*
* This file is part of GNU Mes.
@ -20,7 +20,7 @@
*/
#include <mes/lib-mini.h>
int main (int argc, char *argv[], char *envp[]);
//int main (int argc, char *argv[], char *envp[]);
/* Note: GCC automatically emits a preable in order to set up the
frame pointer: "push {fp}" "add fp, sp, 0"
@ -30,6 +30,27 @@ frame pointer: "push {fp}" "add fp, sp, 0"
void
_start ()
{
asm (
"mov r0,#0\n\t"
"mov %0,r0\n"
: "=r" (__stdin)
: //no inputs ""
);
asm (
"mov r0,#1\n\t"
"mov %0,r0\n"
: "=r" (__stdout)
: //no inputs ""
);
asm (
"mov r0,#2\n\t"
"mov %0,r0\n"
: "=r" (__stderr)
: //no inputs ""
);
/* environ = argv + argc + 1 */
asm (
"ldr r0,[fp,#4]\n\t" /* r0 = argc */
@ -40,10 +61,14 @@ _start ()
"push {r2}\n\t" /* envp */
"push {r1}\n\t" /* argv */
"push {r0}\n\t" /* argc */
"mov %0,r2\n\t"
: "=r" (environ)
: //no inputs ""
);
asm (
"ldr r0,[sp]\n\t" /* argc */
"ldr r1,[sp, #4]\n\t" /* argv */
"ldr r2,[sp, #8]\n\t" /* envp */
"bl __init_io\n\t"
"bl main\n\t"
"mov r7, #1\n\t"
"swi #0\n\t"
@ -54,6 +79,31 @@ _start ()
void
_start ()
{
#if 0
__asm__ (".int 0xe320f000\n"); //nop {0}
__asm__ (".int 0xe320f000\n"); //nop {0}
#endif
int *in = &__stdin;
int *out = &__stdout;
int *err = &__stderr;
char ***env = &environ;
#if 0
__asm__ (".int 0xe320f000\n"); //nop {0}
__asm__ (".int 0xe320f000\n"); //nop {0}
__asm__ (".int 0xe320f000\n"); //nop {0}
*in = 0x22;
__asm__ (".int 0xe320f000\n"); //nop {0}
*out = 0x33;
__asm__ (".int 0xe320f000\n"); //nop {0}
*err = 0x44;
__asm__ (".int 0xe320f000\n"); //nop {0}
*env = 0x55;
__asm__ (".int 0xe320f000\n"); //nop {0}
#endif
/* environ = argv + argc + 1 */
__asm__ (".int 0xe59b000c\n"); //ldr r0, [fp, #12]
__asm__ (".int 0xe28b1010\n"); //add r1, fp, #16
@ -68,11 +118,34 @@ _start ()
__asm__ (".int 0xe52d0004\n"); //push {r0} ; (str r0, [sp, #-4]!)
__asm__ (".int 0xe1a02002\n"); //mov r2, r2
// *in = 0;
__asm__ (".int 0xe3a01000\n"); //mov r1, #0
__asm__ (".int 0xe51b0004\n"); //ldr r0, [fp, #-4]
__asm__ (".int 0xe5801000\n"); //str r1, [r0]
__asm__ (".int 0xe320f000\n"); //nop {0}
// *out = 1;
__asm__ (".int 0xe3a01001\n"); //mov r1, #1
__asm__ (".int 0xe51b0008\n"); //ldr r0, [fp, #-8]
__asm__ (".int 0xe5801000\n"); //str r1, [r0]
__asm__ (".int 0xe320f000\n"); //nop {0}
// *err = 2;
__asm__ (".int 0xe3a01002\n"); //mov r1, #2
__asm__ (".int 0xe51b000c\n"); //ldr r0, [fp, #-12]
__asm__ (".int 0xe5801000\n"); //str r1, [r0]
__asm__ (".int 0xe320f000\n"); //nop {0}
// *env = [sp, #8]
__asm__ (".int 0xe59d1008\n"); //ldr r1, [sp, #8]
__asm__ (".int 0xe51b0010\n"); //ldr r0, [fp, #-16]
__asm__ (".int 0xe5801000\n"); //str r1, [r0]
__asm__ (".int 0xe320f000\n"); //nop {0}
// setup argc, argv, envp parameters in registers
__asm__ (".int 0xe59d0000\n"); //ldr r0, [sp]
__asm__ (".int 0xe59d1004\n"); //ldr r1, [sp, #4]
__asm__ (".int 0xe59d2008\n"); //ldr r2, [sp, #8]
__init_io ();
main ();
__asm__ (".int 0xe3a07001\n"); //mov r7, #1

View File

@ -1,6 +1,6 @@
### GNU Mes --- Maxwell Equations of Software
### Copyright (C) 2016 Jeremiah Orians
### Copyright © 2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
### Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
###
### This file is part of GNU Mes.
###
@ -32,10 +32,21 @@
'0' R0 R0 ADD BP ARITH2_ALWAYS ; ENVP_address = BP + OFFSET
{R0} PUSH_ALWAYS ; Put envp on the stack
mov____%r0,0x32 &GLOBAL_environ
;; Stack offset
!4 BP ADD BP ARITH_ALWAYS ; Fix BP
^~FUNCTION___init_io CALL_ALWAYS ; Init libc
;;^~FUNCTION___init_io CALL_ALWAYS ; Setup for FILE*
;; Initialize MesCC lib file descriptors.
!0 mov____$i8,%r0
mov____%r0,0x32 &GLOBAL___stdin
!1 mov____$i8,%r0
mov____%r0,0x32 &GLOBAL___stdout
!2 mov____$i8,%r0
mov____%r0,0x32 &GLOBAL___stderr
^~FUNCTION_main CALL_ALWAYS ; Jump right into main
SYS_exit mov____$i8,%r7

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
*
* This file is part of GNU Mes.
@ -20,6 +20,7 @@
*/
#include "mes/lib-mini.h"
int main (int argc, char *argv[], char *envp[]);
void /* must not return */
@ -35,6 +36,21 @@ environ = &argv[argc + 1]
HOWEVER, the function entry already allocated space for locals on the stack (after saving lr and fp, which moved sp again). Hence, use fp instead of sp.
*/
/* stdin = 0 */
asm ("!0 mov____$i8,%r0");
asm ("mov____%r0,0x32 &__stdin");
/* stdout = 1 */
asm ("!1 mov____$i8,%r0");
asm ("mov____%r0,0x32 &__stdout");
/* stderr = 2 */
asm ("!2 mov____$i8,%r0");
asm ("mov____%r0,0x32 &__stderr");
/* Add "environ" to main's arguments */
asm ("!8 ldr____%r0,(%fp,+#$i8)"); /* "argc" */
@ -47,7 +63,10 @@ HOWEVER, the function entry already allocated space for locals on the stack (aft
asm ("push___%r1"); /* argv */
asm ("push___%r0"); /* argc */
__init_io ();
/* environ = r2 */
asm ("mov____%r2,0x32 &environ");
main ();
asm ("SYS_exit mov____$i8,%r7");

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -23,18 +22,11 @@
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <sys/stat.h>
#include <fcntl.h>
int
chmod (char const *file_name, mode_t mask)
{
long long_file_name = cast_charp_to_long (file_name);
long long_mask = cast_int_to_long (mask);
#if defined (SYS_chmod)
return _sys_call2 (SYS_chmod, long_file_name, long_mask);
#elif defined (SYS_fchmodat)
return _sys_call3 (SYS_fchmodat, AT_FDCWD, long_file_name, long_mask);
#else
#error No usable chmod syscall
#endif
}

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -27,11 +26,5 @@ dup2 (int old, int new)
{
long long_old = old;
long long_new = new;
#if defined (SYS_dup2)
return _sys_call2 (SYS_dup2, long_old, long_new);
#elif defined (SYS_dup3)
return _sys_call3 (SYS_dup3, long_old, long_new, 0);
#else
#error No usable dup2 syscall
#endif
}

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -21,17 +20,9 @@
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <signal.h>
#include <unistd.h>
int
fork ()
{
#if defined (SYS_fork)
return _sys_call (SYS_fork);
#elif defined (SYS_clone)
return _sys_call4 (SYS_clone, SIGCHLD, 0, NULL, 0);
#else
#error No usable clone syscall found
#endif
}

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -26,11 +25,5 @@
int
getdents (int filedes, char *buffer, size_t nbytes)
{
#if defined (SYS_getdents)
return _sys_call3 (SYS_getdents, (int) filedes, (long) buffer, (long) nbytes);
#elif defined (SYS_getdents64)
return _sys_call3 (SYS_getdents64, (int) filedes, (long) buffer, (long) nbytes);
#else
#error No usable getdents syscall
#endif
}

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -21,16 +20,9 @@
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <fcntl.h>
int
link (char const *old_name, char const *new_name)
{
#if defined (SYS_link)
return _sys_call2 (SYS_link, (long) old_name, (long) new_name);
#elif defined (SYS_linkat)
return _sys_call4 (SYS_linkat, AT_FDCWD, (long) old_name, AT_FDCWD, (long) new_name);
#else
#error No usable link syscall
#endif
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -24,23 +24,23 @@
#include <stdio.h>
#include <sys/types.h>
#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */
off_t
_lseek (int filedes, off_t offset, int whence)
{
long long_offset = offset;
return _sys_call3 (SYS_lseek, filedes, long_offset, whence);
return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence);
}
#endif
off_t
lseek (int filedes, off_t offset, int whence)
{
#if !__MESC__ && !__M2__
#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */
if (_lseek (filedes, 0, SEEK_CUR) == -1)
return -1;
#endif
size_t skip = __buffered_read_clear (filedes);
if (whence == SEEK_CUR)
offset -= skip;
long long_offset = offset;
return _sys_call3 (SYS_lseek, filedes, long_offset, whence);
return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence);
}

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -21,18 +20,10 @@
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <fcntl.h>
#include <sys/stat.h>
int
lstat (char const *file_name, struct stat *statbuf)
{
#if defined (SYS_lstat)
return _sys_call2 (SYS_lstat, (long) file_name, (long) statbuf);
#elif defined (SYS_newfstatat)
return _sys_call4 (SYS_newfstatat, AT_FDCWD, (long) file_name, (long) statbuf, 0);
#else
#error No usable stat syscall
#endif
return 0;
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 Danny Milosavljevic <dannym@scratchpost.org>
*
* This file is part of GNU Mes.
@ -31,11 +31,9 @@ malloc (size_t size)
{
if (!__brk)
__brk = cast_long_to_charp (brk (0));
#if !__M2__
/* align what we give back. */
__brk = (char*) (((uintptr_t) __brk
+ sizeof (max_align_t) - 1) & -sizeof (max_align_t));
#endif
if (brk (__brk + size) == -1)
return 0;
char *p = __brk;

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -21,17 +20,10 @@
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <fcntl.h>
#include <sys/stat.h>
int
mkdir (char const *file_name, mode_t mode)
{
#if defined (SYS_mkdir)
return _sys_call2 (SYS_mkdir, (long) file_name, (long) mode);
#elif defined (SYS_mkdirat)
return _sys_call3 (SYS_mkdirat, AT_FDCWD, (long) file_name, (long) mode);
#else
#error No usable mkdir syscall
#endif
}

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -22,16 +21,9 @@
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <sys/stat.h>
#include <fcntl.h>
int
mknod (char const *file_name, mode_t mode, dev_t dev)
{
#if defined (SYS_mknod)
return _sys_call3 (SYS_mknod, (long) file_name, (long) mode, (long) dev);
#elif defined (SYS_mknodat)
return _sys_call4 (SYS_mknodat, AT_FDCWD, (long) file_name, (long) mode, (long) dev);
#else
#error No usable mknod syscall
#endif
}

View File

@ -1,62 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <mes/lib.h>
#include <fcntl.h>
#include <stdarg.h>
#if __M2__
int
open (char *file_name, int flags, int mask)
{
#if defined (SYS_open)
int r = _sys_call3 (SYS_open, file_name, flags, mask);
#elif defined (SYS_openat)
int r = _sys_call4 (SYS_openat, AT_FDCWD, file_name, flags, mask);
#else
#error No usable open syscall
#endif
if (r > 2)
__ungetc_clear (r);
return r;
}
#else // !__M2__
int
open (char const *file_name, int flags, ...)
{
va_list ap;
va_start (ap, flags);
int mask = va_arg (ap, int);
#if defined (SYS_open)
int r = _sys_call3 (SYS_open, (long) file_name, flags, mask);
#elif defined (SYS_openat)
int r = _sys_call4 (SYS_openat, AT_FDCWD, (long) file_name, flags, mask);
#else
#error No usable open syscall
#endif
va_end (ap);
if (r > 2)
__ungetc_clear (r);
return r;
}
#endif // !__M2__

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -22,16 +21,9 @@
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <unistd.h>
#include <fcntl.h>
int
pipe (int filedes[2])
{
#if defined (SYS_pipe)
return _sys_call1 (SYS_pipe, (long) filedes);
#elif defined (SYS_pipe2)
return _sys_call2 (SYS_pipe2, (long) filedes, 0);
#else
#error No usable pipe syscall found
#endif
}

View File

@ -27,9 +27,7 @@ ssize_t
read (int filedes, void *buffer, size_t size)
{
long long_filedes = filedes;
long long_buffer = cast_voidp_to_long (buffer);
ssize_t bytes = _sys_call3 (SYS_read, long_filedes, long_buffer, size);
#if !__M2__
ssize_t bytes = _sys_call3 (SYS_read, long_filedes, (long) buffer, (long) size);
if (__mes_debug () > 4)
{
if (bytes == 1)
@ -50,6 +48,5 @@ read (int filedes, void *buffer, size_t size)
eputs ("\n");
}
}
#endif
return bytes;
}

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -21,17 +20,10 @@
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <fcntl.h>
#include <sys/stat.h>
ssize_t
readlink (char const *file_name, char *buffer, size_t size)
{
#if defined (SYS_readlink)
return _sys_call3 (SYS_readlink, (long) file_name, (long) buffer, (long) size);
#elif defined (SYS_readlinkat)
return _sys_call4 (SYS_readlinkat, AT_FDCWD, (long) file_name, (long) buffer, (long) size);
#else
#error No usable readlink syscall
#endif
}

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -22,16 +21,9 @@
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <unistd.h>
#include <fcntl.h>
int
rename (char const *old_name, char const *new_name)
{
#if defined (SYS_rename)
return _sys_call2 (SYS_rename, (long) old_name, (long) new_name);
#elif defined (SYS_renameat2)
return _sys_call5 (SYS_renameat2, AT_FDCWD, (long) old_name, AT_FDCWD, (long) new_name, 0);
#else
#error No usable rename syscall
#endif
}

View File

@ -1,39 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "mes/lib-mini.h"
#define SYS_exit 93
// *INDENT-OFF*
void
_exit (int code)
{
register long __a7 asm ("a7") = SYS_exit;
register long __a0 asm ("a0") = code;
asm volatile (
"ecall\n\t"
: // no outputs
: "r" (__a0), "r" (__a7)
);
// not reached
_exit (0);
}

View File

@ -1,40 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "mes/lib-mini.h"
#define SYS_write 64
// *INDENT-OFF*
ssize_t
_write (int filedes, void const *buffer, size_t size)
{
register long __a7 asm ("a7") = (long) SYS_write;
register long __a0 asm ("a0") = (long) filedes;
register long __a1 asm ("a1") = (long) buffer;
register long __a2 asm ("a2") = (long) size;
asm volatile (
"ecall\n\t"
: "+r" (__a0)
: "r" (__a7), "r" (__a1), "r" (__a2)
);
return (ssize_t)__a0;
}

View File

@ -1,66 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019,2020,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2019,2020 Danny Milosavljevic <dannym@scratchpost.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int main (int argc, char *argv[], char *envp[]);
/* gcc will generate the following preamble:
addi sp,sp,-16
sd s0,8(sp)
addi s0,sp,16
*/
// *INDENT-OFF*
void
_start ()
{
asm (
".option push\n\t"
".option norelax\n\t"
"lla gp, __global_pointer$\n\t"
".option pop\n\t"
"andi sp, sp, ~15\n\t" // make sure sp conforms to ABI alignment
);
// environ is &argv[argc + 1]
asm (
"lw t0, 0(s0)\n\t"
"addi t1, s0, 8\n\t"
"addi t0, t0, 1\n\t"
"slli t0, t0, 3\n\t"
"add t0, t1, t0\n\t"
"lw a0, 0(s0)\n\t" // a0 argc
"addi a1, s0, 8\n\t" // a1 argv
"mv a2, t0\n\t" // a2 envp
"jal __init_io\n\t"
"jal main\n\t"
"li a7, 93\n\t" // SYS_exit
"ecall\n\t" // exit(return value from main)
"ebreak\n\t"
: //no outputs ""
: "r" (environ)
);
}

View File

@ -1,31 +0,0 @@
/*
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/** Code: */
SYS_exit = 93 /* Linux syscalls. */
.globl _start /* Magic linker symbol: --entry-address. */
.text /* Program text. */
_start:
li a7, SYS_exit /* System call function: exit, in a7. */
li a0, 42 /* 1st parameter: exit status, in a0. */
ecall /* Call system. */
wfi /* Should not be reached. */

View File

@ -1,45 +0,0 @@
/*
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/** Code: */
SYS_exit = 93 /* Linux syscalls. */
SYS_write = 64
stdout = 1 /* File descriptor */
.globl _start /* Magic linker symbol: --entry-address. */
.text /* Program text. */
hello: .ascii "Hello, GNU Mes!\n"
bye:
.equ string_size, (bye - hello)
_start:
li a7, SYS_write /* System call function: write, in a7. */
li a0, stdout /* 1st parameter: file descriptor, in a0. */
.equ string_offset, (hello - .)
auipc a1, 0 /* Load pc for pc-relative address */
addi a1, a1, string_offset /* 2nd parameter: address, in a1. */
li a2, string_size /* 3rd parameter: byte count a2. */
ecall /* Call system. */
li a7, SYS_exit /* System call function: exit, in a7. */
li a0, 0 /* 1st parameter: exit status, in a0. */
ecall /* Call system. */
wfi /* Should not be reached. */

View File

@ -1,62 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <linux/riscv64/syscall.h>
// *INDENT-OFF*
static long
__sys_call_internal (long sys_call)
{
register long __a7 asm ("a7") = sys_call;
register long __a0 asm ("a0");
asm volatile (
"ecall\n\t"
: "=r" (__a0)
: "r" (__a7)
);
return __a0;
}
static long
__sys_call2_internal (long sys_call, long one, long two)
{
register long __a7 asm ("a7") = sys_call;
register long __a0 asm ("a0") = one;
register long __a1 asm ("a1") = two;
asm volatile (
"ecall\n\t"
: "+r" (__a0)
: "r" (__a7), "r" (__a1)
);
return __a0;
}
// *INDENT-ON*
/* Returns < 0 on error (errno-like value from kernel), or 0 on success */
int
__raise (int signum)
{
long pid = __sys_call_internal (SYS_getpid);
if (pid < 0)
return pid;
else
return __sys_call2_internal (SYS_kill, pid, signum);
}

View File

@ -1,197 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <linux/riscv64/syscall.h>
// *INDENT-OFF*
long
__sys_call (long sys_call)
{
register long __a7 asm ("a7") = sys_call;
register long __a0 asm ("a0");
asm volatile (
"ecall\n\t"
: "=r" (__a0)
: "r" (__a7)
);
return __a0;
}
long
__sys_call1 (long sys_call, long one)
{
register long __a7 asm ("a7") = sys_call;
register long __a0 asm ("a0") = one;
asm volatile (
"ecall\n\t"
: "+r" (__a0)
: "r" (__a7)
);
return __a0;
}
long
__sys_call2 (long sys_call, long one, long two)
{
register long __a7 asm ("a7") = sys_call;
register long __a0 asm ("a0") = one;
register long __a1 asm ("a1") = two;
asm volatile (
"ecall\n\t"
: "+r" (__a0)
: "r" (__a7), "r" (__a1)
);
return __a0;
}
long
__sys_call3 (long sys_call, long one, long two, long three)
{
register long __a7 asm ("a7") = sys_call;
register long __a0 asm ("a0") = one;
register long __a1 asm ("a1") = two;
register long __a2 asm ("a2") = three;
asm volatile (
"ecall\n\t"
: "+r" (__a0)
: "r" (__a7), "r" (__a1), "r" (__a2)
);
return __a0;
}
long
__sys_call4 (long sys_call, long one, long two, long three, long four)
{
register long __a7 asm ("a7") = sys_call;
register long __a0 asm ("a0") = one;
register long __a1 asm ("a1") = two;
register long __a2 asm ("a2") = three;
register long __a3 asm ("a3") = four;
asm volatile (
"ecall\n\t"
: "+r" (__a0)
: "r" (__a7), "r" (__a1), "r" (__a2), "r" (__a3)
);
return __a0;
}
long
__sys_call5 (long sys_call, long one, long two, long three, long four, long five)
{
register long __a7 asm ("a7") = sys_call;
register long __a0 asm ("a0") = one;
register long __a1 asm ("a1") = two;
register long __a2 asm ("a2") = three;
register long __a3 asm ("a3") = four;
register long __a4 asm ("a4") = five;
asm volatile (
"ecall\n\t"
: "+r" (__a0)
: "r" (__a7), "r" (__a1), "r" (__a2), "r" (__a3), "r" (__a4)
);
return __a0;
}
// *INDENT-ON*
long
_sys_call (long sys_call)
{
long r = __sys_call (sys_call);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call1 (long sys_call, long one)
{
long r = __sys_call1 (sys_call, one);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call2 (long sys_call, long one, long two)
{
long r = __sys_call2 (sys_call, one, two);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call3 (long sys_call, long one, long two, long three)
{
long r = __sys_call3 (sys_call, one, two, three);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call4 (long sys_call, long one, long two, long three, long four)
{
long r = __sys_call4 (sys_call, one, two, three, four);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call5 (long sys_call, long one, long two, long three, long four, long five)
{
long r = __sys_call5 (sys_call, one, two, three, four, five);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}

View File

@ -1,32 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2020,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "mes/lib-mini.h"
void
_exit (int status)
{
asm ("rd_a0 rs1_fp !-8 ld");
asm ("rd_a7 !93 addi # SYS_exit");
asm ("ecall");
// no need to read return value
}

View File

@ -1,34 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2020,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "mes/lib-mini.h"
void
_write (int filedes, void const *buffer, size_t size)
{
asm ("rd_a0 rs1_fp !-8 ld");
asm ("rd_a1 rs1_fp !-16 ld");
asm ("rd_a2 rs1_fp !-24 ld");
asm ("rd_a7 !64 addi # SYS_write");
asm ("ecall");
asm ("rd_t0 rs1_a0 mv");
}

View File

@ -1,53 +0,0 @@
## Copyright (C) 2021 Andrius Štikonas
## Copyright (C) 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
## Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
##
## 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/>.
:_start
rd_fp rs1_sp mv ; Protect stack pointer
; Prepare argv
rd_a0 rs1_fp !8 addi ; ARGV_address = FP + 8
rd_sp rs1_sp !-8 addi
rs1_sp rs2_a0 sd ; Put argv on the stack
; Prepare envp
rd_a0 rs1_fp mv ; Address we need to load from
rd_a0 rs1_a0 ld ; Get ARGC
rd_a0 rs1_a0 !2 addi ; OFFSET = ARGC + 2
rd_a0 rs1_a0 rs2_x3 slli ; OFFSET = OFFSET * WORDSIZE
rd_a0 rs1_fp rs2_a0 add ; ENVP_address = RSP + OFFSET
rd_sp rs1_sp !-8 addi
rs1_sp rs2_a0 sd ; Put envp on the stack
; Stack offset
rd_fp rs1_fp !8 addi
; Init libc
rd_ra $FUNCTION___init_io jal
; Call main function
rd_ra $FUNCTION_main jal
; Put return value on the stack so that _exit gets it
rd_sp rs1_sp !-16 addi
rs1_sp rs2_a0 sd
; Exit to kernel
rd_a0 rs1_sp ld
rd_a7 !93 addi ; Syscall for exit
ecall ; Exit with code in a0

View File

@ -1,34 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "mes/lib-mini.h"
int __stdin;
int __stdout;
int __stderr;
char **environ;
int main (int argc, char **argv, char **envp);
/* FIXME: this is going to be called `FUNCTION__start' */
//#int
//#_start ()
//#{
//# ..
//#}

View File

@ -1,183 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2020,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <linux/riscv64/syscall.h>
long
__sys_call (long sys_call)
{
asm ("rd_a7 rs1_fp !-8 ld");
asm ("ecall");
asm ("rd_t0 rs1_a0 mv");
}
long
__sys_call1 (long sys_call, long one)
{
asm ("rd_a7 rs1_fp !-8 ld");
asm ("rd_a0 rs1_fp !-16 ld");
asm ("ecall");
asm ("rd_t0 rs1_a0 mv");
}
long
__sys_call2 (long sys_call, long one, long two)
{
asm ("rd_a7 rs1_fp !-8 ld");
asm ("rd_a0 rs1_fp !-16 ld");
asm ("rd_a1 rs1_fp !-24 ld");
asm ("ecall");
asm ("rd_t0 rs1_a0 mv");
}
long
__sys_call3 (long sys_call, long one, long two, long three)
{
asm ("rd_a7 rs1_fp !-8 ld");
asm ("rd_a0 rs1_fp !-16 ld");
asm ("rd_a1 rs1_fp !-24 ld");
asm ("rd_a2 rs1_fp !-32 ld");
asm ("ecall");
asm ("rd_t0 rs1_a0 mv");
}
long
__sys_call4 (long sys_call, long one, long two, long three, long four)
{
asm ("rd_a7 rs1_fp !-8 ld");
asm ("rd_a0 rs1_fp !-16 ld");
asm ("rd_a1 rs1_fp !-24 ld");
asm ("rd_a2 rs1_fp !-32 ld");
asm ("rd_a3 rs1_fp !-40 ld");
asm ("ecall");
asm ("rd_t0 rs1_a0 mv");
}
long
__sys_call5 (long sys_call, long one, long two, long three, long four, long five)
{
asm ("rd_a7 rs1_fp !-8 ld");
asm ("rd_a0 rs1_fp !-16 ld");
asm ("rd_a1 rs1_fp !-24 ld");
asm ("rd_a2 rs1_fp !-32 ld");
asm ("rd_a3 rs1_fp !-40 ld");
asm ("rd_a4 rs1_fp !-48 ld");
asm ("ecall");
asm ("rd_t0 rs1_a0 mv");
}
long
_sys_call (long sys_call)
{
long r = __sys_call (sys_call);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call1 (long sys_call, long one)
{
long r = __sys_call1 (sys_call, one);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call2 (long sys_call, long one, long two)
{
long r = __sys_call2 (sys_call, one, two);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call3 (long sys_call, long one, long two, long three)
{
long r = __sys_call3 (sys_call, one, two, three);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call4 (long sys_call, long one, long two, long three, long four)
{
long r = __sys_call4 (sys_call, one, two, three, four);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call5 (long sys_call, long one, long two, long three, long four, long five)
{
long r = __sys_call5 (sys_call, one, two, three, four, five);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}

View File

@ -1,33 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "mes/lib-mini.h"
#include "linux/riscv64/syscall.h"
void
_exit (int status)
{
asm ("rd_a0 rs1_fp !16 ld");
asm (RISCV_SYSCALL(SYS_exit));
asm ("ecall");
// no need to read return value
}

View File

@ -1,35 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "mes/lib-mini.h"
#include "linux/riscv64/syscall.h"
void
_write (int filedes, void const *buffer, size_t size)
{
asm ("rd_a0 rs1_fp !16 ld");
asm ("rd_a1 rs1_fp !24 ld");
asm ("rd_a2 rs1_fp !32 ld");
asm (RISCV_SYSCALL(SYS_write));
asm ("ecall");
asm ("rd_t0 rs1_a0 mv");
}

View File

@ -1,60 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "mes/lib-mini.h"
#include "linux/riscv64/syscall.h"
int main (int argc, char *argv[], char *envp[]);
/* mesc will generate the following preamble:
push ra
push fp
*/
int
_start ()
{
asm ("rd_t1 rs1_fp mv");
asm ("rd_t1 rs1_t1 !0x18 addi"); // 0x10 to skip over pushed fp+ra, 0x8 to skip over argc
asm ("rd_t5 rs1_fp !0x10 addi"); // 0x10 to skip over pushed fp+ra
asm ("rd_t0 rs1_t5 ld");
asm ("rd_t0 rs1_t0 !1 addi");
asm ("rd_t5 !3 addi"); // skip over all arguments and the final NULL
asm ("rd_t0 rs1_t0 rs2_t5 sll");
asm ("rd_t0 rs1_t0 rs2_t1 add");
asm ("rd_sp rs1_sp !-8 addi"); // push envp onto stack
asm ("rs1_sp rs2_t0 sd");
asm ("rd_sp rs1_sp !-8 addi"); // push argv onto stack
asm ("rs1_sp rs2_t1 sd");
asm ("rd_t5 rs1_fp !0x10 addi"); // 0x10 to skip over pushed fp+ra
asm ("rd_t0 rs1_t5 ld");
asm ("rd_sp rs1_sp !-8 addi"); // push argc onto stack
asm ("rs1_sp rs2_t0 sd");
__init_io ();
main ();
asm ("rd_a0 rs1_t0 mv");
asm (RISCV_SYSCALL(SYS_exit));
asm ("ecall");
asm ("ebreak");
}

View File

@ -1,57 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
* Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <linux/riscv64/syscall.h>
static long
__sys_call_internal (long sys_call)
{
asm ("rd_a7 rs1_fp !16 ld");
asm ("ecall");
asm ("rd_t0 rs1_a0 mv");
}
static long
__sys_call2_internal (long sys_call, long one, long two)
{
asm ("rd_a7 rs1_fp !16 ld");
asm ("rd_a0 rs1_fp !24 ld");
asm ("rd_a1 rs1_fp !32 ld");
asm ("ecall");
asm ("rd_t0 rs1_a0 mv");
}
/* Return < 0 on error (errno-like value from kernel), or 0 on success */
int
__raise (int signum)
{
long pid = __sys_call_internal (SYS_getpid);
if (pid < 0)
return pid;
else
return __sys_call2_internal (SYS_kill, pid, signum);
}

Some files were not shown because too many files have changed in this diff Show More