Compare commits
10 Commits
master
...
wip-wip-ar
Author | SHA1 | Date |
---|---|---|
Jan (janneke) Nieuwenhuizen | 823da6108b | |
Jan (janneke) Nieuwenhuizen | 0cb8177d7a | |
Rick Masters | 9b1f71a372 | |
Jan (janneke) Nieuwenhuizen | 31e5f2e476 | |
Jan (janneke) Nieuwenhuizen | 496fd10680 | |
Jan (janneke) Nieuwenhuizen | cc796a5d61 | |
Jan (janneke) Nieuwenhuizen | f9232e804f | |
Jan (janneke) Nieuwenhuizen | 015e68a28a | |
Jan (janneke) Nieuwenhuizen | a64e292ce2 | |
Jan (janneke) Nieuwenhuizen | 688b4ffbb6 |
2
PORTING
2
PORTING
|
@ -22,7 +22,7 @@ to your config.scm and run guix system reconfigure.
|
|||
|
||||
For example (note: ARM is no longer a 'port', see HACKING)
|
||||
#+BEGIN_SRC bash
|
||||
guix shell --system=armhf-linux --pure bash coreutils diffutils findutils gawk gcc-toolchain@7 grep git guile@2.2 gzip help2man make mescc-tools nyacc openssh-sans-x pkg-config sed tar texinfo
|
||||
guix shell --system=armhf-linux --pure bash coreutils diffutils findutils gawk gcc-toolchain grep git guile gzip help2man make mescc-tools nyacc openssh-sans-x pkg-config sed tar texinfo
|
||||
#+END_SRC
|
||||
|
||||
** Try it
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh
|
||||
|
||||
# GNU Mes --- Maxwell Equations of Software
|
||||
# Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
# Copyright © 2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
#
|
||||
# This file is part of GNU Mes.
|
||||
#
|
||||
|
@ -29,6 +29,7 @@ fi
|
|||
|
||||
. ./config.sh
|
||||
. ${srcdest}build-aux/trace.sh
|
||||
. ${srcdest}build-aux/cflags.sh
|
||||
|
||||
if $courageous; then
|
||||
set +e
|
||||
|
@ -42,25 +43,6 @@ else
|
|||
}
|
||||
fi
|
||||
|
||||
case "$mes_cpu" in
|
||||
arm)
|
||||
stage0_arch=40
|
||||
stage0_cpu=armv7l
|
||||
;;
|
||||
x86_64)
|
||||
stage0_arch=2
|
||||
stage0_cpu=amd64
|
||||
;;
|
||||
x86)
|
||||
stage0_arch=1
|
||||
stage0_cpu=x86
|
||||
;;
|
||||
*)
|
||||
stage0_arch=1
|
||||
stage0_cpu=$mes_cpu
|
||||
;;
|
||||
esac
|
||||
|
||||
trace "CCLD ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/exit-42.S" $CC\
|
||||
-nostdlib\
|
||||
-g\
|
||||
|
|
|
@ -38,25 +38,6 @@ set -u
|
|||
. ./config.sh
|
||||
. ${srcdest}build-aux/cflags.sh
|
||||
|
||||
case "$mes_cpu" in
|
||||
arm)
|
||||
stage0_arch=40
|
||||
stage0_cpu=armv7l
|
||||
;;
|
||||
x86_64)
|
||||
stage0_arch=2
|
||||
stage0_cpu=amd64
|
||||
;;
|
||||
x86)
|
||||
stage0_arch=1
|
||||
stage0_cpu=x86
|
||||
;;
|
||||
*)
|
||||
stage0_arch=1
|
||||
stage0_cpu=$mes_cpu
|
||||
;;
|
||||
esac
|
||||
|
||||
if $courageous; then
|
||||
echo "Applying courage"
|
||||
set +e
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# GNU Mes --- Maxwell Equations of Software
|
||||
# Copyright © 2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
# Copyright © 2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
#
|
||||
# This file is part of GNU Mes.
|
||||
#
|
||||
|
@ -16,6 +16,25 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
case "$mes_cpu" in
|
||||
arm)
|
||||
stage0_arch=40
|
||||
stage0_cpu=armv7l
|
||||
;;
|
||||
x86_64)
|
||||
stage0_arch=2
|
||||
stage0_cpu=amd64
|
||||
;;
|
||||
x86)
|
||||
stage0_arch=1
|
||||
stage0_cpu=x86
|
||||
;;
|
||||
*)
|
||||
stage0_arch=1
|
||||
stage0_cpu=$mes_cpu
|
||||
;;
|
||||
esac
|
||||
|
||||
AM_CPPFLAGS="
|
||||
-D HAVE_CONFIG_H=1
|
||||
-I ${srcdest}include
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh
|
||||
|
||||
# GNU Mes --- Maxwell Equations of Software
|
||||
# Copyright © 2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
# Copyright © 2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
#
|
||||
# This file is part of GNU Mes.
|
||||
#
|
||||
|
@ -117,6 +117,7 @@ lib/tests/scaffold/54-argv.c
|
|||
lib/tests/scaffold/55-char-array.c
|
||||
lib/tests/scaffold/60-math.c
|
||||
lib/tests/scaffold/60-math-itoa.c
|
||||
lib/tests/scaffold/60-math-modulo.c
|
||||
lib/tests/scaffold/61-array.c
|
||||
lib/tests/scaffold/62-array.c
|
||||
lib/tests/scaffold/63-struct.c
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
### GNU Mes --- Maxwell Equations of Software
|
||||
### Copyright © 2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
### Copyright © 2017,2018,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
### Copyright © 2019,2020 Danny Milosavljevic <dannym@scratchpost.org>
|
||||
###
|
||||
### This file is part of GNU Mes.
|
||||
|
@ -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
|
||||
|
@ -91,6 +92,7 @@ DEFINE mov____%r0,(%r1) 000081e5
|
|||
DEFINE mov____%r1,%r0 0100a0e1
|
||||
DEFINE mov____%r1,%r2 0120a0e1
|
||||
DEFINE mov____%esp,%r0 0d00a0e1
|
||||
DEFINE mov____%esp,%r3 0d30a0e1
|
||||
|
||||
# e59f9004 ldr r9, [pc, #4] ; <L1>
|
||||
# e5890000 str r0, [r9]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,6 +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 Rick Masters <grick23@gmail.com>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
|
@ -44,6 +45,8 @@ abtol (char const **p, int base)
|
|||
i = i * base;
|
||||
if (s[0] > '9')
|
||||
m = 'a' - 10;
|
||||
else
|
||||
m = '0';
|
||||
i = i + s[0] - m;
|
||||
s = s + 1;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
|
@ -23,7 +23,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if __M2_PLANET__ || !(__MESC__ && __arm__)
|
||||
#if __M2_PLANET__ || (!(__MESC__ && __arm__) && !(__TINYC__ && __arm__ && BOOTSTRAP))
|
||||
size_t
|
||||
__mesabi_uldiv (size_t a, size_t b, size_t *remainder)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2019, 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
|
@ -29,7 +29,12 @@ int
|
|||
main (int argc, char const *argv[])
|
||||
{
|
||||
eputs ("test:getenv\n");
|
||||
#if __GNUC__ > 11
|
||||
char* file_name = malloc (PATH_MAX);
|
||||
#else
|
||||
// FIXME: gcc-12.2.0 fails open using this
|
||||
char file_name[PATH_MAX];
|
||||
#endif
|
||||
char *srcdir = getenv ("abs_top_srcdir");
|
||||
if (! srcdir) // for running by hand
|
||||
srcdir = ".";
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/* -*-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/>.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int i;
|
||||
|
||||
oputs ("\n");
|
||||
|
||||
oputs ("t: 1 % 2\n");
|
||||
i = 1 % 2;
|
||||
if (i != 1)
|
||||
return 1;
|
||||
|
||||
oputs ("t: 2 % 4\n");
|
||||
i = 2 % 4;
|
||||
if (i != 2)
|
||||
return 2;
|
||||
|
||||
oputs ("t: 3 % 4\n");
|
||||
i = 3 % 4;
|
||||
if (i != 3)
|
||||
return 3;
|
||||
|
||||
oputs ("t: 1 % 256\n");
|
||||
i = 1 % 256;
|
||||
if (i != 1)
|
||||
return 4;
|
||||
|
||||
unsigned u;
|
||||
|
||||
oputs ("\n");
|
||||
|
||||
oputs ("t: 1U % 2\n");
|
||||
u = 1 % 2;
|
||||
if (u != 1)
|
||||
return 5;
|
||||
|
||||
oputs ("t: 2U % 4\n");
|
||||
u = 2 % 4;
|
||||
if (u != 2)
|
||||
return 6;
|
||||
|
||||
oputs ("t: 3U % 4\n");
|
||||
u = 3 % 4;
|
||||
if (u != 3)
|
||||
return 7;
|
||||
|
||||
oputs ("t: 1U % 256\n");
|
||||
u = 1 % 256;
|
||||
if (u != 1)
|
||||
return 8;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2017,2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
|
@ -48,7 +48,12 @@ struct anon
|
|||
int
|
||||
main ()
|
||||
{
|
||||
struct foo f = { 0, 1, 2 };
|
||||
#if __GNUC__ > 11
|
||||
struct foo f = { 0, 1, 2, 0, 0 };
|
||||
#else
|
||||
// FIXME: gcc-12.2.0 segfaults on this
|
||||
struct foo f = { 0, 1, 2, 0 };
|
||||
#endif
|
||||
f.s.baz = 2;
|
||||
oputs ("f.s.bar=");
|
||||
oputs (itoa (f.s.bar));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
|
@ -214,7 +214,12 @@ main (int argc, char *argv[])
|
|||
//i = (*fun2)(argc, argv);
|
||||
|
||||
i = 1;
|
||||
#if __GNUC__ > 11
|
||||
int lst[6] = { -1, 1 - 1, i, 2, 3, 0 };
|
||||
#else
|
||||
// FIXME: gcc-12.2.0 segfaults on this
|
||||
int lst[6] = { -1, 1 - 1, i, 2, 3 };
|
||||
#endif
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
eputs ("i: ");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2022 Rick Masters <grick23@gmail.com>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
|
@ -43,5 +44,13 @@ main ()
|
|||
if (strcmp (p, "zar\n"))
|
||||
return 4;
|
||||
|
||||
p = "a2zar\n";
|
||||
n = strtoull (p, (char **) &p, 16);
|
||||
if (n != 162)
|
||||
return 5;
|
||||
eputs (p);
|
||||
if (strcmp (p, "zar\n"))
|
||||
return 6;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2022 Rick Masters <grick23@gmail.com>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
|
@ -28,25 +29,29 @@ main ()
|
|||
if (strtol ("0x12", 0, 0) != 18)
|
||||
1;
|
||||
|
||||
eputs ("012\n");
|
||||
if (strtol ("012", 0, 0) != 10)
|
||||
eputs ("0xa2\n");
|
||||
if (strtol ("0xa2", 0, 0) != 162)
|
||||
2;
|
||||
|
||||
eputs ("-1\n");
|
||||
if (strtol ("-1", 0, 0) != -1)
|
||||
eputs ("012\n");
|
||||
if (strtol ("012", 0, 0) != 10)
|
||||
3;
|
||||
|
||||
eputs ("-1\n");
|
||||
if (strtoul ("-1", 0, 0) != -1)
|
||||
if (strtol ("-1", 0, 0) != -1)
|
||||
4;
|
||||
|
||||
eputs ("-1\n");
|
||||
if (strtoul ("-1", 0, 0) != -1)
|
||||
5;
|
||||
|
||||
char *p = "16";
|
||||
int n = strtol (p, (char **) &p, 0);
|
||||
eputs ("p=");
|
||||
eputs (p);
|
||||
eputs ("\n");
|
||||
if (*p != 0)
|
||||
return 5;
|
||||
return 6;
|
||||
|
||||
p = "0x12";
|
||||
n = strtol (p, (char **) &p, 0);
|
||||
|
@ -54,7 +59,7 @@ main ()
|
|||
eputs (p);
|
||||
eputs ("\n");
|
||||
if (*p != 0)
|
||||
return 5;
|
||||
return 7;
|
||||
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -369,10 +369,13 @@
|
|||
`(,(string-append "push___%" r0))
|
||||
(armv4:call-label #f "__mesabi_idiv" 2))
|
||||
;; __mesabi_uldiv(a, b, remainderp)
|
||||
(cons* `(,(string-append "push___0"))
|
||||
`(,(string-append "push___%" r1))
|
||||
`(,(string-append "push___%" r0))
|
||||
(armv4:call-label #f "__mesabi_uldiv" 3)))))
|
||||
(append `(("push___%r3") ; slot for remainder
|
||||
("mov____%esp,%r3")
|
||||
("push___%r3") ; pointer to remainder
|
||||
(,(string-append "push___%" r1))
|
||||
(,(string-append "push___%" r0)))
|
||||
(armv4:call-label #f "__mesabi_uldiv" 3)
|
||||
`(("pop____%r3"))))))
|
||||
|
||||
(define (armv4:r0%r1 info signed?)
|
||||
(let ((r0 (get-r0 info))
|
||||
|
@ -383,9 +386,9 @@
|
|||
`(,(string-append "push___%" r0))
|
||||
(armv4:call-label #f "__mesabi_imod" 2))
|
||||
;; __mesabi_uldiv(a, b, remainderp)
|
||||
(append `(("push___%r0") ; slot for remainder
|
||||
("mov____%esp,%r0")
|
||||
("push___%r0") ; pointer to remainder
|
||||
(append `(("push___%r3") ; slot for remainder
|
||||
("mov____%esp,%r3")
|
||||
("push___%r3") ; pointer to remainder
|
||||
(,(string-append "push___%" r1))
|
||||
(,(string-append "push___%" r0)))
|
||||
(armv4:call-label #f "__mesabi_uldiv" 3)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
// char const *MES_VERSION = "0.23";
|
||||
// char const *MES_VERSION = "0.24";
|
||||
|
||||
#if __M2_PLANET__
|
||||
#define M2_CELL_SIZE 12
|
||||
|
|
Loading…
Reference in New Issue