Merge remote-tracking branch 'upstream/wip-riscv' into aarch64

This commit is contained in:
Artemis Tosini 2023-11-05 20:40:14 +00:00
commit 84491f3bd9
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
224 changed files with 6869 additions and 1174 deletions

5
.gitignore vendored
View file

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

1
.mailmap Normal file
View file

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

View file

@ -36,6 +36,10 @@ lib/div.c (__mesabi_log2i)
W. J. van der Laan <laanwj@protonmail.com> W. J. van der Laan <laanwj@protonmail.com>
Bugfixes for logand, 64bit build, and va_arg 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 List of imported files
@ -91,7 +95,7 @@ lib/m2/x86/x86_defs.M1
lib/m2/x86/ELF-x86.hex2 lib/m2/x86/ELF-x86.hex2
* legalese * legalese
Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> Copyright © 2016,2017,2018,2019,2020,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copying and distribution of this file, with or without modification, Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright are permitted in any medium without royalty provided the copyright

10
INSTALL
View file

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

15
NEWS
View file

@ -10,6 +10,21 @@ Copyright © 2016,2017,2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <jan
Please send Mes bug reports to bug-mes@gnu.org. 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 * Changes in 0.24.2 since 0.24.1
** Build ** Build
*** A number of compile warnings have been fixed. *** A number of compile warnings have been fixed.

View file

@ -22,7 +22,9 @@ to your config.scm and run guix system reconfigure.
For example (note: ARM is no longer a 'port', see HACKING) For example (note: ARM is no longer a 'port', see HACKING)
#+BEGIN_SRC bash #+BEGIN_SRC bash
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 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
#+END_SRC #+END_SRC
** Try it ** Try it
@ -75,7 +77,7 @@ a Reduced Binary seed, thus significantly reducing the Trusted Computing
Base (TCB), strategic decisions about the build process can start. Base (TCB), strategic decisions about the build process can start.
* Legalese * Legalese
Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]> Copyright © 2019,2022,2023 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]>
Copying and distribution of this file, with or without modification, Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright are permitted in any medium without royalty provided the copyright

26
README
View file

