Compare commits

..

10 Commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen 823da6108b WIP ARM: Use mes-style crt1.M1. 2022-10-12 07:46:26 +02:00
Jan (janneke) Nieuwenhuizen 0cb8177d7a doc: Update `PORTING'.
* PORTING (Setup environment): Update guile, gcc-toolchain, pin
nyacc@1.00.2.
2022-10-12 07:46:26 +02:00
Rick Masters 9b1f71a372 lib: abtol: Fix number digits in hex number conversion.
After a letter based digit, number based digits are off.

* lib/mes/abtol.c (abtol): Reset "m" for number based digit.
* lib/tests/stdlib/70-strtoull.c (main): Test it.
* lib/tests/stdlib/90-strtol.c (main): Likewise.
2022-10-12 07:46:26 +02:00
Jan (janneke) Nieuwenhuizen 31e5f2e476 ARM: Use explicit remainder in __mesabi_uldiv call.
This inexplicably fixes a segfault in tcc-boot0.

* module/mescc/armv4/as.scm (armv4:r0/r1): Instead of using "push 0",
use explicit slot for remainder.
2022-09-15 14:27:37 +02:00
Jan (janneke) Nieuwenhuizen 496fd10680 ARM: Fix unsigned modulo.
* lib/arm-mes/arm.M1 (mov____%esp,%r3): New macro.
* module/mescc/armv4/as.scm (armv4:r0%r1): Use it to avoid overwriting
%r0 before caling __mesabi_uldiv.
2022-09-15 14:27:37 +02:00
Jan (janneke) Nieuwenhuizen cc796a5d61 test: Add 60-math-modulo.c.
* lib/tests/scaffold/60-math-modulo.c: New test.
* build-aux/check-mescc.sh (mes_tests): Add it.
2022-09-15 14:27:37 +02:00
Jan (janneke) Nieuwenhuizen f9232e804f ARM: ntoab: Do not include __mesabi_uldiv for bootstrap tcc.
* lib/mes/ntoab.c (__mesabi_uldiv): Exclude for tinycc arm bootstrap.
2022-09-15 14:27:37 +02:00
Jan (janneke) Nieuwenhuizen 015e68a28a DRAFT lib/test: Cater for gcc-12.2.0.
These inexplicably avoid segfaults with gcc-12.2.0.

* lib/tests/posix/50-open-read.c (main)[__GNUC__ > 11]: Use malloc
instead of local allocated string.
* lib/tests/scaffold/7i-struct-struct.c (main)[__GNUC__ > 11]:
Initialize all fields of struct.
* lib/tests/scaffold/t.c (main): Likewise.
2022-09-15 14:27:37 +02:00
Jan (janneke) Nieuwenhuizen a64e292ce2 build: Also use stage0_cpu detection in bootstrap.sh build.
* build-aux/build-scaffold.sh: Include cflags.sh.
(stage0_cpu): Move to...
* build-aux/cflags.sh (stage0_cpu): ...here.
* build-aux/build.sh.in (stage0_cpu): Remove.
2022-09-12 10:25:51 +02:00
Jan (janneke) Nieuwenhuizen 688b4ffbb6 kaem: Fix version.
* src/symbol.c (MES_VERSION): Update to 0.24.
2022-09-12 10:25:51 +02:00
100 changed files with 547 additions and 1196 deletions

19
.gitignore vendored
View File

@ -1,21 +1,3 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2016,2017,2019,2020,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/>.
*-
*~
.#*
@ -135,7 +117,6 @@
/doc/images/gcc-mesboot-graph.pdf
/doc/web/
/config.sh
/include/arch
/include/mes/config.h
/gcc-lib
/mescc-lib

View File

@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

35
HACKING
View File

@ -5,8 +5,7 @@
guix shell #64 bit + 32bit
CC=i686-unknown-linux-gnu-gcc ./configure
CC=arm-unknown-linux-gnueabihf-gcc ./configure
CC=arm-unknown-linux-gnu-gcc ./configure
or
./configure
@ -130,30 +129,30 @@ x/s *((char **)($rsp+8))
** C parser/compiler
*** [[https://savannah.gnu.org/projects/nyacc][nyacc]]
*** PEG: [[https://piumarta.com/software/peg/][parse C using PEG]]
*** PEG: [[http://piumarta.com/software/peg/][parse C using PEG]]
*** [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]]
*** [[https://www.t3x.org/subc/index.html][Sub C]]
*** [[http://www.t3x.org/subc/index.html][Sub C]]
*** [[https://groups.google.com/forum/#!topic/comp.lang.lisp/VPuX0VsjTTE][C intepreter in LISP/Scheme/Python]]
** C assembler/linker
*** [[https://www.tldp.org/HOWTO/Assembly-HOWTO/linux.html][Assembly HOWTO]]
*** [[http://www.tldp.org/HOWTO/Assembly-HOWTO/linux.html][Assembly HOWTO]]
*** ELF
7f 45 4c 46
*** [[https://www.muppetlabs.com/~breadbox/software/tiny/][Small ELF programs]]
*** [[https://www.cirosantilli.com/elf-hello-world/][Elf hello world]]
*** [[http://www.muppetlabs.com/~breadbox/software/tiny/][Small ELF programs]]
*** [[http://www.cirosantilli.com/elf-hello-world/][Elf hello world]]
** SC - c as s-expressions
sc: https://sph.mn/content/3d3
sc: http://sph.mn/content/3d3
** RNRS
*** [[https://www.scheme-reports.org/][Scheme Reports]]
*** [[http://www.scheme-reports.org/][Scheme Reports]]
*** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-349.pdf][Scheme - Report on Scheme]]
*** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-452.pdf][RRS - Revised Report on Scheme]]
** tiny schemes
https://forum.osdev.org/viewtopic.php?f=15&t=19937
http://forum.osdev.org/viewtopic.php?f=15&t=19937
https://www.stripedgazelle.org/joey/dreamos.html
https://armpit.sourceforge.net/
https://common-lisp.net/project/movitz/movitz.html
http://www.stripedgazelle.org/joey/dreamos.html
http://armpit.sourceforge.net/
http://common-lisp.net/project/movitz/movitz.html
<civodul> janneke: https://github.com/namin/inc looks interesting [15:18]
** Orians Jeremiah
@ -170,13 +169,13 @@ https://common-lisp.net/project/movitz/movitz.html
<janneke> OriansJ: i looked a few times and saw 'LISP empty', so thanks for
the pointer! [00:24]
<civodul> OriansJ, janneke: from that page, there's also:
https://web.archive.org/web/20160604035203fw_/https://homepage.ntlworld.com/edmund.grimley-evans/bcompiler.html
https://web.archive.org/web/20160604035203fw_/http://homepage.ntlworld.com/edmund.grimley-evans/bcompiler.html
** C4/C500
https://web.archive.org/web/20160604041431/https://homepage.ntlworld.com/edmund.grimley-evans/cc500/cc500.c
https://web.archive.org/web/20160604041431/http://homepage.ntlworld.com/edmund.grimley-evans/cc500/cc500.c
https://github.com/rswier/c4/blob/master/c4.c
** Compilers for free
https://codon.com/compilers-for-free
http://codon.com/compilers-for-free
** Small lisps
*** [[https://www.mirrorservice.org/sites/www.bitsavers.org/bits/TI/Explorer/zeta-c/][ZETA-C]]
** Small C compilers
@ -188,10 +187,10 @@ simple as possible.
*** pcc
*** early GCC?
https://miyuki.github.io/2017/10/04/gcc-archaeology-1.html
*** [[https://tack.sourceforge.net/][ack]]
*** [[http://tack.sourceforge.net/][ack]]
<rain1> it may be possible to compile like this: mes |> ack |> pcc |> tcc |>
gcc 4.7.4 |> gcc later version... up to modern
*** [[https://web.archive.org/web/20160402225843/https://homepage.ntlworld.com/edmund.grimley-evans/cc500/][cc500]]
*** [[https://web.archive.org/web/20160402225843/http://homepage.ntlworld.com/edmund.grimley-evans/cc500/][cc500]]
** rain1's Bootstrapping Wiki: https://bootstrapping.miraheze.org/wiki/Main_Page
** rain1's hex86
https://notabug.org/rain1/hex86/src/master/tests/hex0b3.hex86

42
NEWS
View File

@ -2,7 +2,7 @@
#+TITLE: GNU Mes NEWS history of user-visible changes
#+STARTUP: content hidestars
Copyright © 2016,2017,2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@ -10,32 +10,6 @@ Copyright © 2016,2017,2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <jan
Please send Mes bug reports to bug-mes@gnu.org.
* Changes in 0.24.2 since 0.24.1
** Build
*** A number of compile warnings have been fixed.
*** The `simple.make' and `simple.sh' builds have been resurrected.
** MesCC
*** Some assembly defines were added for building TinyCC for x86_64.
*** `__assert_fail' has been updated to use the standard signature.
** Noteworthy bug fixes
*** A bootstrap build without M2-Planet is now supported again.
*** `gettimeofday' no longer segfaults in the M2-Planet build.
*** `stat64' and friends are now used on 32bit platforms.
This fixes https://debbugs.gnu.org/41264, and should also fix
https://debbugs.gnu.org/49985,
https://debbugs.gnu.org/53415,
https://debbugs.gnu.org/53416.
*** The Mes C Library now supports uppercase hex conversions.
* Changes in 0.24.1 since 0.24
** Build
*** Support M2-Planet bootstrap for ARM.
** MesCC
*** The Mes C Library now supports bootstrapping ARM.
** Noteworthy bug fixes
*** The definition of S_ISUID was fixed.
*** Unsigned modulo has been fixed for ARM.
*** A bug with abtol has been fixed.
*** Workarounds for building with gcc-12.2.0 have been added.
* Changes in 0.24 since 0.23
** Core
*** Mes and Mes C Library can now be built with M2-Planet.
@ -50,20 +24,6 @@ Next to `U', also support `ULL', `UL', `L', and `LL'.
*** Development build support with Guile-2 was resurrected.
*** The logand procedure now works correctly.
*** The 64bit build was resurrected.
* Changes in 0.23.1 since 0.23
** Build: Move to libera.chat.
** Core
*** Mes and Mes C Library can now support ARM bootstrap.
** MesCC
*** MesCC now supports ARM bootstrap.
** Noteworthy bug fixes
*** Stack frame 0 does not perform out of bounds access.
*** MesCC's -m64 works again.
*** Guile-2 support has been resurrected.
*** logand has been fixed.
*** Mes C Library now supports more than 255 command line parameters.
* Changes in 0.23 since 0.22
** Core
*** Mes and Mes C Library can now be built with GCC 10.x.