@ -4,11 +4,11 @@
#+SUBTITLE: Maxwell Equations of Software #+SUBTITLE: Maxwell Equations of Software
[[https://www.gnu.org/software/mes][GNU Mes]] is a Scheme interpreter and C compiler for bootstrapping the GNU [[https://www.gnu.org/software/mes][GNU Mes]] is a Scheme interpreter and C compiler for bootstrapping the GNU
System. Since version 0.22 it has again helped to halve the size of System. It has helped to decimate the number and size of binary seeds
opaque, uninspectable binary seeds that are currently being used in the that were used in the bootstrap of [[https://www.gnu.org/software/guix][GNU Guix]] 1.0. Recently, version
[[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 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
help create a full-source bootstrap as part of the [[https://bootstrappable.org][bootstrappable builds]] goal is to help create a full source bootstrap as part of the
effort for UNIX-like operating systems. [[https://bootstrappable.org][bootstrappable builds]] effort for any UNIX-like operating system.
The Scheme interpreter is written in ~5,000 LOC of simple C, and the C 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 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. 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 Mes + MesCC + Mes C Library can build a [[https://gitlab.com/janneke/tinycc][bootstrappable TinyCC]] that is
self-hosting. Using this tcc and the Mes C library we now have a self-hosting. Using this bootstrappable-tcc and the Mes C library we
Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, 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 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. i686-linux, x86_64-linux, armhf-linux and aarch64-linux.
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 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, GNU Guix's source/binary packaging transparency and McCarthy page 13, Guix's source/binary packaging transparency and
Jeremiah Orians's [[https://github.com/oriansj/stage0][stage0]] ~500 byte self-hosting hex assembler. Jeremiah Orians's [[https://github.com/oriansj/stage0][stage0]], a ~500-byte self-hosting hex assembler.
We are very grateful to NLNet for sponsoring the [[https://nlnet.nl/project/GNUMes][Reduced Binary Seed 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.]] 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 * Links
[0] https://www.gnu.org/software/mes [0] https://www.gnu.org/software/mes
[1] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25 [1] https://www.gnu.org/software/guix
[2] 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/
[3] https://bootstrappable.org [3] https://bootstrappable.org
[4] https://github.com/oriansj/m2-planet [4] https://github.com/oriansj/m2-planet
[5] https://savannah.nongnu.org/projects/mescc-tools [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 [14] https://nlnet.nl/project/GNUMes-ARM_RISC-V
* Legalese * Legalese
Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]> Copyright © 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]>
Copying and distribution of this file, with or without modification, Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright are permitted in any medium without royalty provided the copyright

View file

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

View file

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

View file

@ -2,6 +2,7 @@
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # 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. # This file is part of GNU Mes.
# #
@ -38,6 +39,8 @@ module/mescc/armv4/as.scm
module/mescc/armv4/info.scm module/mescc/armv4/info.scm
module/mescc/i386/as.scm module/mescc/i386/as.scm
module/mescc/i386/info.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/as.scm
module/mescc/x86_64/info.scm module/mescc/x86_64/info.scm
module/mescc/info.scm module/mescc/info.scm

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2019,2020,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2019,2020,2021,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -30,6 +30,7 @@ fi
. ./config.sh . ./config.sh
libc_mini_shared_SOURCES=" libc_mini_shared_SOURCES="
lib/mes/__init_io.c
lib/mes/eputs.c lib/mes/eputs.c
lib/mes/oputs.c lib/mes/oputs.c
" "
@ -74,7 +75,7 @@ libc_mini_SOURCES="$libc_mini_shared_SOURCES"
if test $mes_libc = mes; then if test $mes_libc = mes; then
libc_mini_SOURCES="$libc_mini_SOURCES libc_mini_SOURCES="$libc_mini_SOURCES
lib/mes/mini-write.c lib/mes/write.c
" "
fi fi
@ -107,8 +108,16 @@ lib/mes/ntoab.c
lib/mes/oputc.c lib/mes/oputc.c
lib/mes/ultoa.c lib/mes/ultoa.c
lib/mes/utoa.c lib/mes/utoa.c
"
# /include/mes/lib-cc.h already defines __raise.c as a macro for __TCC__
# if we include it in the target source lib it explodes when reading the
# function definition
if test $compiler != tcc; then
libmes_SOURCES="$libmes_SOURCES
lib/stub/__raise.c lib/stub/__raise.c
" "
fi
if test $mes_libc = mes; then if test $mes_libc = mes; then
libmes_SOURCES="$libmes_SOURCES libmes_SOURCES="$libmes_SOURCES
@ -215,6 +224,7 @@ lib/linux/malloc.c
lib/linux/_read.c lib/linux/_read.c
lib/linux/time.c lib/linux/time.c
lib/linux/unlink.c lib/linux/unlink.c
lib/linux/wait4.c
lib/linux/waitpid.c lib/linux/waitpid.c
lib/linux/$mes_cpu-mes-$compiler/syscall.c lib/linux/$mes_cpu-mes-$compiler/syscall.c
lib/linux/getpid.c lib/linux/getpid.c

View file

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

View file

@ -114,6 +114,9 @@ fi
if test -d mescc-lib/$mes_cpu-mes; then if test -d mescc-lib/$mes_cpu-mes; then
tar -cf- -C mescc-lib $mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir tar -cf- -C mescc-lib $mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir
fi fi
if test -d tcc-lib/$mes_cpu-mes; then
tar -cf- -C tcc-lib/$mes_cpu-mes . | tar -${v}xf- -C $DESTDIR$libdir
fi
mkdir -p ${DESTDIR}${guile_site_dir} mkdir -p ${DESTDIR}${guile_site_dir}
mkdir -p ${DESTDIR}${guile_site_ccache_dir} mkdir -p ${DESTDIR}${guile_site_ccache_dir}

View file

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

28
configure vendored
View file

@ -6,6 +6,7 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
;;; GNU Mes --- Maxwell Equations of Software ;;; GNU Mes --- Maxwell Equations of Software
;;; Copyright © 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020 Vagrant Cascadian <vagrant@reproducible-builds.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. ;;; configure: This file is part of GNU Mes.
;;; ;;;
@ -454,11 +455,11 @@ Some influential environment variables:
(deps (fold (lambda (program results) (deps (fold (lambda (program results)
(cons (check-program-version program) results)) (cons (check-program-version program) results))
'() '()
(list (make-dep "hex2" #:version '(1 4 0)) (list (make-dep "hex2" #:version '(1 5 0))
(make-dep "M1" #:version '(1 4 0)) (make-dep "M1" #:version '(1 5 0))
(make-dep "blood-elf" #:version '(2 0 0)) (make-dep "blood-elf" #:version '(2 0 1))
(make-dep "kaem" #:version '(1 0 0) #:optional? #t) (make-dep "kaem" #:version '(1 5 0) #:optional? #t)
(make-dep "M2-Planet" #:version '(1 9 0) #:optional? #t) (make-dep "M2-Planet" #:version '(1 11 0) #:optional? #t)
(make-dep "diff" #:optional? #t) (make-dep "diff" #:optional? #t)
(make-dep "guile" #:version '(2 0) #:commands '("guile-3.0" "guile-3" "guile-2.2" "guile-2.0" "guile-2" "guile") #:optional? #t) (make-dep "guile" #:version '(2 0) #:commands '("guile-3.0" "guile-3" "guile-2.2" "guile-2.0" "guile-2" "guile") #:optional? #t)
(make-dep "mes" #:version '(0 22) #:optional? #t) (make-dep "mes" #:version '(0 22) #:optional? #t)
@ -538,12 +539,12 @@ Some influential environment variables:
(mes-cpu (cond ((member mes-cpu '("i386" "i486" "i586" "i686")) "x86") (mes-cpu (cond ((member mes-cpu '("i386" "i486" "i586" "i686")) "x86")
((member mes-cpu '("arm" "armv4" "armv7l")) "arm") ((member mes-cpu '("arm" "armv4" "armv7l")) "arm")
(else mes-cpu))) (else mes-cpu)))
(mes-bits (if (member mes-cpu '("x86_64" "aarch64")) "64" (mes-bits (if (member mes-cpu '("x86_64" "riscv64" "aarch64")) "64"
"32")) "32"))
(mes-libc (if system-libc? "system" "mes")) (mes-libc (if system-libc? "system" "mes"))
(mes-kernel (car (filter (mes-kernel (car (filter
(compose not (compose not
(cut member <> '("pc" "portbld" "unknown"))) (cut member <> '("pc" "portbld" "unknown" "redhat")))
(cdr host-type-list)))) (cdr host-type-list))))
(mes-kernel (if (string-prefix? "freebsd" mes-kernel) "freebsd" mes-kernel)) (mes-kernel (if (string-prefix? "freebsd" mes-kernel) "freebsd" mes-kernel))
(mes-compiler (cond (gcc? "gcc") (tcc? "gcc") (mescc? "mescc") (else "bootstrap"))) (mes-compiler (cond (gcc? "gcc") (tcc? "gcc") (mescc? "mescc") (else "bootstrap")))
@ -556,12 +557,7 @@ Some influential environment variables:
(and (file-exists? "/bin/sh") "/bin/sh") (and (file-exists? "/bin/sh") "/bin/sh")
(file-name "sh" deps) (file-name "sh" deps)
"sh")) "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 (define* (substitute file-name pairs
#:key (target (if (string-suffix? ".in" file-name) #:key (target (if (string-suffix? ".in" file-name)
@ -580,7 +576,9 @@ Some influential environment variables:
(when (and (not (member mes-system '("arm-linux-mes" (when (and (not (member mes-system '("arm-linux-mes"
"aarch64-linux-mes" "aarch64-linux-mes"
"x86-linux-mes" "x86-linux-mes"
"x86_64-linux-mes"))) "x86_64-linux-mes"
"riscv32-linux-mes"
"riscv64-linux-mes")))
(not with-courage?)) (not with-courage?))
(stderr "platform not supported: ~a (stderr "platform not supported: ~a
See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system) See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
@ -656,7 +654,6 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
("@LDFLAGS@" . ,(or (getenv "LDFLAGS") "-static -g")) ("@LDFLAGS@" . ,(or (getenv "LDFLAGS") "-static -g"))
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") "")) ("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") "")) ("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
("@numbered_arch@" . ,(if numbered-arch? "true" "false"))
,@(map ,@(map
(lambda (o) (lambda (o)
@ -725,7 +722,6 @@ GNU Mes is configured for
libc: " mes-libc " libc: " mes-libc "
kernel: " mes-kernel " kernel: " mes-kernel "
system: " mes-system " system: " mes-system "
tools: " (if numbered-arch? "numbered" "named") " arch
bootstrap: " (if with-bootstrap? "yes" "no") " bootstrap: " (if with-bootstrap? "yes" "no") "
courageous: " (if with-courage? "yes" "no") " courageous: " (if with-courage? "yes" "no") "

View file

@ -2,6 +2,7 @@
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2023 Ekaitz Zarraga <ekaitz@elenq.tech>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -99,13 +100,6 @@ else
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')} GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')}
fi 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}) bindir=$(eval echo ${bindir-$prefix/bin})
datadir=$(eval echo ${datadir-$prefix/share}) datadir=$(eval echo ${datadir-$prefix/share})
docdir=$(eval echo ${docdir-$datadir/doc/mes}) docdir=$(eval echo ${docdir-$datadir/doc/mes})
@ -172,7 +166,6 @@ subst () {
-e s,"@M2_PLANET@,$M2_PLANET,"\ -e s,"@M2_PLANET@,$M2_PLANET,"\
-e s,"@KAEM@,$KAEM,"\ -e s,"@KAEM@,$KAEM,"\
-e s,"@MES_FOR_BUILD@,$MES_FOR_BUILD,"\ -e s,"@MES_FOR_BUILD@,$MES_FOR_BUILD,"\
-e s,"@numbered_arch@,$numbered_arch,"\
-e s,"@SHELL@,$SHELL,"\ -e s,"@SHELL@,$SHELL,"\
$1 > $2 $1 > $2
} }
@ -209,7 +202,7 @@ case "$host" in
esac esac
case "$mes_cpu" in case "$mes_cpu" in
x86_64) x86_64|riscv64)
mes_bits=64;; mes_bits=64;;
*) *)
mes_bits=32;; mes_bits=32;;

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 stage0-posix[0], starting from the 357-byte hex0 binary of the
bootstrap-seeds[1], as was promised at FOSDEM'21[2]. bootstrap-seeds[1], as was promised at FOSDEM'21[2].
We are exciteda that the NlNet Foundation[4] is again sponsoring this We are excited that the NlNet Foundation[4] is again sponsoring this
work! work!
What's next? What's next?

View file

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

108
doc/announce/ANNOUNCE-0.25 Normal file
View file

@ -0,0 +1,108 @@
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 nine months since the previous release, this
release represents 116 commits over two years by six 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:
11 Andrius Štikonas
1 Efraim Flashner
25 Ekaitz Zarraga
1 Emily Trau
63 Janneke Nieuwenhuizen
15 W. J. van der Laan

View file

@ -1,107 +1,80 @@
digraph "Guix bag" { digraph "Guix bag" {
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-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" [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/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [color = red]; "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = red]; "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [color = red]; "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [color = red]; "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [color = red]; "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red]; "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [color = red]; "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = red]; "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = red]; "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" [label = "binutils-mesboot0@2.20.1a", shape = box, fontname = sans];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red]; "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = red]; "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" [color = darkgoldenrod];
"/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = red]; "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" [color = darkgoldenrod];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" [label = "binutils-mesboot0@2.14", shape = box, fontname = sans]; "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [color = darkgoldenrod];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [color = cyan3]; "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkgoldenrod];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = cyan3]; "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkgoldenrod];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [color = cyan3]; "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkgoldenrod];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [color = cyan3]; "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkgoldenrod];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [color = cyan3]; "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" [label = "gzip-mesboot@1.2.4", shape = box, fontname = sans];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = cyan3]; "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = peachpuff4];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [color = cyan3]; "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = peachpuff4];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = cyan3]; "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = peachpuff4];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = cyan3]; "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = peachpuff4];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = cyan3]; "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = peachpuff4];
"/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = cyan3]; "/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/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = cyan3]; "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" [color = cyan3];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [label = "bash-mesboot0@2.05b", shape = box, fontname = sans]; "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" [color = cyan3];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = darkgoldenrod]; "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = cyan3];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = darkgoldenrod]; "/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/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkgoldenrod]; "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = cyan3];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkgoldenrod]; "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = cyan3];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkgoldenrod]; "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" [label = "mes-boot@0.24.2", shape = box, fontname = sans];
"/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkgoldenrod]; "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" [color = darkseagreen];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [label = "make-mesboot0@3.80", shape = box, fontname = sans]; "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkseagreen];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = magenta]; "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkseagreen];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = magenta]; "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkseagreen];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = magenta]; "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkseagreen];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = magenta]; "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" [label = "stage0-posix@1.4", shape = box, fontname = sans];
"/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = magenta]; "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/7zxbgnrnhvm7g8bz1m5knpsbdfxzxl9g-bootstrap-seeds-1.0.0.drv" [color = darkviolet];
"/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/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkviolet];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" [color = darkseagreen]; "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkviolet];
"/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/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkviolet];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkseagreen]; "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkviolet];
"/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/7zxbgnrnhvm7g8bz1m5knpsbdfxzxl9g-bootstrap-seeds-1.0.0.drv" [label = "bootstrap-seeds@1.0.0", shape = ellipse, fontname = sans];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkseagreen]; "/gnu/store/7zxbgnrnhvm7g8bz1m5knpsbdfxzxl9g-bootstrap-seeds-1.0.0.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkgoldenrod];
"/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkseagreen]; "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [label = "bootar@1b", shape = box, fontname = sans];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" [label = "mes-boot@0.22", shape = box, fontname = sans]; "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = peachpuff4];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" [color = peachpuff4]; "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [label = "guile-bootstrap@2.0", shape = ellipse, fontname = sans];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/a6nbjivhxp65wqj5s8rz0fnmwzqxmhry-bootstrap-mescc-tools-0.5.2.drv" [color = peachpuff4]; "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [label = "gash-boot@0.3.0", shape = box, fontname = sans];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = peachpuff4]; "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkseagreen];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = peachpuff4]; "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkseagreen];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = peachpuff4]; "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [label = "gash-utils-boot@0.2.0", shape = box, fontname = sans];
"/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = peachpuff4]; "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkviolet];
"/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" [label = "bootstrap-mes-rewired@0.19", shape = box, fontname = sans]; "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkviolet];
"/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" -> "/gnu/store/r7bbw2ywmgqp6m5a1hp0fs4lhc51w3sq-bootstrap-mes-0.drv" [color = cyan3]; "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkviolet];
"/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = cyan3]; "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" [label = "patch-mesboot@2.5.9", shape = box, fontname = sans];
"/gnu/store/r7bbw2ywmgqp6m5a1hp0fs4lhc51w3sq-bootstrap-mes-0.drv" [label = "bootstrap-mes@0", 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/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [label = "gash-boot@0.2.0", shape = box, fontname = sans]; "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = blue];
"/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkviolet]; "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = blue];
"/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkviolet]; "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = blue];
"/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [label = "bootar@1a", shape = box, fontname = sans]; "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = blue];
"/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-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/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [label = "make-mesboot0@3.80", 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/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = dimgrey];
"/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [label = "gash-utils-boot@0.1.0", shape = box, fontname = sans]; "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = dimgrey];
"/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = blue]; "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = dimgrey];
"/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = blue]; "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = dimgrey];
"/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = dimgrey];
"/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [label = "bzip2-mesboot@1.0.8", shape = box, fontname = sans]; "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" [label = "tcc-boot@0.9.27", 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/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.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/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.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/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.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/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = blue];
"/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.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/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = blue];
"/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [label = "gzip-mesboot@1.2.4", shape = box, fontname = sans]; "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = blue];
"/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 @set OPENPGP-SIGNING-KEY-ID 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273
@copying @copying
Copyright @copyright{} 2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen@* Copyright @copyright{} 2018,2019,2020,2021,2022,2023 Janneke Nieuwenhuizen@*
Permission is granted to copy, distribute and/or modify this document Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or under the terms of the GNU Free Documentation License, Version 1.3 or
@ -93,7 +93,11 @@ Bootstrapping
* The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk. * The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk.
* Invoking mes:: Running Mes, a minimalist Guile lookalike. * Invoking mes:: Running Mes, a minimalist Guile lookalike.
* Invoking mescc:: Running the MesCC bootstrap compiler. * Invoking mescc:: Running the MesCC bootstrap compiler.
* Invoking mesar:: * Invoking mesar:: Running the MesCC bootstrap archiver.
The Mes Bootstrap Process
* Full Source Bootstrap Deployments::
Invoking mes Invoking mes
@ -156,8 +160,8 @@ essential freedoms:
@item @item
The freedom to study how the program works, and change it so it does 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 your computing as you wish (freedom 1). Access to the source code
a precondition for this. is a precondition for this.
@item @item
The freedom to redistribute copies so you can help others (freedom The freedom to redistribute copies so you can help others (freedom
@ -165,8 +169,8 @@ essential freedoms:
@item @item
The freedom to distribute copies of your modified versions to others The freedom to distribute copies of your modified versions to others
(freedom 3). By doing this you can give the whole community a chance (freedom 3). By doing this you can give the whole community a
to benefit from your changes. Access to the source code is a chance to benefit from your changes. Access to the source code is a
precondition for this. precondition for this.
@end enumerate @end enumerate
@end quotation @end quotation
@ -325,12 +329,21 @@ from source.
@node Full Source Bootstrap @node Full Source Bootstrap
@section 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 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 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 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 the absolute minimum of binary seeds and all binary seeds need to be
inspectable and must be reviewed. How big would the absolute minimal inspectable and must be reviewed. How big would the absolute minimal
set be? 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}.
@menu @menu
* Stage0:: The Magical Self-Hosting Hex Assembler. * Stage0:: The Magical Self-Hosting Hex Assembler.
@ -558,14 +571,14 @@ later, including 2.2.x and 3.0.x,
@item @url{https://www.gnu.org/software/make/, GNU Make}. @item @url{https://www.gnu.org/software/make/, GNU Make}.
@item @url{https://savannah.gnu.org/projects/nyacc/, NYACC}, version 1.00.2, @item @url{https://savannah.gnu.org/projects/nyacc/, NYACC}, version 1.00.2,
@item @url{https://gcc.gnu.org, GCC's gcc}, version 2.95.3 or later, including 10.2.0, @item @url{https://gcc.gnu.org, GCC's gcc}, version 2.95.3 or later, including 10.2.0,
@item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.4.0, @item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.5.0,
@end itemize @end itemize
The following dependencies are optional: The following dependencies are optional:
@itemize @itemize
Support for building the bootstrap @file{bin/mes-m2} depends on Support for building the bootstrap @file{bin/mes-m2} depends on
@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.9.0. @item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.11.0.
@end itemize @end itemize
@cindex Guile, compatibility @cindex Guile, compatibility
@ -594,8 +607,8 @@ Bootstrapping Mes depends on the following packages:
@itemize @itemize
@item a POSIX-compatible shell @item a POSIX-compatible shell
@item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.4.0, @item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.5.0,
@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.9.0. @item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.11.0.
@item @url{https://savannah.gnu.org/projects/nyacc/, NYACC}, version 1.00.2, @item @url{https://savannah.gnu.org/projects/nyacc/, NYACC}, version 1.00.2,
@end itemize @end itemize
@ -684,17 +697,17 @@ responsibility.
* The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk. * The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk.
* Invoking mes:: Running Mes, a minimalist Guile lookalike. * Invoking mes:: Running Mes, a minimalist Guile lookalike.
* Invoking mescc:: Running the MesCC bootstrap compiler. * Invoking mescc:: Running the MesCC bootstrap compiler.
* Invoking mesar:: * Invoking mesar:: Running the MesCC bootstrap archiver.
@end menu @end menu
@node The Mes Bootstrap Process @node The Mes Bootstrap Process
@section The Mes Bootstrap Process @section The Mes Bootstrap Process
The Reduced Binary Seed bootstrap currently adopted by Guix@footnote{See The Full Source Bootstrap currently adopted by Guix@footnote{See
@file{gnu/packages/commencement.scm} in the @var{master} branch in Guix @file{gnu/packages/commencement.scm} in the @var{master} branch in Guix
git git
@url{https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/commencement.scm}}. @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 and armhf-linux. In its intiial form it is only available for x86-linux.
Currently, it goes like this: Currently, it goes like this:
@ -702,48 +715,48 @@ Currently, it goes like this:
gcc-mesboot (4.9.4) gcc-mesboot (4.9.4)
^ ^
| |
glibc-mesboot (2.16.0) (...)
^
|
gcc-mesboot1 (4.7.4)
^
|
binutils-mesboot (2.20.1a)
^
|
gcc-mesboot0 (2.95.3)
^
|
glibc-mesboot0 (2.2.5)
^ ^
| |
binutils-mesboot (2.20.1a), glibc-mesboot (2.2.5),
gcc-core-mesboot (2.95.3) gcc-core-mesboot (2.95.3)
^ ^
| |
make-mesboot0, diffutils-mesboot, binutils-mesboot0 (2.20.1a) patch-mesboot (2.5.9)
^ ^
| |
tcc-boot bootstrappable-tcc (0.9.26+31 patches)
^ ^
| |
tcc-boot0 gnu-make-mesboot0 (3.80)
^ ^
| |
mes-boot gzip-mesboot (1.2.4)
^
|
tcc-boot (0.9.27)
^
|
mes-boot (0.24.2)
^
|
stage0-posix (hex0..M2-Planet)
^ ^
| |
*
gash-boot, gash-utils-boot gash-boot, gash-utils-boot
^ ^
| |
* *
bootstrap-mescc-tools, bootstrap-mes (~12 MiB) bootstrap-seeds (357-bytes for x86)
bootstrap-guile (~48 MiB) ~~~
[bootstrap-guile-2.0.9 driver (~25 MiB)]
@end verbatim @end verbatim
@c This graph is generated from wip-bootstrap, doing: @c This graph is generated from Guix master, doing:
@c guix graph --type=bag -e '(@@ (gnu packages commencement) gcc-core-mesboot0)' > doc/images/gcc-mesboot-graph.dot @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 dot -T png doc/images/gcc-mesboot-graph.dot > doc/images/gcc-mesboot-graph.png @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 Here's a generated dependency diagram to for the initial bootstrap gcc
@ -751,12 +764,6 @@ that builds the rest of Guix.
@image{images/gcc-mesboot-graph,6in,,Reference graph of the gcc-core-mesboot0} @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 For now, this additional non-bootstrapped dependencies (i.e., binary
seeds) are taken for granted seeds) are taken for granted
@ -764,7 +771,53 @@ seeds) are taken for granted
bootstrap-guile bootstrap-guile
@end example @end example
Our next priority is to eleminate these one by one. 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
@node Invoking mes @node Invoking mes
@section Invoking mes @section Invoking mes

View file

@ -1,5 +1,6 @@
;;; GNU Mes --- Maxwell Equations of Software ;;; GNU Mes --- Maxwell Equations of Software
;;; Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2023 Ekaitz Zarraga <ekaitz@elenq.tech>
;;; ;;;
;;; This file is part of GNU Mes. ;;; This file is part of GNU Mes.
;;; ;;;
@ -31,6 +32,7 @@
#:use-module (gnu packages commencement) #:use-module (gnu packages commencement)
#:use-module (gnu packages cross-base) #:use-module (gnu packages cross-base)
#:use-module (gnu packages gcc) #:use-module (gnu packages gcc)
#:use-module (gnu packages gdb)
#:use-module (gnu packages graphviz) #:use-module (gnu packages graphviz)
#:use-module (gnu packages guile) #:use-module (gnu packages guile)
#:use-module (gnu packages man) #:use-module (gnu packages man)
@ -54,20 +56,19 @@
(define-public mescc-tools (define-public mescc-tools
(package (package
(name "mescc-tools") (name "mescc-tools")
(version "1.4.0") (version "1.5.0")
(source (origin (source (origin
(method git-fetch) (method url-fetch)
(uri (git-reference (uri (string-append
(url "https://git.savannah.nongnu.org/r/mescc-tools.git") "https://github.com/oriansj/mescc-tools/releases/download/"
(commit (string-append "Release_" version)) "Release_" version "/" name "-" version ".tar.gz"))
(recursive? #t))) ;for M2libc
(file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"0z2ni2qn2np1walcaqlxz8sinzb78d4hiq9glddzf26wxc226hs4")))) "1vjczlajyrbjcx9ld35vhdqbxfdwwy3axg0jray3iwnrf70qr700"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(supported-systems (supported-systems '("i686-linux" "x86_64-linux"
'("aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux")) "armhf-linux" "aarch64-linux"
"riscv32-linux" "riscv64-linux"))
(native-inputs (list which)) (native-inputs (list which))
(arguments (arguments
`(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
@ -87,19 +88,20 @@ get_machine.")
(define-public m2-planet (define-public m2-planet
(package (package
(name "m2-planet") (name "m2-planet")
(version "1.9.0") (version "1.11.0")
(source (origin (source (origin
(method git-fetch) (method url-fetch)
(uri (git-reference (uri (string-append
(url "https://github.com/oriansj/m2-planet") "https://github.com/oriansj/M2-Planet/releases/download/"
(commit (string-append "Release_" version)) "Release_" version "/" name "-" version ".tar.gz"))
(recursive? #t))) ;for M2libc
(file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"0cgvvq91cbxxm93k8ayyvhpaf3c2lv10qw4wyqwn3hc1qb1cfyvr")))) "1c510p55amxjyvjlx9jpa30gixlgmf6mmfnaqcs46412krymwg38"))))
(native-inputs (list mescc-tools)) (native-inputs (list mescc-tools))
(build-system gnu-build-system) (build-system gnu-build-system)
(supported-systems '("i686-linux" "x86_64-linux"
"armhf-linux" "aarch64-linux"
"riscv32-linux" "riscv64-linux"))
(arguments (arguments
`(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
(string-append "CC=" ,(cc-for-target))) (string-append "CC=" ,(cc-for-target)))
@ -191,7 +193,8 @@ extensive examples, including parsers for the Javascript and C99 languages.")
(sha256 (sha256
(base32 #!mes!# "0vp8v88zszh1imm3dvdfi3m8cywshdj7xcrsq4cgmss69s2y1nkx")))) (base32 #!mes!# "0vp8v88zszh1imm3dvdfi3m8cywshdj7xcrsq4cgmss69s2y1nkx"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(supported-systems '("aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux")) (supported-systems '("aarch64-linux" "armhf-linux" "i686-linux"
"x86_64-linux" "riscv64-linux"))
(propagated-inputs (list mescc-tools nyacc)) (propagated-inputs (list mescc-tools nyacc))
(native-inputs (native-inputs
(append (append
@ -247,4 +250,7 @@ Guile.")
(version (string-append version "-" revision "." (string-take commit 7))) (version (string-append version "-" revision "." (string-take commit 7)))
(source (local-file %source-dir (source (local-file %source-dir
#:recursive? #t #:recursive? #t
#:select? (git-predicate %source-dir)))))) #:select? (git-predicate %source-dir)))
(native-inputs
`(("gdb" ,gdb)
,@(package-native-inputs mes))))))

View file

@ -1,6 +1,8 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -41,11 +43,16 @@
#ifdef __arm__ #ifdef __arm__
#define O_DIRECTORY 0x4000 #define O_DIRECTORY 0x4000
/*#define O_DIRECT 0x10000*/ #define O_TMPFILE 0x404000
#else #else
#define O_DIRECTORY 0x10000 #define O_DIRECTORY 0x10000
#define O_TMPFILE 0x410000
#endif #endif
#define AT_FDCWD -100
#define AT_SYMLINK_NOFOLLOW 0x100
#define AT_REMOVEDIR 0x200
#elif __GNU__ #elif __GNU__
#define O_RDONLY 1 #define O_RDONLY 1
#define O_WRONLY 2 #define O_WRONLY 2
@ -69,8 +76,11 @@
#define creat(file_name, mode) open (file_name, O_WRONLY | O_CREAT | O_TRUNC, mode) #define creat(file_name, mode) open (file_name, O_WRONLY | O_CREAT | O_TRUNC, mode)
int dup (int old); int dup (int old);
int dup2 (int old, int new); int dup2 (int old, int new);
#if !__M2__
int fcntl (int filedes, int command, ...); int fcntl (int filedes, int command, ...);
int open (char const *s, int flags, ...); int open (char const *s, int flags, ...);
#endif
#endif // ! SYSTEM_LIBC #endif // ! SYSTEM_LIBC

111
include/linux/SYSCALLS Normal file
View file

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

View file

@ -0,0 +1,46 @@
/* -*-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

@ -0,0 +1,46 @@
/* -*-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

@ -0,0 +1,101 @@
/* -*-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,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -26,6 +27,7 @@ long _sys_call1 (long sys_call, long one);
long _sys_call2 (long sys_call, long one, long two); long _sys_call2 (long sys_call, long one, long two);
long _sys_call3 (long sys_call, long one, long two, long three); 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_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); long _sys_call6 (long sys_call, long one, long two, long three, long four, long five, long six);
#endif //__MES_SYSCALL_H #endif //__MES_SYSCALL_H

View file

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

View file

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

View file

@ -1,70 +0,0 @@
/*
* 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,6 +20,13 @@
#ifndef __M2_TYPES_H #ifndef __M2_TYPES_H
#define __M2_TYPES_H 1 #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 #ifndef __MES_CLOCK_T
#define __MES_CLOCK_T #define __MES_CLOCK_T

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -23,76 +23,32 @@
/* Cell types */ /* Cell types */
// CONSTANT TCHAR 0
#define TCHAR 0 #define TCHAR 0
// CONSTANT TBYTES 1
#define TBYTES 1 #define TBYTES 1
// CONSTANT TCLOSURE 2
#define TCLOSURE 2 #define TCLOSURE 2
// CONSTANT TCONTINUATION 3
#define TCONTINUATION 3 #define TCONTINUATION 3
// CONSTANT TKEYWORD 4
#define TKEYWORD 4 #define TKEYWORD 4
// CONSTANT TMACRO 5
#define TMACRO 5 #define TMACRO 5
// CONSTANT TNUMBER 6
#define TNUMBER 6 #define TNUMBER 6
// CONSTANT TPAIR 7
#define TPAIR 7 #define TPAIR 7
// CONSTANT TPORT 8
#define TPORT 8 #define TPORT 8
// CONSTANT TREF 9
#define TREF 9 #define TREF 9
// CONSTANT TSPECIAL 10
#define TSPECIAL 10 #define TSPECIAL 10
// CONSTANT TSTRING 11
#define TSTRING 11 #define TSTRING 11
// CONSTANT TSTRUCT 12
#define TSTRUCT 12 #define TSTRUCT 12
// CONSTANT TSYMBOL 13
#define TSYMBOL 13 #define TSYMBOL 13
// CONSTANT TVALUES 14
#define TVALUES 14 #define TVALUES 14
// CONSTANT TVARIABLE 15
#define TVARIABLE 15 #define TVARIABLE 15
// CONSTANT TVECTOR 16
#define TVECTOR 16 #define TVECTOR 16
// CONSTANT TBROKEN_HEART 17
#define TBROKEN_HEART 17 #define TBROKEN_HEART 17
/* Struct types */ /* Struct types */
// CONSTANT STRUCT_TYPE 0
#define STRUCT_TYPE 0 #define STRUCT_TYPE 0
// CONSTANT STRUCT_PRINTER 1
#define STRUCT_PRINTER 1 #define STRUCT_PRINTER 1
// CONSTANT GC_FRAME_SIZE 5
#define GC_FRAME_SIZE 5 #define GC_FRAME_SIZE 5
// CONSTANT GC_FRAME_PROCEDURE 4
#define 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 */ #endif /* __MES_CONSTANTS_H */

29
include/mes/lib-cc.h Normal file
View file

@ -0,0 +1,29 @@
/* -*-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:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2020,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -25,26 +25,33 @@
#include <mes/config.h> #include <mes/config.h>
#endif #endif
// CONSTANT STDIN 0
#ifndef STDIN #ifndef STDIN
#define STDIN 0 #define STDIN 0
#endif #endif
// CONSTANT STDOUT 1
#ifndef STDOUT #ifndef STDOUT
#define STDOUT 1 #define STDOUT 1
#endif #endif
// CONSTANT STDERR 2
#ifndef STDERR #ifndef STDERR
#define STDERR 2 #define STDERR 2
#endif #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 char **environ;
extern int __stdin; extern int __stdin;
extern int __stdout; extern int __stdout;
extern int __stderr; extern int __stderr;
void __init_io ();
int eputs (char const *s); int eputs (char const *s);
int puts (char const *s); int puts (char const *s);
int oputs (char const *s); int oputs (char const *s);
@ -63,10 +70,14 @@ int oputs (char const *s);
#ifndef __MES_SIZE_T #ifndef __MES_SIZE_T
#define __MES_SIZE_T #define __MES_SIZE_T
#undef size_t #undef size_t
#if __M2__
typedef unsigned size_t;
#else
typedef unsigned long size_t; typedef unsigned long size_t;
#endif #endif
#endif #endif
#endif #endif
#endif
#ifndef _SSIZE_T #ifndef _SSIZE_T
#define _SSIZE_T #define _SSIZE_T

View file

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

View file

@ -53,6 +53,15 @@ 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 */ /* mes */
extern char *g_datadir; extern char *g_datadir;
extern int g_debug; extern int g_debug;

View file

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

View file

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

View file

@ -1,6 +1,8 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2017,2018,2019 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. * This file is part of GNU Mes.
* *
@ -26,7 +28,43 @@
#define va_arg8(ap, type) va_arg (ap, type) #define va_arg8(ap, type) va_arg (ap, type)
#else // ! SYSTEM_LIBC #elif (__GNUC__ || __TINYC__) && __riscv
// GCC on RISC-V always passes arguments in registers. Implementing
// these macros without the use of built-ins would be very involved.
// TINYCC tries to be GCC compatible in this case.
#if __TINYC__ < 928
// Bootstrappable TINYCC (version < 928) needs some definitions in RISC-V
typedef char *__builtin_va_list;
#define __va_reg_size (__riscv_xlen >> 3)
#define _tcc_align(addr, type) \
(((unsigned long)addr + __alignof__(type) - 1) \
& -(__alignof__(type)))
#define __builtin_va_arg(ap, type) \
(*(sizeof (type) > (2*__va_reg_size) \
? *(type **)((ap += __va_reg_size) - __va_reg_size) \
: (ap = (va_list)(_tcc_align (ap, type) \
+ (sizeof (type) + __va_reg_size - 1) \
& -__va_reg_size), \
(type *)(ap - ((sizeof (type)+ __va_reg_size - 1) \
& -__va_reg_size)))))
#define __builtin_va_end(ap) (void)(ap)
#if !defined (__builtin_va_copy)
#define __builtin_va_copy(dest, src) (dest) = (src)
#endif
#endif // __TINYC__ < 928
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
#include <sys/types.h> #include <sys/types.h>
@ -35,7 +73,7 @@
#endif #endif
typedef char *va_list; typedef char *va_list;
#define va_start(ap, last) (void)((ap) = (char*)(&(last) + 1)) #define va_start(ap, last) (void)((ap) = (char*)(&(last)) + sizeof (void*))
#define va_arg(ap, type) (type)(((long*)((ap) = ((ap) + sizeof (void*))))[-1]) #define va_arg(ap, type) (type)(((long*)((ap) = ((ap) + sizeof (void*))))[-1])
#define va_align(ap, alignment) ((char*)((((unsigned long) (ap)) + (alignment) - 1) &~ ((alignment) - 1))) #define va_align(ap, alignment) ((char*)((((unsigned long) (ap)) + (alignment) - 1) &~ ((alignment) - 1)))
#define va_arg8(ap, type) (type)(((double*)((ap) = (va_align((ap), 8) + sizeof(double))))[-1]) #define va_arg8(ap, type) (type)(((double*)((ap) = (va_align((ap), 8) + sizeof(double))))[-1])

View file

@ -50,7 +50,7 @@
#undef ptrdiff_t #undef ptrdiff_t
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
typedef char int8_t; typedef signed char int8_t;
typedef unsigned short uint16_t; typedef unsigned short uint16_t;
typedef short int16_t; typedef short int16_t;
typedef unsigned uint32_t; typedef unsigned uint32_t;
@ -87,7 +87,7 @@ typedef unsigned uintmax_t;
#define INT_MIN -2147483648 #define INT_MIN -2147483648
#define INT_MAX 2147483647 #define INT_MAX 2147483647
#if __i386__ || __arm__ #if __i386__ || __arm__ || __riscv_xlen == 32
#define LONG_MIN INT_MIN #define LONG_MIN INT_MIN
#define LONG_MAX INT_MAX #define LONG_MAX INT_MAX
#define UINT_MAX UINT32_MAX #define UINT_MAX UINT32_MAX
@ -95,7 +95,7 @@ typedef unsigned uintmax_t;
#define LLONG_MIN INT64_MIN #define LLONG_MIN INT64_MIN
#define LLONG_MAX INT64_MAX #define LLONG_MAX INT64_MAX
#define SIZE_MAX UINT32_MAX #define SIZE_MAX UINT32_MAX
#elif __x86_64__ #elif __x86_64__ || __riscv_xlen == 64
#define LONG_MIN INT64_MIN #define LONG_MIN INT64_MIN
#define LONG_MAX INT64_MAX #define LONG_MAX INT64_MAX
#define UINT_MAX UINT32_MAX #define UINT_MAX UINT32_MAX

View file

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

View file

@ -28,8 +28,13 @@
#define TCGETS 0x5401 #define TCGETS 0x5401
#define TCGETA 0x5405 #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 ioctl (int fd, unsigned long request, ...);
int ioctl3 (int fd, unsigned long request, long data); int ioctl3 (int fd, unsigned long request, long data);
#endif
#endif // ! SYSTEM_LIBC #endif // ! SYSTEM_LIBC

View file

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

View file

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

View file

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

View file

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

25
kaem.arm Normal file
View file

@ -0,0 +1,25 @@
#! /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

26
kaem.riscv64 Normal file
View file

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

25
kaem.x86 Normal file
View file

@ -0,0 +1,25 @@
#! /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

27
kaem.x86_64 Normal file
View file

@ -0,0 +1,27 @@
#! /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,6 +269,7 @@ 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____%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 lsl____%r1,%r1,$i8 90a0e31119a0e1 # mov r9, #xx; lsl %r1, %r1, %r9
DEFINE lsr____%r0,%r0,%r1 3001a0e1 # lsr %r0, %r0, %r1 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____%r0,(%sp,#$i8) 009de5 # ldr r0, [r13+xx]
DEFINE ldr____%r1,(%sp,#$i8) 109de5 # ldr r1, [r13+xx] DEFINE ldr____%r1,(%sp,#$i8) 109de5 # ldr r1, [r13+xx]
#DEFINE add____%r2,%r0,%r1,lsl#4 012280e0 #DEFINE add____%r2,%r0,%r1,lsl#4 012280e0

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -26,7 +27,15 @@
int int
_open3 (char const *file_name, int flags, int mask) _open3 (char const *file_name, int flags, int mask)
{ {
int r = _sys_call4 (SYS_openat, (long) -100, (long) 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 ();
if (r > 2) if (r > 2)
{ {
__ungetc_clear (r); __ungetc_clear (r);

View file

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -21,11 +22,18 @@
#include <mes/lib.h> #include <mes/lib.h>
#include <linux/syscall.h> #include <linux/syscall.h>
#include <arch/syscall.h> #include <arch/syscall.h>
#include <fcntl.h>
int int
access (char const *file_name, int how) access (char const *file_name, int how)
{ {
long long_file_name = cast_charp_to_long (file_name); long long_file_name = cast_charp_to_long (file_name);
long long_how = cast_int_to_long (how); long long_how = cast_int_to_long (how);
return _sys_call4 (SYS_faccessat, -100, long_file_name, long_how, 0); #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:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2017,2018,2019,2020,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2019,2020 Danny Milosavljevic <dannym@scratchpost.org> * Copyright © 2019,2020 Danny Milosavljevic <dannym@scratchpost.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
@ -20,7 +20,7 @@
*/ */
#include <mes/lib-mini.h> #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 /* Note: GCC automatically emits a preable in order to set up the
frame pointer: "push {fp}" "add fp, sp, 0" frame pointer: "push {fp}" "add fp, sp, 0"
@ -30,27 +30,6 @@ frame pointer: "push {fp}" "add fp, sp, 0"
void void
_start () _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 */ /* environ = argv + argc + 1 */
asm ( asm (
"ldr r0,[fp,#4]\n\t" /* r0 = argc */ "ldr r0,[fp,#4]\n\t" /* r0 = argc */
@ -61,14 +40,10 @@ _start ()
"push {r2}\n\t" /* envp */ "push {r2}\n\t" /* envp */
"push {r1}\n\t" /* argv */ "push {r1}\n\t" /* argv */
"push {r0}\n\t" /* argc */ "push {r0}\n\t" /* argc */
"mov %0,r2\n\t"
: "=r" (environ)
: //no inputs ""
);
asm (
"ldr r0,[sp]\n\t" /* argc */ "ldr r0,[sp]\n\t" /* argc */
"ldr r1,[sp, #4]\n\t" /* argv */ "ldr r1,[sp, #4]\n\t" /* argv */
"ldr r2,[sp, #8]\n\t" /* envp */ "ldr r2,[sp, #8]\n\t" /* envp */
"bl __init_io\n\t"
"bl main\n\t" "bl main\n\t"
"mov r7, #1\n\t" "mov r7, #1\n\t"
"swi #0\n\t" "swi #0\n\t"
@ -79,31 +54,6 @@ _start ()
void void
_start () _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 */ /* environ = argv + argc + 1 */
__asm__ (".int 0xe59b000c\n"); //ldr r0, [fp, #12] __asm__ (".int 0xe59b000c\n"); //ldr r0, [fp, #12]
__asm__ (".int 0xe28b1010\n"); //add r1, fp, #16 __asm__ (".int 0xe28b1010\n"); //add r1, fp, #16
@ -118,34 +68,11 @@ _start ()
__asm__ (".int 0xe52d0004\n"); //push {r0} ; (str r0, [sp, #-4]!) __asm__ (".int 0xe52d0004\n"); //push {r0} ; (str r0, [sp, #-4]!)
__asm__ (".int 0xe1a02002\n"); //mov r2, r2 __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 // setup argc, argv, envp parameters in registers
__asm__ (".int 0xe59d0000\n"); //ldr r0, [sp] __asm__ (".int 0xe59d0000\n"); //ldr r0, [sp]
__asm__ (".int 0xe59d1004\n"); //ldr r1, [sp, #4] __asm__ (".int 0xe59d1004\n"); //ldr r1, [sp, #4]
__asm__ (".int 0xe59d2008\n"); //ldr r2, [sp, #8] __asm__ (".int 0xe59d2008\n"); //ldr r2, [sp, #8]
__init_io ();
main (); main ();
__asm__ (".int 0xe3a07001\n"); //mov r7, #1 __asm__ (".int 0xe3a07001\n"); //mov r7, #1

View file

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

View file

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

View file

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -22,11 +23,18 @@
#include <linux/syscall.h> #include <linux/syscall.h>
#include <arch/syscall.h> #include <arch/syscall.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h>
int int
chmod (char const *file_name, mode_t mask) chmod (char const *file_name, mode_t mask)
{ {
long long_file_name = cast_charp_to_long (file_name); long long_file_name = cast_charp_to_long (file_name);
long long_mask = cast_int_to_long (mask); long long_mask = cast_int_to_long (mask);
#if defined (SYS_chmod)
return _sys_call2 (SYS_chmod, long_file_name, long_mask); 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,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -26,5 +27,11 @@ dup2 (int old, int new)
{ {
long long_old = old; long long_old = old;
long long_new = new; 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); return _sys_call3 (SYS_dup3, long_old, long_new, 0);
#else
#error No usable dup2 syscall
#endif
} }

View file

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -20,10 +21,17 @@
#include <linux/syscall.h> #include <linux/syscall.h>
#include <arch/syscall.h> #include <arch/syscall.h>
#include <signal.h>
#include <unistd.h>
int int
fork () fork ()
{ {
/* We don't have a _sys_call5 but this works */ #if defined (SYS_fork)
return _sys_call6 (SYS_clone, 17, 0, 0, 0, 0, 0); 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,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -25,5 +26,11 @@
int int
getdents (int filedes, char *buffer, size_t nbytes) getdents (int filedes, char *buffer, size_t nbytes)
{ {
#if defined (SYS_getdents)
return _sys_call3 (SYS_getdents, (int) filedes, (long) buffer, (long) nbytes); 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,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -20,9 +21,16 @@
#include <linux/syscall.h> #include <linux/syscall.h>
#include <arch/syscall.h> #include <arch/syscall.h>
#include <fcntl.h>
int int
link (char const *old_name, char const *new_name) link (char const *old_name, char const *new_name)
{ {
#if defined (SYS_link)
return _sys_call2 (SYS_link, (long) old_name, (long) new_name); 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:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -24,23 +24,23 @@
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */
off_t off_t
_lseek (int filedes, off_t offset, int whence) _lseek (int filedes, off_t offset, int whence)
{ {
return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence); long long_offset = offset;
return _sys_call3 (SYS_lseek, filedes, long_offset, whence);
} }
#endif
off_t off_t
lseek (int filedes, off_t offset, int whence) lseek (int filedes, off_t offset, int whence)
{ {
#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */ #if !__MESC__ && !__M2__
if (_lseek (filedes, 0, SEEK_CUR) == -1) if (_lseek (filedes, 0, SEEK_CUR) == -1)
return -1; return -1;
#endif #endif
size_t skip = __buffered_read_clear (filedes); size_t skip = __buffered_read_clear (filedes);
if (whence == SEEK_CUR) if (whence == SEEK_CUR)
offset -= skip; offset -= skip;
return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence); long long_offset = offset;
return _sys_call3 (SYS_lseek, filedes, long_offset, whence);
} }

View file

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -20,10 +21,18 @@
#include <linux/syscall.h> #include <linux/syscall.h>
#include <arch/syscall.h> #include <arch/syscall.h>
#include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
int int
lstat (char const *file_name, struct stat *statbuf) lstat (char const *file_name, struct stat *statbuf)
{ {
#if defined (SYS_lstat)
return _sys_call2 (SYS_lstat, (long) file_name, (long) statbuf); 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:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 Danny Milosavljevic <dannym@scratchpost.org> * Copyright © 2021 Danny Milosavljevic <dannym@scratchpost.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
@ -31,9 +31,11 @@ malloc (size_t size)
{ {
if (!__brk) if (!__brk)
__brk = cast_long_to_charp (brk (0)); __brk = cast_long_to_charp (brk (0));
#if !__M2__
/* align what we give back. */ /* align what we give back. */
__brk = (char*) (((uintptr_t) __brk __brk = (char*) (((uintptr_t) __brk
+ sizeof (max_align_t) - 1) & -sizeof (max_align_t)); + sizeof (max_align_t) - 1) & -sizeof (max_align_t));
#endif
if (brk (__brk + size) == -1) if (brk (__brk + size) == -1)
return 0; return 0;
char *p = __brk; char *p = __brk;

View file

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -20,10 +21,17 @@
#include <linux/syscall.h> #include <linux/syscall.h>
#include <arch/syscall.h> #include <arch/syscall.h>
#include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
int int
mkdir (char const *file_name, mode_t mode) mkdir (char const *file_name, mode_t mode)
{ {
#if defined (SYS_mkdir)
return _sys_call2 (SYS_mkdir, (long) file_name, (long) mode); 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,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -21,9 +22,16 @@
#include <linux/syscall.h> #include <linux/syscall.h>
#include <arch/syscall.h> #include <arch/syscall.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h>
int int
mknod (char const *file_name, mode_t mode, dev_t dev) 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); 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
} }

62
lib/linux/open.c Normal file
View file

@ -0,0 +1,62 @@
/* -*-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,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -21,9 +22,16 @@
#include <linux/syscall.h> #include <linux/syscall.h>
#include <arch/syscall.h> #include <arch/syscall.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h>
int int
pipe (int filedes[2]) pipe (int filedes[2])
{ {
#if defined (SYS_pipe)
return _sys_call1 (SYS_pipe, (long) filedes); 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,7 +27,9 @@ ssize_t
read (int filedes, void *buffer, size_t size) read (int filedes, void *buffer, size_t size)
{ {
long long_filedes = filedes; long long_filedes = filedes;
ssize_t bytes = _sys_call3 (SYS_read, long_filedes, (long) buffer, (long) size); long long_buffer = cast_voidp_to_long (buffer);
ssize_t bytes = _sys_call3 (SYS_read, long_filedes, long_buffer, size);
#if !__M2__
if (__mes_debug () > 4) if (__mes_debug () > 4)
{ {
if (bytes == 1) if (bytes == 1)
@ -48,5 +50,6 @@ read (int filedes, void *buffer, size_t size)
eputs ("\n"); eputs ("\n");
} }
} }
#endif
return bytes; return bytes;
} }

View file

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -20,10 +21,17 @@
#include <linux/syscall.h> #include <linux/syscall.h>
#include <arch/syscall.h> #include <arch/syscall.h>
#include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
ssize_t ssize_t
readlink (char const *file_name, char *buffer, size_t size) 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); 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,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * 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. * This file is part of GNU Mes.
* *
@ -21,9 +22,16 @@
#include <linux/syscall.h> #include <linux/syscall.h>
#include <arch/syscall.h> #include <arch/syscall.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h>
int int
rename (char const *old_name, char const *new_name) rename (char const *old_name, char const *new_name)
{ {
#if defined (SYS_rename)
return _sys_call2 (SYS_rename, (long) old_name, (long) new_name); 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

@ -0,0 +1,39 @@
/* -*-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

@ -0,0 +1,40 @@
/* -*-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

@ -0,0 +1,66 @@
/* -*-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

@ -0,0 +1,19 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2023 Ekaitz Zarraga <ekaitz@elenq.tech>
*
* 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/>.
*/

View file

@ -0,0 +1,19 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2023 Ekaitz Zarraga <ekaitz@elenq.tech>
*
* 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/>.
*/

View file

@ -0,0 +1,31 @@
/*
* 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

@ -0,0 +1,45 @@
/*
* 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

@ -0,0 +1,62 @@
/* -*-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

@ -0,0 +1,197 @@
/* -*-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

@ -0,0 +1,32 @@
/* -*-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

@ -0,0 +1,34 @@
/* -*-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

@ -0,0 +1,53 @@
## 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

@ -0,0 +1,34 @@
/* -*-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

@ -0,0 +1,183 @@
/* -*-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

@ -0,0 +1,33 @@
/* -*-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
}

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