6
README
View File

@ -7,7 +7,7 @@
System. Since version 0.22 it has again helped to halve the size of
opaque, uninspectable binary seeds that are currently being used in the
[[https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25][Further Reduced Binary Seed bootstrap]] of [[https://www.gnu.org/software/guix][GNU Guix]]. The final goal is to
help create a full-source bootstrap as part of the [[https://bootstrappable.org][bootstrappable builds]]
help create a full-source bootstrap as part of the [[http://bootstrappable.org][bootstrappable builds]]
effort for UNIX-like operating systems.
The Scheme interpreter is written in ~5,000 LOC of simple C, and the C
@ -25,7 +25,7 @@ Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5,
binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for
i686-linux, x86_64-linux, armhf-linux and aarch64-linux.
Mes 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 is inspired by The Maxwell Equations of Software: [[http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf][LISP-1.5]] -- John
McCarthy page 13, GNU Guix's source/binary packaging transparency and
Jeremiah Orians's [[https://github.com/oriansj/stage0][stage0]] ~500 byte self-hosting hex assembler.
@ -76,7 +76,7 @@ General Public Licence version 3 or later. See the file [[file:COPYING][COPYING
[7] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html
[8] https://www.nongnu.org/nyacc
[9] https://gitlab.com/janneke/tinycc
[10] [[https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf]]
[10] [[http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf]]
[11] https://savannah.nongnu.org/projects/stage0
[12] https://nlnet.nl/project/GNUMes
[13] https://nlnet.nl/project/GNUMes-arm

11
ROADMAP
View File

@ -1,7 +1,7 @@
-*- org -*-
#+TITLE: Tentative GNU Mes Road Map
Copyright © 2016,2017,2018,2019,2020,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@ -23,11 +23,8 @@ on Libera Chat!
* TODO
** release 0.x, unsorted
- Full Guile module support.
- Run Gash and Gash-Utils on Mes.
- Remove Guile as a dependency for the Guix Full Source Bootstrap.
- Integrate Full Source bootstrap for ARM on GNU Guix;
see branch wip-aarch64-bootstrap.
- Full Source Bootstrap:
+ integrate into GNU Guix; see branch wip-full-source-bootstrap.
- Integrate Reduced Binary Seed bootstrap for ARM on GNU Guix;
see branch wip-arm-bootstrap.
- Introduce the Reduced Binary Seed bootstrap to NixOS (Debian,
@ -66,8 +63,6 @@ on Libera Chat!
https://srfi.schemers.org/srfi-72/srfi-72.html, or
+ ... drop it?
* DONE
- 0.24: Full Source Bootstrap:
+ integrate into GNU Guix; see branch wip-full-source-bootstrap.
- 0.23 Full Source Bootstrap:
+ compile mes.c using M2-Planet; see branch wip-m2,
- GNU Mes now supports building Tiny CC on ARM.

View File

@ -1,5 +1,5 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -85,26 +85,17 @@ PHONY_TARGETS:=\
.PHONY: $(PHONY_TARGETS)
X86_ARCH_HEADERS = $(wildcard $(scrdest)include/linux/x86/*.h)
ARCH_HEADERS = $(X86_ARCH_HEADERS:$(srcdest)include/linux/x86/%=include/arch/%)
default: all
all: doc
doc: build
build: | $(ARCH_HEADERS)
build:
$(SHELL) build.sh
src/${program_prefix}mes: build
include/arch/%.h: $(srcdest)include/$(mes_kernel)/$(mes_cpu)/%.h | arch-dir
cp -f $< $@
arch-dir:
mkdir -p include/arch
clean:
rm -f *.o *.s bin/mes bin/mes-gcc bin/mes-mescc
rm -f mes.{aux,cp,cps,fn,info,log,tmp,toc,vr,vrs}
@ -357,7 +348,6 @@ tag:
# 1. Tag for release
# make tag VERSION=0.23
# 2. Create signed tarball
# ./configure
# make sign-dist
# 3. Update Guix package description
# make release
@ -398,7 +388,7 @@ gen-announce:
$(GEN_ANNOUNCE) \
--release-type=beta \
--package-name=mes \
--previous-version='0.24.1' \
--previous-version='0.24' \
--current-version=$(VERSION) \
--gpg-key-id=$(GPG_KEY_ID) \
--url-directory=https://ftp.gnu.org/gnu/mes \

View File

@ -50,7 +50,7 @@ srcdest=../${srcdest}
ln -sf ${srcdest}mes .
ln -sf ${srcdest}module .
ln -sf ${srcdest}src .
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include"
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu"
AM_CFLAGS="-L ${srcdest}lib"
mkdir -p $mes_cpu-mes
@ -108,7 +108,7 @@ $AR crD $mes_cpu-mes/libc+tcc.a $objects
cd ..
srcdest=
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include"
CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu"
AM_CFLAGS="-L ${srcdest}lib"
objects=

View File

@ -64,6 +64,16 @@ if test -e libc+tcc.s; then
cp libc+tcc.s $mes_cpu-mes
fi
if $courageous; then
exit 0
fi
archive libc+gnu.a $libc_gnu_SOURCES
cp libc+gnu.a $mes_cpu-mes
if test -e libc+gnu.s; then
cp libc+gnu.s $mes_cpu-mes
fi
archive libtcc1.a $libtcc1_SOURCES
cp libtcc1.a $mes_cpu-mes
if test -e libtcc1.s; then
@ -75,13 +85,3 @@ cp libgetopt.a $mes_cpu-mes
if test -e libgetopt.s; then
cp libgetopt.s $mes_cpu-mes
fi
if $courageous; then
exit 0
fi
archive libc+gnu.a $libc_gnu_SOURCES
cp libc+gnu.a $mes_cpu-mes
if test -e libc+gnu.s; then
cp libc+gnu.s $mes_cpu-mes
fi

View File

@ -66,8 +66,9 @@ fi
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}lib
-I include
-I ${srcdest}include
-I ../include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
if test $mes_kernel = gnu; then
AM_CPPFLAGS="$AM_CPPFLAGS
@ -92,9 +93,9 @@ fi
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}lib
-I ${srcdest}include
-I ../include
-I include
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
if test "$compiler" != bootstrap; then
${SHELL} ${srcdest}build-aux/build-mes.sh
@ -136,9 +137,9 @@ fi
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}lib
-I ${srcdest}include
-I ../include
-I include
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
compiler=mescc
AR=${MESAR-"${srcdest}pre-inst-env mesar"}

View File

@ -1,7 +1,7 @@
#! @SHELL@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -99,7 +99,6 @@ mkdir -p $DESTDIR$includedir
mkdir -p $DESTDIR$libdir
mkdir -p $DESTDIR$pkgdatadir
tar -cf- -C ${srcdir}/include . | tar -${v}xf- -C $DESTDIR$includedir
tar -cf- -C include . | tar -${v}xf- -C $DESTDIR$includedir
tar -cf- -C ${srcdir}/lib $mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir
tar -cf- -C ${srcdir}/lib $mes_kernel/$mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir
if test -z "$srcdest"; then

11
configure vendored
View File

@ -4,7 +4,7 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
!#
;;; GNU Mes --- Maxwell Equations of Software
;;; Copyright © 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020 Vagrant Cascadian <vagrant@reproducible-builds.org>
;;;
;;; configure: This file is part of GNU Mes.
@ -37,7 +37,7 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
(define PACKAGE "mes")
(define PACKAGE-NAME "GNU Mes")
(define PACKAGE-BUGREPORT "bug-mes@gnu.org")
(define VERSION "0.24.2")
(define VERSION "0.24")
(cond-expand
(guile)
@ -707,13 +707,6 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
#define MES_VERSION \"" VERSION "\"
")))))
(substitute (string-append srcdest "build-aux/config.make.in") pairs #:target ".config.make"))
(let ((arch-dir (string-append srcdest "include/" mes-kernel "/" mes-cpu)))
(define (copy-header file-name)
(system* "cp" "-f" "-v"
(string-append arch-dir "/" file-name)
(string-append "include/arch/" file-name)))
(system* "mkdir" "-p" "include/arch")
(for-each copy-header '("kernel-stat.h" "syscall.h")))
(let ((make (and=> (file-name "make" deps) basename)))
(display (string-append "

View File

@ -1,7 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018,2019,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -20,7 +20,7 @@
set -e
VERSION=0.24.2
VERSION=0.24
srcdir=${srcdir-$(dirname $0)}
srcdest=
if test "$srcdir" != "."; then
@ -77,8 +77,8 @@ GUILE=${GUILE-$(command -v guile)} || true
HEX2=${HEX2-$(command -v hex2)}
LDPFLAGS=${LDFLAGS-}
M1=${M1-$(command -v M1)}
M2_PLANET=${M2_PLANET-$(command -v M2-Planet)} || true
KAEM=${KAEM-$(command -v kaem)} || true
M2_PLANET=${M1-$(command -v M2-Planet)}
KAEM=${KAEM-$(command -v kaem)}
MES_FOR_BUILD=${MES_FOR_BUILD-$(command -v mes || command -v guile || echo mes)}
GIT=${GIT-$(command -v git)} || true
PERL=${PERL-$(command -v perl)} || true
@ -271,10 +271,6 @@ cat >> include/mes/config.h <<EOF
#define MES_VERSION "$VERSION"
EOF
mkdir -p include/arch
cp -f -v ${srcdest}include/${mes_kernel}/${mes_cpu}/kernel-stat.h include/arch
cp -f -v ${srcdest}include/${mes_kernel}/${mes_cpu}/syscall.h include/arch
cat <<EOF
GNU Mes is configured for
compiler: $compiler

View File

@ -1,115 +0,0 @@
Subject: GNU Mes 0.24.1 released
<#secure method=pgpmime mode=sign>
We are happy to announce the release of GNU Mes 0.24.1, representing 23
commits over five months by four people.
Mes now supports the stage0-posix and M2-Planet Full Source bootstrap on
Aarch64 for ARM. Because stage0-posix does not support ARM yet, the Mes
ARM bootstrap is currently prototyped on Aarch64.
We are excited that the NlNet Foundation[4] is again sponsoring this
work!
What's next?
Work to prototype this so-called "Full Source Bootstrap" for ARM on
Aarch64 is happening on the wip-aarch64-bootstrap[3] branch. Also, full
Guile compatible module support, and RISC-V support.
Enjoy!
* About
GNU Mes[5] 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 opaque, uninspectable binary seeds that are currently being
used in the Reduced Binary Seed bootstrap[6] of GNU Guix[7]. The
final goal is to help create a full source bootstrap as part of the
bootstrappable builds[8] effort for UNIX-like operating systems.
The Scheme interpreter is written in ~5,000 LOC of simple C, and the C
compiler written in Scheme and these are mutual self-hosting. Mes can
now be bootstrapped from M2-Planet[9] and Mescc-Tools[10].
Mes has a Garbage Collector, a library of loadable Scheme modules--
notably Dominique Boucher's LALR[11], Pre-R6RS portable
syntax-case[12] with R7RS ellipsis, Matt Wette's Nyacc[13] --and test
suite, just enough to support a REPL and a C99 compiler: mescc.
Mes + MesCC + Mes C Library can build a bootstrappable TinyCC[14] that
is self-hosting. Using this tcc and the Mes C library we now have a
Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5,
binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for
i686-linux, x86_64-linux, armhf-linux and aarch64-linux.
Mes is inspired by The Maxwell Equations of Software: LISP-1.5[15] --
John McCarthy page 13, GNU Guix's source/binary packaging transparency
and Jeremiah Orians's stage0[16] 357-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.24.1.tar.gz
https://ftp.gnu.org/gnu/mes/mes-0.24.1.tar.gz.sig
Use a mirror for higher download bandwidth:
https://ftpmirror.gnu.org/mes/mes-0.24.1.tar.gz
https://ftpmirror.gnu.org/mes/mes-0.24.1.tar.gz.sig
Here are the SHA1 and SHA256 checksums:
bceaaaf1cafaa31ccb1ee1247ce2dd651a2f67be mes-0.24.1.tar.gz
35120ceb0676632e58973355b9f86dff9cc717ed65ed2a17ff5272c59f2a0535 mes-0.24.1.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.24.1.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
* Get informed, get involved
See https://bootstrappable.org
Join #bootstrappable on irc.libera.chat
* NEWS
* Changes in 0.24.1 since 0.24
** Build
*** Support M2-Planet bootstrap for ARM.
** MesCC
*** The Mes C Library now supports bootstrapping ARM.
** Noteworthy bug fixes
*** The definition of S_ISUID was fixed.
*** Unsigned modulo has been fixed for ARM.
*** A bug with abtol has been fixed.
*** Workarounds for building with gcc-12.2.0 have been added.
* Links
[0] https://github.com/oriansj/stage0-posix
[1] https://github.com/oriansj/bootstrap-seeds
[2] https://archive.fosdem.org/2021/schedule/event/gnumes/
[3] https://git.savannah.gnu.org/cgit/guix.git/log/?h=wip-aarch64-bootstrap
[4] https://nlnet.nl/project/GNUMes-ARM_RISC-V
[5] https://www.gnu.org/software/mes
[6] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25
[7] https://www.gnu.org/software/guix
[8] https://bootstrappable.org
[9] https://github.com/oriansj/m2-planet
[10] https://savannah.nongnu.org/projects/mescc-tools
[11] https://github.com/schemeway/lalr-scm
[12] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html
[13] https://www.nongnu.org/nyacc
[14] https://gitlab.com/janneke/tinycc
[15] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf
[16] https://savannah.nongnu.org/projects/stage0

View File

@ -1,117 +0,0 @@
Subject: GNU Mes 0.24.2 released
<#secure method=pgpmime mode=sign>
We are happy to announce the release of GNU Mes 0.24.2, representing 25
commits over nine months by four people.
This release should fix the long standing `stat64' bug #41264[0].
We are very grateful that the NLnet Foundation[1] is sponsoring this
work!
What's next?
Work to prototype this so-called "Full Source Bootstrap" for ARM on
Aarch64 is happening on the wip-aarch64-bootstrap[2] branch. Also, full
Guile compatible module support, and RISC-V support.
Enjoy!
* About
GNU Mes[3] 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 opaque, uninspectable binary seeds that are currently being
used in the Reduced Binary Seed bootstrap[4] of GNU Guix[5]. The
final goal is to help create a full source bootstrap as part of the
bootstrappable builds[6] effort for UNIX-like operating systems.
The Scheme interpreter is written in ~5,000 LOC of simple C, and the C
compiler written in Scheme and these are mutual self-hosting. Mes can
now be bootstrapped from M2-Planet[7] and Mescc-Tools[8].
Mes has a Garbage Collector, a library of loadable Scheme modules--
notably Dominique Boucher's LALR[9], Pre-R6RS portable
syntax-case[10] with R7RS ellipsis, Matt Wette's Nyacc[11] --and test
suite, just enough to support a REPL and a C99 compiler: mescc.
Mes + MesCC + Mes C Library can build a bootstrappable TinyCC[12] that
is self-hosting. Using this tcc and the Mes C library we now have a
Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5,
binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for
i686-linux, x86_64-linux, armhf-linux and aarch64-linux.
Mes is inspired by The Maxwell Equations of Software: LISP-1.5[13] --
John McCarthy page 13, GNU Guix's source/binary packaging transparency
and Jeremiah Orians's stage0[14] 357-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.24.2.tar.gz
https://ftp.gnu.org/gnu/mes/mes-0.24.2.tar.gz.sig
Use a mirror for higher download bandwidth:
https://ftpmirror.gnu.org/mes/mes-0.24.2.tar.gz
https://ftpmirror.gnu.org/mes/mes-0.24.2.tar.gz.sig
Here are the SHA1 and SHA256 checksums:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.2.tar.gz
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.2.tar.gz
[*] Use a .sig file to verify that the corresponding file (without the
.sig suffix) is intact. First, be sure to download both the .sig file
and the corresponding tarball. Then, run a command like this:
gpg --verify mes-0.24.2.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
* Get informed, get involved
See https://bootstrappable.org
Join #bootstrappable on irc.libera.chat
* NEWS
* Changes in 0.24.2 since 0.24.1
** Build
*** A number of compile warnings have been fixed.
*** The `simple.make' and `simple.sh' builds have been resurrected.
** MesCC
*** Some assembly defines were added for building TinyCC for x86_64.
*** `__assert_fail' has been updated to use the standard signature.
** Noteworthy bug fixes
*** A bootstrap build without M2-Planet is now supported again.
*** `gettimeofday' no longer segfaults in the M2-Planet build.
*** `stat64' and friends are now used on 32bit platforms.
This fixes https://debbugs.gnu.org/41264, and should also fix
https://debbugs.gnu.org/49985,
https://debbugs.gnu.org/53415,
https://debbugs.gnu.org/53416.
*** The Mes C Library now supports uppercase hex conversions.
* Links
[0] https://debbugs.gnu.org/41264
[1] https://nlnet.nl/project/GNUMes-ARM_RISC-V
[2] https://git.savannah.gnu.org/cgit/guix.git/log/?h=wip-aarch64-bootstrap
[3] https://www.gnu.org/software/mes
[4] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25
[5] https://www.gnu.org/software/guix
[6] https://bootstrappable.org
[7] https://github.com/oriansj/m2-planet
[8] https://savannah.nongnu.org/projects/mescc-tools
[9] https://github.com/schemeway/lalr-scm
[10] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html
[11] https://www.nongnu.org/nyacc
[12] https://gitlab.com/janneke/tinycc
[13] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf
[14] https://github.com/oriansj/stage0-posix

View File

@ -6,7 +6,7 @@
@display
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
@uref{https://fsf.org/}
@uref{http://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -414,7 +414,7 @@ The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
@uref{https://www.gnu.org/copyleft/}.
@uref{http://www.gnu.org/copyleft/}.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this

View File

@ -204,7 +204,7 @@ Freedom 1.
@section Reproducible Builds
The current Reproducible Builds effort incubated in the Debian
project@footnote{@url{https://debian.org, The Debian Project}} and was
project@footnote{@url{http://debian.org, The Debian Project}} and was
organized by Lunar. Quoting the Reproducible Builds
website@footnote{@url{https://reproducible-builds.org/,Reproducible
Builds}}
@ -365,7 +365,7 @@ Most computers work pretty well so apparently there is not a pressing
need to inspect and study all of these codes. At the same time it is
tricky to fully trust@footnote{ Ken Thompson's 1984 Turing award
acceptance speech
@url{https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf,
@url{http://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf,
Reflections on Trusting Tust}.} a computer that was bootstrapped in this
way.
@ -461,7 +461,7 @@ and mescc-tools can be removed.
As fate would have it, I stumbled upon this
@url{https://queue.acm.org/detail.cfm?id=1039523, interview with Alan
Kay}, where he shares a revelation he had when reading John McCarthy's
@url{https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf,
@url{http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf,
LISP-1.5} manual:
@quotation
@ -553,11 +553,11 @@ in the Mes source tree for additional details.
GNU Mes depends on the following packages:
@itemize
@item @url{https://gnu.org/software/guile/, GNU Guile}, version 2.0.13 or
@item @url{http://gnu.org/software/guile/, GNU Guile}, version 2.0.13 or
later, including 2.2.x and 3.0.x,
@item @url{https://www.gnu.org/software/make/, GNU Make}.
@item @url{http://www.gnu.org/software/make/, GNU Make}.
@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{http://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,
@end itemize
@ -693,7 +693,7 @@ responsibility.
The Reduced Binary Seed bootstrap currently adopted by Guix@footnote{See
@file{gnu/packages/commencement.scm} in the @var{master} branch in Guix
git
@url{https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/commencement.scm}}.
@url{http://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.
Currently, it goes like this:
@ -749,7 +749,7 @@ Currently, it goes like this:
Here's a generated dependency diagram to for the initial bootstrap gcc
that builds the rest of Guix.
@image{images/gcc-mesboot-graph,6in,,Reference graph of the gcc-core-mesboot0}
@image{images/gcc-mesboot-graph,2in,,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
@ -935,7 +935,7 @@ The @var{option}s can be among the following:
align @var{symbol}, the default is @code{functions}; other valid values
are: @code{globals}.
@item --base-address=ADDRESS
@item --base-address=ADRRESS
use BaseAddress ADDRESS [0x1000000]
@item -c
@ -1155,8 +1155,8 @@ Porting MesCC:
The Perfect Setup to hack on Mes is basically the perfect setup used
for Guile hacking (@pxref{Using Guile in Emacs,,, guile, Guile Reference
Manual}). First, you need more than an editor, you need
@url{https://www.gnu.org/software/emacs, Emacs}, empowered by the
wonderful @url{https://nongnu.org/geiser/, Geiser}.
@url{http://www.gnu.org/software/emacs, Emacs}, empowered by the
wonderful @url{http://nongnu.org/geiser/, Geiser}.
Geiser allows for interactive and incremental development from within
Emacs: code compilation and evaluation from within buffers, access to
@ -1181,7 +1181,7 @@ Scheme code in Mes is written in a purely functional style.
@cindex coding style
When writing Scheme code, we follow common wisdom among Scheme
programmers. In general, we follow the
@url{https://mumble.net/~campbell/scheme/style.txt, Riastradh's Lisp
@url{http://mumble.net/~campbell/scheme/style.txt, Riastradh's Lisp
Style Rules}. This document happens to describe the conventions mostly
used in Guiles code too. It is very thoughtful and well written, so
please do read it.

View File

@ -183,13 +183,13 @@ extensive examples, including parsers for the Javascript and C99 languages.")
(define-public mes
(package
(name "mes")
(version #!mes!# "0.24.2")
(version #!mes!# "0.24")
(source (origin
(method url-fetch)
(uri (string-append
"https://ftp.gnu.org/pub/gnu/mes/mes-" version ".tar.gz"))
(sha256
(base32 #!mes!# "0vp8v88zszh1imm3dvdfi3m8cywshdj7xcrsq4cgmss69s2y1nkx"))))
(base32 #!mes!# "00lrpm4x5qg0l840zhbf9mr67mqhp8gljcl24j5dy0y109gf32w2"))))
(build-system gnu-build-system)
(supported-systems '("aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux"))
(propagated-inputs (list mescc-tools nyacc))
@ -238,7 +238,7 @@ Guile.")
(license gpl3+)))
(define-public mes.git
(let ((version #!mes!# "0.24.2")
(let ((version #!mes!# "0.24")
(revision "0")
(commit (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ))))
(package

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -27,9 +27,8 @@
#undef __MES_ASSERT_H
#include_next <assert.h>
#else // ! SYSTEM_LIBC
#define assert(x) ((x) ? (void)0 : __assert_fail (#x, 0, 0, 0))
void __assert_fail (char const *s, char const *file, unsigned line,
char const *function);
#define assert(x) ((x) ? (void)0 : __assert_fail (#x))
void __assert_fail (char *s);
#endif // ! SYSTEM_LIBC
#endif // __MES_ASSERT_H

View File

@ -1,79 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,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_LINUX_ARM_KERNEL_STAT_H
#define __MES_LINUX_ARM_KERNEL_STAT_H 1
// https://github.com/torvalds/linux/blob/master/arch/arm/include/uapi/asm/stat.h
#include <arch/syscall.h>
#if __SIZEOF_LONG_LONG__ != 8
// *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;
unsigned long st_size;
unsigned long st_blksize;
unsigned long st_blocks;
unsigned long st_atime;
unsigned long st_atime_usec;
unsigned long st_mtime;
unsigned long st_mtime_usec;
unsigned long st_ctime;
unsigned long st_ctime_usec;
unsigned long __pad0;
unsigned long __pad1;
};
#else // __SIZEOF_LONG_LONG__ == 8
struct stat
{
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long long st_blocks;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned int st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long long st_ino;
};
#endif // __SIZEOF_LONG_LONG__ == 8
#endif // __MES_LINUX_ARM_KERNEL_STAT_H

View File

@ -109,23 +109,4 @@
#define SYS_readlink 0x55
#define SYS_mknod 0x0e
#if __SIZEOF_LONG_LONG__ == 8
#define SYS_stat64 0xc3
#define SYS_lstat64 0xc4
#define SYS_fstat64 0xc5
#define SYS_fcntl64 0xdd
#define SYS_getdents64 0xdc
#undef SYS_stat
#define SYS_stat SYS_stat64
#undef SYS_lstat
#define SYS_lstat SYS_lstat64
#undef SYS_fstat
#define SYS_fstat SYS_fstat64
#endif // __SIZEOF_LONG_LONG__ == 8
#endif /* __MES_LINUX_ARM_SYSCALL_H */

View File

@ -1,47 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LINUX_M2_KERNEL_STAT_H
#define __LINUX_M2_KERNEL_STAT_H
/* https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/stat.h */
/* *INDENT-OFF* */
struct stat
{
unsigned st_dev;
unsigned st_ino;
char st_mode[2];
char st_nlink[2];
char st_uid[2];
char st_gid[2];
unsigned st_rdev;
unsigned st_size;
unsigned st_blksize;
unsigned st_blocks;
unsigned st_atime;
unsigned st_atime_usec;
unsigned st_mtime;
unsigned st_mtime_usec;
unsigned st_ctime;
unsigned st_ctime_usec;
unsigned __pad0;
unsigned __pad1;
};
#endif /* __LINUX_M2_KERNEL_STAT_H */

View File

@ -1,79 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,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_LINUX_X86_KERNEL_STAT_H
#define __MES_LINUX_X86_KERNEL_STAT_H 1
// https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/stat.h
#include <arch/syscall.h>
#if __SIZEOF_LONG_LONG__ != 8
// *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;
unsigned long st_size;
unsigned long st_blksize;
unsigned long st_blocks;
unsigned long st_atime;
unsigned long st_atime_usec;
unsigned long st_mtime;
unsigned long st_mtime_usec;
unsigned long st_ctime;
unsigned long st_ctime_usec;
unsigned long __pad0;
unsigned long __pad1;
};
#else // __SIZEOF_LONG_LONG__ == 8
struct stat
{
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long long st_blocks;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned int st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long long st_ino;
};
#endif // __SIZEOF_LONG_LONG__ == 8
#endif // __MES_LINUX_X86_KERNEL_STAT_H

View File

@ -75,6 +75,7 @@
#define SYS_stat 0x6a
/* libc+gnu */
#define SYS_chdir 0x0c
#define SYS_link 0x09
#define SYS_getpid 0x14
@ -111,23 +112,4 @@
#define SYS_readlink 0x55
#define SYS_mknod 0x0e
#if __SIZEOF_LONG_LONG__ == 8
#define SYS_stat64 0xc3
#define SYS_lstat64 0xc4
#define SYS_fstat64 0xc5
#define SYS_fcntl64 0xdd
#define SYS_getdents64 0xdc
#undef SYS_stat
#define SYS_stat SYS_stat64
#undef SYS_lstat
#define SYS_lstat SYS_lstat64
#undef SYS_fstat
#define SYS_fstat SYS_fstat64
#endif // __SIZEOF_LONG_LONG__ == 8
#endif /* __MES_LINUX_X86_SYSCALL_H */

View File

@ -1,51 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,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_LINUX_X86_64_KERNEL_STAT_H
#define __MES_LINUX_X86_64_KERNEL_STAT_H 1
// https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/stat.h
// *INDENT-OFF*
struct stat
{
unsigned long st_dev;
unsigned long st_ino;
unsigned long st_nlink;
unsigned int st_mode;
unsigned int st_uid;
unsigned int st_gid;
unsigned int __pad0;
unsigned long st_rdev;
unsigned long st_size;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long st_blksize;
long st_blocks;
unsigned long __pad1;
unsigned long __pad2;
unsigned long __pad3;
unsigned long __pad4;
};
#endif // __MES_LINUX_X86_64_KERNEL_STAT_H

View File

@ -1,138 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022,2023 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_TYPES_H
#define __M2_TYPES_H 1
/*
#ifndef __MES_CLOCK_T
#define __MES_CLOCK_T
#undef clock_t
typedef long clock_t;
#endif
*/
#ifndef __MES_DEV_T
#define __MES_DEV_T
#undef dev_t
typedef long dev_t;
#endif
/*
#if !defined (__MES_FILE_T) && ! defined (_FILE_T)
#define __MES_FILE_T
#define _FILE_T
typedef long FILE;
#endif
*/
#ifndef __MES_GID_T
#define __MES_GID_T
#undef gid_t
typedef unsigned gid_t;
#endif
#ifndef __MES_INO_T
#define __MES_INO_T
#undef ino_t
typedef unsigned ino_t;
#endif
#if __SIZEOF_LONG_LONG__ == 8
#ifndef __MES_INO64_T
#define __MES_INO64_T
#undef ino64_t
typedef unsigned ino64_t;
#endif
#endif // __SIZEOF_LONG_LONG__ == 8
#if !defined (__MES_INTPTR_T) && !defined (__intptr_t_defined)
#define __MES_INTPTR_T
#define __intptr_t_defined
#undef intptr_t
typedef long intptr_t;
#undef uintptr_t
typedef unsigned uintptr_t;
#endif
#ifndef __MES_OFF_T
#define __MES_OFF_T
#undef off_t
typedef long off_t;
#endif
#if __SIZEOF_LONG_LONG__ == 8
#ifndef __MES_OFF64_T
#define __MES_OFF64_T
#undef off64_t
typedef unsigned off64_t;
#endif
#endif // __SIZEOF_LONG_LONG__ == 8
#ifndef __MES_PID_T
#define __MES_PID_T
#undef pid_t
typedef int pid_t;
#endif
#ifndef __PTRDIFF_T
#define __PTRDIFF_T
#ifndef __MES_PTRDIFF_T
#define __MES_PTRDIFF_T
#undef ptrdiff_t
typedef long ptrdiff_t;
#endif
#endif
#ifndef __MES_SIGVAL_T
#define __MES_SIGVAL_T
#undef clock_t
typedef long sigval_t;
#endif
#ifndef __SIZE_T
#define __SIZE_T
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
typedef unsigned size_t;
#endif
#endif
#ifndef __MES_SSIZE_T
#define __MES_SSIZE_T
#undef ssize_t
typedef long ssize_t;
#endif
#ifndef __MES_UID_T
#define __MES_UID_T
#undef uid_t
typedef unsigned uid_t;
#endif
#ifndef __WCHAR_T
#define __WCHAR_T
#ifndef __MES_WCHAR_T
#define __MES_WCHAR_T
#undef wchar_t
typedef int wchar_t;
#endif
#endif
#endif // __M2_TYPES_H

View File

@ -67,8 +67,7 @@ extern void (*__call_at_exit) (void);
#define __FILEDES_MAX 512
#if !SYSTEM_LIBC
void __assert_fail (char const *s, char const *file, unsigned line,
char const *function);
void __assert_fail (char *s);
ssize_t __buffered_read (int filedes, void *buffer, size_t size);
size_t __buffered_read_clear (int filedes);
void _exit (int code);

View File

@ -19,7 +19,7 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_SYS_STAT_H
#define __MES_SYS_STAT_H 1
#define __MES_SYS_STAT_H 1lei
#if SYSTEM_LIBC
#undef __MES_SYS_STAT_H
@ -29,13 +29,60 @@
#include <time.h>
#include <sys/types.h>
#include <arch/kernel-stat.h>
#ifndef __MES_MODE_T
#define __MES_MODE_T
typedef int mode_t;
#endif
// *INDENT-OFF*
#if __i386__ || __arm__
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;
};
#elif __x86_64__
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
// *INDENT-ON*
int chmod (char const *file_name, mode_t mode);
int fstat (int filedes, struct stat *buf);
int mkdir (char const *file_name, mode_t mode);

View File

@ -53,7 +53,6 @@ M2-Planet \
-f lib/mes/fdputc.c \
-f lib/mes/eputc.c \
\
-f include/m2/types.h \
-f include/mes/mes.h \
-f include/mes/builtins.h \
-f include/mes/constants.h \
@ -82,8 +81,6 @@ M2-Planet \
-f lib/mes/fdungetc.c \
-f lib/posix/setenv.c \
-f lib/linux/access.c \
-f include/linux/m2/kernel-stat.h \
-f include/sys/stat.h \
-f lib/m2/chmod.c \
-f lib/linux/ioctl3.c \
-f lib/m2/isatty.c \

View File

@ -31,6 +31,7 @@ DEFINE add____$i8,%r0 0090e2 # adds r0, r0, #xx; ADDSI = immediate op1 '09' op
# 1090e2 # adds r1, r0, #xx; ADDSI = immediate op1 '09' op2 'e2'
DEFINE add____$i8,%r1 1091e2 # adds r1, r1, #xx
DEFINE add____$i8,%r13 d09de2 # adds r13, r13, #xx
DEFINE add____$i8,%ebp e28cc0 # adds ip, ip, #xx
DEFINE sub____$i8,%r0 0050e2 # subs r0, r0, #xx
DEFINE sub____$i8,%r1 1051e2 # subs r1, r1, #xx
DEFINE add____%r0,%r0 000090e0 # adds r0, r0, r0

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2023 Rick Masters <grick23@gmail.com>
*
* This file is part of GNU Mes.
*

View File

@ -24,5 +24,5 @@
int
isxdigit (int c)
{
return isdigit (c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
return isdigit (c) || (c >= 'a' && c <= 'f');
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
char *
_getcwd (char *buffer, size_t size)

View File

@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
#include <fcntl.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
#include <fcntl.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
access (char const *file_name, int how)

View File

@ -1,6 +1,7 @@
### GNU Mes --- Maxwell Equations of Software
### Copyright (C) 2016 Jeremiah Orians
### Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
### Copyright © 2017,2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
### Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
###
### This file is part of GNU Mes.
###
@ -17,6 +18,47 @@
### You should have received a copy of the GNU General Public License
### along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
:UNUSED_start
;; ??? from M2
'0' SP BP NO_SHIFT MOVE_ALWAYS ; Setup Base Pointer
push___%lr
push___%ebp
mov____%esp,%ebp
allocate_stack_4180
!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
!8 ldr____%r0,(%fp,+#$i8)
mov____%fp,%r1
!12 add____%r1,$i8
add____%r2,%r1,%r0,lsl#2
!4 add____%r2,$i8
mov____%r2,0x32 &GLOBAL_environ
; M2-Planet calling convention pushes forward
push___%r0 ; argc
push___%r1 ; argv
push___%r2 ; environ
!4 add____$i8,%ebp ;M2-Planet calling convention
^~FUNCTION_main bl
!0x0 add____$i8,%esp
!0x0 cmp____$i8,%r0
SYS_exit mov____$i8,%r7
swi____$0
:__start_loop
wfi
!0x1 mov____$i8,%r0
!0x0 cmp____$i8,%r0
^~__start_loop b
mov____%ebp,%esp
pop____%ebp
ret
:_start
'0' SP BP NO_SHIFT MOVE_ALWAYS ; Setup Base Pointer

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
long
brk (void *addr)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
chdir (char const *file_name)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <time.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
dup (int old)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
dup2 (int old, int new)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
execve (char const *file_name, char *const argv[], char *const env[])

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <stdarg.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
fork ()

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
fsync (int filedes)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/types.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
gid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
uid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
gid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
pid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
pid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/resource.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/time.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
uid_t

View File

@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <stdarg.h>
#include <sys/ioctl.h>

View File

@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
link (char const *old_name, char const *new_name)

View File

@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <stdio.h>
#include <sys/types.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <time.h>
#include <sys/time.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
#include <fcntl.h>
@ -27,7 +27,7 @@ ssize_t
read (int filedes, void *buffer, size_t size)
{
long long_filedes = filedes;
ssize_t bytes = _sys_call3 (SYS_read, long_filedes, (long) buffer, (long) size);
ssize_t bytes = _sys_call3 (SYS_read, long_filedes, buffer, size);
if (__mes_debug () > 4)
{
if (bytes == 1)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
ssize_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
rmdir (char const *file_name)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/time.h>
#include <unistd.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
#include <signal.h>
@ -36,7 +36,7 @@ sighandler_t
signal (int signum, sighandler_t action)
{
#if __i386__
return (sighandler_t) _sys_call2 (SYS_signal, signum, (long) action);
return _sys_call2 (SYS_signal, signum, action);
#else
static struct sigaction setup_action = { 0 };
static struct sigaction old = { 0 };

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <signal.h>
#include <unistd.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,11 +19,17 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
/* Linux' SYS_time syscall is a compatibility shim for SYS_gettimeofday.
Therefore, prefer SYS_gettimeofday. */
#if defined (SYS_gettimeofday)
#include <sys/time.h>
time_t
time (time_t * result)
{
@ -35,3 +41,31 @@ time (time_t * result)
*result = tv.tv_sec;
return tv.tv_sec;
}
#elif defined (SYS_time)
time_t
time (time_t * result)
{
return _sys_call1 (SYS_time, (long) result);
}
#else
#warning there is no time
#include <mes/lib.h>
time_t
time (time_t * result)
{
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("time stub\n");
stub = 1;
if (result)
*result = 0;
return 0;
}
#endif

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
unlink (char const *file_name)

View File

@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/types.h>
pid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
execve (char const *file_name, char **argv, char **env)

View File

@ -18,8 +18,6 @@
* 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>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,19 +19,16 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <time.h>
char *__tv;
long
time (long* result)
{
int r;
if (__tv == 0)
__tv = malloc (sizeof (struct timeval));
struct timeval *tv = __tv;
r = _sys_call2 (SYS_gettimeofday, tv, 0);
struct timeval tv;
struct timezone tz;
r = _sys_call2 (SYS_gettimeofday, tv, tz);
if (r != 0)
return -1;
if (result != 0)

View File

@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/types.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,30 +19,14 @@
*/
#include <mes/lib.h>
#include <assert.h>
void
__assert_fail (char const *msg, char const *file, unsigned line,
char const *function)
__assert_fail (char *s)
{
if (file && file[0])
{
eputs (file);
eputs (":");
}
if (line)
{
eputs (itoa (line));
eputs (":");
}
if (function && function[0])
{
eputs (function);
eputs (":");
}
eputs ("assert fail: ");
eputs (msg);
eputs (s);
eputs ("\n");
char *fail = 0;
char *fail = s;
fail = 0;
fail[0] = 0;
}

View File

@ -1,7 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2022,2023 Rick Masters <grick23@gmail.com>
* Copyright © 2022 Rick Masters <grick23@gmail.com>
*
* This file is part of GNU Mes.
*
@ -43,15 +43,10 @@ abtol (char const **p, int base)
while (isnumber (s[0], base) != 0)
{
i = i * base;
if (s[0] >= 'a')
if (s[0] > '9')
m = 'a' - 10;
else
{
if (s[0] >= 'A')
m = 'A' - 10;
else
m = '0';
}
m = '0';
i = i + s[0] - m;
s = s + 1;
}

View File

@ -1,7 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2019 Jeremiah Orians <jeremiah@pdp10.guru>
* Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,12 +20,11 @@
*/
#include <mes/lib.h>
#include <assert.h>
#include <stdlib.h>
void
assert_msg (int bool, char *msg)
{
if (bool == 0)
__assert_fail (msg, 0, 0, 0);
__assert_fail (msg);
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -22,7 +22,6 @@
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
int
vfscanf (FILE * stream, char const *template, va_list ap)
@ -77,7 +76,7 @@ vfscanf (FILE * stream, char const *template, va_list ap)
ungetc (p, stream);
*q = 0;
q = buf;
*d = abtol ((char const**)&q, 10);
*d = abtol (&q, 10);
count++;
break;
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -30,6 +30,6 @@ mbstowcs (wchar_t * wstring, char const *string, size_t size)
if (__mes_debug () && !stub)
eputs ("mbstowcs stub\n");
stub = 1;
strcpy ((char*)wstring, string);
strcpy (wstring, string);
return strlen (string);
}

View File

@ -1,7 +1,6 @@
### GNU Mes --- Maxwell Equations of Software
### Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
### Copyright © 2018 Peter De Wachter <pdewacht@gmail.com>
### Copyright © 2022 Ekaitz Zarraga <ekaitz@elenq.tech>
###
### This file is part of GNU Mes.
###
@ -124,14 +123,10 @@ DEFINE mov____%rdx,%rax 4889d0
DEFINE mov____%rdx,%rdi 4889d7
DEFINE mov____%rsi,(%rdi) 488937
DEFINE mov____%rsp,%rbp 4889e5
DEFINE mov____%si,(%rdi) 668937
DEFINE mov____%sil,(%rdi) 448837
DEFINE mov____(%rax),%eax 8b00
DEFINE mov____(%rax),%esi 8b30
DEFINE mov____(%rax),%rax 488b00
DEFINE mov____(%rax),%rsi 488b30
DEFINE mov____(%rax),%si 668b30
DEFINE mov____(%rax),%sil 408a30
DEFINE mov____(%rdi),%edi 8b3f
DEFINE mov____(%rdi),%rdi 488b3f
DEFINE mov____0x32(%rbp),%rax 488b85

View File

@ -1,7 +1,7 @@
;;; -*-scheme-*-
;;; 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 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Mes.
;;;
@ -29,7 +29,7 @@
(define welcome
(string-append "GNU Mes " %version "
Copyright (C) 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copyright (C) 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copyright (C) 2019,2020,2021 Danny Milosavljevic <dannym@scratchpost.org>
and others.

View File

@ -107,7 +107,7 @@ Options:
--arch=ARCH compile for ARCH [~a]
--kernel=ARCH compile for KERNEL [~a]
-dumpmachine display the compiler's target machine
--base-address=ADDRESS
--base-address=ADRRESS
use BaseAddress ADDRESS [0x1000000]
--numbered-arch mescc-tools use numbered arch
-D DEFINE[=VALUE] define DEFINE [VALUE=1]

View File

@ -1,5 +1,5 @@
;;; 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 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
;;;
;;; This file is part of GNU Mes.
@ -22,6 +22,7 @@
#:use-module (srfi srfi-26)
#:use-module (ice-9 pretty-print)
#:use-module (ice-9 getopt-long)
#:use-module (mes mes-0)
#:use-module (mes misc)
#:use-module (mescc info)
@ -39,9 +40,10 @@
mescc:link
multi-opt))
(define (with-output-to-file* file-name thunk)
(define GUILE-with-output-to-file with-output-to-file)
(define (with-output-to-file file-name thunk)
(if (equal? file-name "-") (thunk)
(with-output-to-file file-name thunk)))
(GUILE-with-output-to-file file-name thunk)))
(define (mescc:preprocess options)
(let* ((pretty-print/write (string->symbol (option-ref options 'write (if guile? "pretty-print" "write"))))
@ -62,7 +64,7 @@
(arch (arch-get options))
(defines (append (arch-get-defines options) defines))
(verbose? (count-opt options 'verbose)))
(with-output-to-file* ast-file-name
(with-output-to-file ast-file-name
(lambda _ (for-each (cut c->ast prefix defines includes arch pretty-print/write verbose? <>) files)))))
(define (c->ast prefix defines includes arch write verbose? file-name)
@ -87,7 +89,7 @@
(filter (negate (cut eq? <> 'functions)) align))))
(when verbose?
(format (current-error-port) "dumping: ~a\n" M1-file-name))
(with-output-to-file* M1-file-name
(with-output-to-file M1-file-name
(cut infos->M1 M1-file-name infos #:align align #:verbose? verbose?))
M1-file-name))
@ -181,7 +183,7 @@
(filter (negate (cut eq? <> 'functions)) align))))
(when verbose?
(format (current-error-port) "dumping: ~a\n" M1-file-name))
(with-output-to-file* M1-file-name
(with-output-to-file M1-file-name
(cut infos->M1 M1-file-name infos #:align align))
(or (M1->hex2 options (list M1-file-name))
(exit 1))))

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -17,9 +17,40 @@
* 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_GNU_X86_KERNEL_STAT_H
#define __MES_GNU_X86_KERNEL_STAT_H 1
#include <arch/syscall.h>
#if SYSTEM_LIBC
#error "SYSTEM_LIBC not supported"
#endif
#endif // __MES_GNU_X86_KERNEL_STAT_H
#include <mes/lib.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
int size = 5000;
puts ("m!\n");
//int *p = 0;
char *p = 0;
p = malloc (size);
size = 5000;
puts ("p=");
puts (itoa (p));
puts ("\n");
for (int i = 0; i < size; i++)
{
puts ("set ");
puts (itoa (i));
puts ("\n");
p[i] = i;
}
for (int i = 0; i < size; i++)
{
puts (itoa (i));
puts (": ");
puts (itoa (p[i]));
puts ("\n");
}
return 0;
}

View File

@ -1,6 +1,6 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2019 Jeremiah Orians <jeremiah@pdp10.guru>
# Copyright © 2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018,2019,2020,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -33,7 +33,7 @@ M2_PLANET_FUBAR = i386
#M2_PLANET_ARCH = amd64
#M2_PLANET_FUBAR = amd64
M2_PLANET_FLAGS = --bootstrap-mode --debug --architecture $(M2_PLANET_ARCH)
M2_PLANET_FLAGS = --debug --architecture $(M2_PLANET_ARCH)
CFLAGS:= \
$(CFLAGS) \
@ -76,14 +76,12 @@ M2_SOURCES = \
lib/linux/x86-mes-m2/crt1.c \
lib/linux/x86-mes-m2/_exit.c \
lib/linux/x86-mes-m2/_write.c \
lib/mes/globals.c \
lib/m2/cast.c \
lib/m2/exit.c \
lib/mes/mini-write.c \
lib/mes/write.c \
lib/linux/x86-mes-m2/syscall.c \
lib/stub/__raise.c \
lib/linux/brk.c \
lib/m2/malloc.c \
lib/stdlib/malloc.c \
lib/string/memset.c \
\
lib/m2/read.c \
@ -172,8 +170,7 @@ GCC_SOURCES = \
lib/mes/itoa.c \
lib/mes/ltoa.c \
lib/mes/assert_msg.c \
src/cc.c \
src/globals.c
src/cc.c
mes-gcc: bin/mes-gcc
mes-m2: bin/mes-m2
@ -182,11 +179,11 @@ gc-gcc: bin/gc-gcc
gc-m2: bin/gc-m2
bin/mes-gcc: simple.make $(GCC_SOURCES) $(MES_SOURCES) $(INCLUDES) | bin
$(CC) $(CFLAGS) -o $@ $(GCC_SOURCES) $(MES_SOURCES)
$(CC) $(CFLAGS) $(GCC_SOURCES) $(MES_SOURCES) -o $@
cp -f $@ bin/mes
bin/gc-gcc: simple.make $(GCC_SOURCES) $(TEST_GC_SOURCES) $(INCLUDES) | bin
$(CC) $(CFLAGS) -D GC_TEST=1 -o $@ $(GCC_SOURCES) $(TEST_GC_SOURCES)
$(CC) $(CFLAGS) -D GC_TEST=1 $(GCC_SOURCES) $(TEST_GC_SOURCES) -o $@
M2_PLANET_INCLUDES = \
include/m2/lib.h \
@ -201,10 +198,10 @@ M2_PLANET_SOURCES = \
$(M2_PLANET_INCLUDES:%.h=%.h) \
$(M2_SOURCES)
m2/mes-m2.M1: simple.make $(M2_PLANET_SOURCES) $(MES_SOURCES) $(M2_PLANET_INCLUDES) | m2
m2/mes-m2.M1: simple.make $(M2_PLANET_SOURCES) $(MES_SOURCES) $(M2_PLANET_INCLUDES) | bin
$(M2_PLANET) $(M2_PLANET_FLAGS) $(M2_PLANET_SOURCES:%=-f %) $(MES_SOURCES:%.c=-f %.c) -o $@ || rm -f $@
m2/mes-m2.blood-elf.M1: m2/mes-m2.M1 | m2
m2/mes-m2.blood-elf.M1: m2/mes-m2.M1
blood-elf --little-endian -f $< -o $@
m2/mes-m2.hex2: m2/mes-m2.blood-elf.M1
@ -218,13 +215,13 @@ m2/mes-m2.hex2: m2/mes-m2.blood-elf.M1
-f m2/mes-m2.blood-elf.M1 \
-o $@
bin/mes-m2: m2/mes-m2.hex2 | bin
hex2 \
--architecture $(M2_PLANET_ARCH) \
--little-endian \
--base-address 0x1000000 \
-f lib/linux/x86-mes/elf32-header.hex2 \
-f m2/mes-m2.hex2 \
bin/mes-m2: m2/mes-m2.hex2
hex2 \
--architecture $(M2_PLANET_ARCH) \
--little-endian \
--base-address 0x1000000 \
-f lib/x86-mes/elf32-header.hex2 \
-f m2/mes-m2.hex2 \
-o $@
cp -f $@ bin/mes
@ -253,17 +250,14 @@ check-gc: $(MES)
check-mescc: $(MES)
rm -f a.out
# this already needs succesful GC
# LIBRARY_PATH=lib MES_DEBUG=1 MES_PREFIX=mes MES=$(MES) sh -x scripts/mescc -- -I include -nostdlib lib/mes/globals.c lib/string/strlen.c lib/mes/eputs.c scaffold/hello.c
LIBRARY_PATH=lib MES_DEBUG=1 MES_PREFIX=mes MES=$(MES) sh -x scripts/mescc -- -m 32 -I include -nostdlib lib/mes/globals.c lib/linux/$(MESCC_CPU)-mes-mescc/crt1.c scaffold/main.c
# MES_DEBUG=1 MES_PREFIX=mes MES=$(MES) sh -x scripts/mescc -- -I include -nostdlib lib/string/strlen.c lib/mes/eputs.c scaffold/hello.c
MES_DEBUG=1 MES_PREFIX=mes MES=$(MES) sh -x scripts/mescc -- -m 32 -I include -nostdlib lib/linux/$(MESCC_CPU)-mes-mescc/crt1.c scaffold/main.c
./a.out; r=$$?; if [ $$r != 42 ]; then exit 1; fi
# Directories
bin:
mkdir -p $@
m2:
mkdir -p $@
mkdir -p bin
TAGS:
etags $(shell find . -name '*.c' -o -name '*.h') --language=scheme $(shell find mes module -name '*.mes' -o -name '*.scm')

313
simple.sh
View File

@ -1,7 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2019,2020,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -36,50 +36,47 @@ cat > include/mes/config.h <<EOF
EOF
## Build ##
gcc -g -D HAVE_CONFIG_H=1 \
-I include \
-I include/$mes_kernel/$mes_cpu \
-o out-system-libc/mes \
\
lib/mes/eputs.c \
lib/mes/oputs.c \
\
lib/mes/cast.c \
lib/mes/itoa.c \
lib/mes/ltoa.c \
lib/mes/ltoab.c \
lib/mes/ultoa.c \
lib/mes/utoa.c \
lib/mes/eputc.c \
lib/mes/fdgetc.c \
lib/mes/fdputc.c \
lib/mes/fdputs.c \
lib/mes/fdungetc.c \
lib/mes/mes_open.c \
lib/mes/ntoab.c \
lib/mes/oputc.c \
\
lib/mes/__assert_fail.c \
lib/mes/assert_msg.c \
\
src/builtins.c \
src/cc.c \
src/core.c \
src/display.c \
src/eval-apply.c \
src/gc.c \
src/globals.c \
src/hash.c \
src/lib.c \
src/math.c \
src/mes.c \
src/module.c \
src/posix.c \
src/reader.c \
src/stack.c \
src/string.c \
src/struct.c \
src/symbol.c \
gcc -g -D HAVE_CONFIG_H=1 -I include\
-o out-system-libc/mes\
\
lib/mes/eputs.c\
lib/mes/oputs.c\
\
lib/mes/cast.c\
lib/mes/itoa.c\
lib/mes/ltoa.c\
lib/mes/ltoab.c\
lib/mes/ultoa.c\
lib/mes/utoa.c\
lib/mes/eputc.c\
lib/mes/fdgetc.c\
lib/mes/fdputc.c\
lib/mes/fdputs.c\
lib/mes/fdungetc.c\
lib/mes/mes_open.c\
lib/mes/ntoab.c\
lib/mes/oputc.c\
\
lib/mes/__assert_fail.c\
lib/mes/assert_msg.c\
\
src/builtins.c\
src/cc.c\
src/core.c\
src/display.c\
src/eval-apply.c\
src/gc.c\
src/hash.c\
src/lib.c\
src/math.c\
src/mes.c\
src/module.c\
src/posix.c\
src/reader.c\
src/stack.c\
src/string.c\
src/struct.c\
src/symbol.c\
src/vector.c
## Check ##
@ -165,125 +162,117 @@ cat > include/mes/config.h <<EOF
#define MES_VERSION "git"
EOF
mkdir -p include/arch
cp -f include/$mes_kernel/$mes_cpu/kernel-stat.h include/arch
cp -f include/$mes_kernel/$mes_cpu/syscall.h include/arch
## Build ##
compiler=gcc # not configurable
$CC -g -D HAVE_CONFIG_H=1 \
-I include -I include/$mes_kernel/$mes_cpu \
-nostdinc -nostdlib \
-fno-builtin -fno-stack-protector \
-o out-mes/mes \
\
lib/linux/$mes_cpu-mes-gcc/crt1.c \
\
lib/mes/globals.c \
lib/mes/eputs.c \
lib/mes/oputs.c \
\
lib/posix/write.c \
lib/string/strlen.c \
lib/stdlib/puts.c \
lib/stdlib/exit.c \
lib/$mes_kernel/$mes_cpu-mes-$compiler/_exit.c \
lib/$mes_kernel/$mes_cpu-mes-$compiler/_write.c \
\
lib/mes/cast.c \
lib/mes/itoa.c \
lib/mes/ltoa.c \
lib/mes/ltoab.c \
lib/mes/ultoa.c \
lib/mes/utoa.c \
lib/mes/eputc.c \
lib/mes/fdgetc.c \
lib/mes/fdputc.c \
lib/mes/fdputs.c \
lib/mes/fdungetc.c \
lib/mes/mes_open.c \
lib/mes/ntoab.c \
lib/mes/oputc.c \
\
lib/stdlib/atoi.c \
lib/mes/abtol.c \
lib/ctype/isdigit.c \
lib/ctype/isnumber.c \
lib/ctype/isspace.c \
lib/ctype/isxdigit.c \
\
lib/stub/__raise.c \
lib/mes/__assert_fail.c \
lib/mes/assert_msg.c \
lib/mes/__buffered_read.c \
lib/mes/__mes_debug.c \
lib/posix/execv.c \
lib/posix/getcwd.c \
lib/posix/getenv.c \
lib/posix/isatty.c \
lib/posix/open.c \
lib/posix/setenv.c \
lib/posix/wait.c \
lib/stdio/fgetc.c \
lib/stdio/fputc.c \
lib/stdio/fputs.c \
lib/stdio/getc.c \
lib/stdio/getchar.c \
lib/stdio/putc.c \
lib/stdio/putchar.c \
lib/stdio/ungetc.c \
lib/stdlib/free.c \
lib/linux/malloc.c \
lib/stdlib/realloc.c \
lib/string/memchr.c \
lib/string/memcmp.c \
lib/string/memcpy.c \
lib/string/memmove.c \
lib/string/memset.c \
lib/string/strcmp.c \
lib/string/strcpy.c \
lib/string/strncmp.c \
\
lib/linux/lseek.c \
\
lib/linux/access.c \
lib/linux/brk.c \
lib/linux/chmod.c \
lib/linux/clock_gettime.c \
lib/linux/dup.c \
lib/linux/dup2.c \
lib/linux/execve.c \
lib/linux/fork.c \
lib/linux/fsync.c \
lib/linux/_getcwd.c \
lib/linux/gettimeofday.c \
lib/linux/ioctl3.c \
lib/linux/_open3.c \
lib/linux/read.c \
lib/linux/_read.c \
lib/linux/time.c \
lib/linux/unlink.c \
lib/linux/waitpid.c \
lib/linux/$mes_cpu-mes-$compiler/syscall.c \
\
src/builtins.c \
src/cc.c \
src/core.c \
src/display.c \
src/eval-apply.c \
src/gc.c \
src/globals.c \
src/hash.c \
src/lib.c \
src/math.c \
src/mes.c \
src/module.c \
src/posix.c \
src/reader.c \
src/stack.c \
src/string.c \
src/struct.c \
src/symbol.c \
$CC -g -D HAVE_CONFIG_H=1 -I include -I include/$mes_kernel/$mes_cpu\
-nostdinc -nostdlib -fno-builtin -fno-stack-protector\
-o out-mes/mes\
\
lib/linux/$mes_cpu-mes-gcc/crt1.c\
\
lib/mes/globals.c\
lib/mes/eputs.c\
lib/mes/oputs.c\
\
lib/posix/write.c\
lib/string/strlen.c\
lib/stdlib/puts.c\
lib/stdlib/exit.c\
lib/$mes_kernel/$mes_cpu-mes-$compiler/_exit.c\
lib/$mes_kernel/$mes_cpu-mes-$compiler/_write.c\
\
lib/mes/cast.c\
lib/mes/itoa.c\
lib/mes/ltoa.c\
lib/mes/ltoab.c\
lib/mes/ultoa.c\
lib/mes/utoa.c\
lib/mes/eputc.c\
lib/mes/fdgetc.c\
lib/mes/fdputc.c\
lib/mes/fdputs.c\
lib/mes/fdungetc.c\
lib/mes/mes_open.c\
lib/mes/ntoab.c\
lib/mes/oputc.c\
\
lib/stdlib/atoi.c\
lib/mes/abtol.c\
lib/ctype/isdigit.c\
lib/ctype/isnumber.c\
lib/ctype/isspace.c\
lib/ctype/isxdigit.c\
\
lib/mes/__assert_fail.c\
lib/mes/assert_msg.c\
lib/mes/__buffered_read.c\
lib/mes/__mes_debug.c\
lib/posix/execv.c\
lib/posix/getcwd.c\
lib/posix/getenv.c\
lib/posix/isatty.c\
lib/posix/open.c\
lib/posix/setenv.c\
lib/posix/wait.c\
lib/stdio/fgetc.c\
lib/stdio/fputc.c\
lib/stdio/fputs.c\
lib/stdio/getc.c\
lib/stdio/getchar.c\
lib/stdio/putc.c\
lib/stdio/putchar.c\
lib/stdio/ungetc.c\
lib/stdlib/free.c\
lib/stdlib/malloc.c\
lib/stdlib/realloc.c\
lib/string/memchr.c\
lib/string/memcmp.c\
lib/string/memcpy.c\
lib/string/memmove.c\
lib/string/memset.c\
lib/string/strcmp.c\
lib/string/strcpy.c\
lib/string/strncmp.c\
\
lib/linux/lseek.c\
\
lib/linux/access.c\
lib/linux/brk.c\
lib/linux/chmod.c\
lib/linux/clock_gettime.c\
lib/linux/dup.c\
lib/linux/dup2.c\
lib/linux/execve.c\
lib/linux/fork.c\
lib/linux/fsync.c\
lib/linux/_getcwd.c\
lib/linux/gettimeofday.c\
lib/linux/ioctl3.c\
lib/linux/_open3.c\
lib/linux/read.c\
lib/linux/_read.c\
lib/linux/time.c\
lib/linux/unlink.c\
lib/linux/waitpid.c\
lib/linux/$mes_cpu-mes-$compiler/syscall.c\
\
src/builtins.c\
src/cc.c\
src/core.c\
src/display.c\
src/eval-apply.c\
src/gc.c\
src/hash.c\
src/lib.c\
src/math.c\
src/mes.c\
src/module.c\
src/posix.c\
src/reader.c\
src/stack.c\
src/string.c\
src/struct.c\
src/symbol.c\
src/vector.c
## Check ##

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2020,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2022 Gabriel Wicki <gabriel@erlikon.ch>
*
* This file is part of GNU Mes.
*
@ -327,11 +326,11 @@ void
gc_up_arena ()
{
long old_arena_bytes = (ARENA_SIZE + JAM_SIZE) * sizeof (struct scm);
if (ARENA_SIZE / 2 < MAX_ARENA_SIZE / 4)
if (ARENA_SIZE >> 1 < MAX_ARENA_SIZE >> 2)
{
ARENA_SIZE = ARENA_SIZE * 2;
JAM_SIZE = JAM_SIZE * 2;
GC_SAFETY = GC_SAFETY * 2;
ARENA_SIZE = ARENA_SIZE << 1;
JAM_SIZE = JAM_SIZE << 1;
GC_SAFETY = GC_SAFETY << 1;
}
else
ARENA_SIZE = MAX_ARENA_SIZE - JAM_SIZE;
@ -449,7 +448,7 @@ void
gc_flip ()
{
if (g_free - g_news > JAM_SIZE)
JAM_SIZE = ((g_free - g_news) * 3) / 2;
JAM_SIZE = (g_free - g_news) + ((g_free - g_news) / 2);
cell_arena = g_cells - M2_CELL_SIZE; /* For debugging. */
gc_cellcpy (g_cells, g_news, (g_free - g_news) / M2_CELL_SIZE);

View File

@ -23,7 +23,7 @@
#include <string.h>
// char const *MES_VERSION = "0.24.2";
// char const *MES_VERSION = "0.24";
#if __M2_PLANET__
#define M2_CELL_SIZE 12