x86_64: build: Cater for M2-Planet.

* build-aux/cflags.sh: Set cc_cpu.
* build-aux/config.sh.in (cc_cpu): Export.
* build-aux/export.make (cc_cpu): Likewise.
* kaem.arm (cc_cpu): New variable.
* kaem.x86 (cc_cpu): New variable.
* kaem.run (cc_cpu): New variable.  Define __<cc_cpu>__.
* scaffold/argv.kaem (cc_cpu): Likewise.  Define __linux__
* scaffold/global-array.kaem (cc_cpu): Likewise.
* scaffold/hello.kaem (cc_cpu): Likewise.
* scaffold/local-array.kaem (cc_cpu): Likewise.
* scaffold/local-static-array.kaem (cc_cpu): Likewise.
* scaffold/main.kaem (cc_cpu): Likewise.
* scaffold/read.kaem (cc_cpu): Likewise.
* kaem.x86_64: New file.
lib/m2/x86_64/ELF-x86_64.hex2,
lib/m2/x86_64/x86_64_defs.M1: New files, imported from M2Libc.
lib/linux/x86_64-mes-m2/_exit.c,
lib/linux/x86_64-mes-m2/_write.c,
lib/linux/x86_64-mes-m2/crt1.M1,
lib/linux/x86_64-mes-m2/crt1.c,
lib/linux/x86_64-mes-m2/syscall.c: New files, adapted for M2-Planet
calling convention from ...
* lib/linux/x86_64-mes-mescc: ... here.
* build-aux/build.sh.in: Also allow kaem build for x86_64.
* include/mes/lib-mini.h[__M2__]: Define as sizeof (void*).
* include/mes/mes.h[__M2__](M2_CELL_SIZE): Define as sizeof (struct scm).
* lib/x86_64-mes/x86_64.M1 (add____$i8,%rbp, mov____%rdi,%rbp): New
defines.
* src/posix.c (TIME_UNITS_PER_SECOND): Cater for 64bit M2-Planet.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2022-11-17 22:48:28 +01:00 committed by Janneke Nieuwenhuizen
parent 002dc6253a
commit 189ea8eb9d
26 changed files with 540 additions and 15 deletions

View file

@ -102,7 +102,8 @@ fi
) )
if test -n "$M2_PLANET" && (test "$mes_cpu" == "x86" \ if test -n "$M2_PLANET" && (test "$mes_cpu" == "x86" \
|| test "$mes_cpu" == "arm"); then || test "$mes_cpu" == "x86_64" \
|| test "$mes_cpu" == "arm" ); then
( (
. ${srcdest}build-aux/trace.sh . ${srcdest}build-aux/trace.sh
if [ -z "$V" -o "$V" = 0 ]; then if [ -z "$V" -o "$V" = 0 ]; then

View file

@ -18,16 +18,20 @@
case "$mes_cpu" in case "$mes_cpu" in
arm) arm)
cc_cpu=arm
stage0_cpu=armv7l stage0_cpu=armv7l
;; ;;
x86_64) x86_64)
cc_cpu=x86_64
stage0_cpu=amd64 stage0_cpu=amd64
;; ;;
x86) x86)
cc_cpu=i386
stage0_cpu=x86 stage0_cpu=x86
;; ;;
*) *)
stage0_cpu=$mes_cpu stage0_cpu=$mes_cpu
cc_cpu=$mes_cpu
;; ;;
esac esac

View file

@ -97,6 +97,7 @@ export CC
export DIFF export DIFF
export SHELL export SHELL
export V export V
export cc_cpu
export colors export colors
export compiler export compiler
export courageous export courageous

View file

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

View file

@ -41,7 +41,7 @@
for that by multiplying with M2_PTR_SIZE when using (char) for that by multiplying with M2_PTR_SIZE when using (char)
pointers. */ pointers. */
#if __M2__ #if __M2__
#define M2_PTR_SIZE 4 #define M2_PTR_SIZE sizeof (void*)
#else #else
#define M2_PTR_SIZE 1 #define M2_PTR_SIZE 1
#endif #endif

View file

@ -57,7 +57,7 @@ struct scm
for that by multiplying with M2_CELL_SIZE when using cell for that by multiplying with M2_CELL_SIZE when using cell
pointers. */ pointers. */
#if __M2__ #if __M2__
#define M2_CELL_SIZE 12 #define M2_CELL_SIZE sizeof (struct scm)
#else #else
#define M2_CELL_SIZE 1 #define M2_CELL_SIZE 1
#endif #endif

View file

@ -19,6 +19,7 @@
# Usage: # Usage:
# kaem --verbose --strict # kaem --verbose --strict
cc_cpu=arm
mes_cpu=arm mes_cpu=arm
stage0_cpu=armv7l stage0_cpu=armv7l
kaem --verbose --strict kaem --verbose --strict

View file

@ -19,6 +19,7 @@
# Usage: # Usage:
# kaem --verbose --strict # kaem --verbose --strict
cc_cpu=${cc_cpu:-i386}
mes_cpu=${mes_cpu:-x86} mes_cpu=${mes_cpu:-x86}
stage0_cpu=${stage0_cpu:-x86} stage0_cpu=${stage0_cpu:-x86}
@ -27,6 +28,7 @@ mkdir -p m2
M2-Planet \ M2-Planet \
--debug \ --debug \
--architecture ${stage0_cpu} \ --architecture ${stage0_cpu} \
-D __${cc_cpu}__=1 \
-D __linux__=1 \ -D __linux__=1 \
-f include/mes/config.h \ -f include/mes/config.h \
-f include/mes/lib-mini.h \ -f include/mes/lib-mini.h \

View file

@ -19,6 +19,7 @@
# Usage: # Usage:
# kaem --verbose --strict # kaem --verbose --strict
cc_cpu=i386
mes_cpu=x86 mes_cpu=x86
stage0_cpu=x86 stage0_cpu=x86
kaem --verbose --strict kaem --verbose --strict

25
kaem.x86_64 Normal file
View file

@ -0,0 +1,25 @@
#! /bin/sh
# Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
# Usage:
# kaem --verbose --strict
cc_cpu=x86_64
mes_cpu=x86_64
stage0_cpu=amd64
kaem --verbose --strict

View file

@ -0,0 +1,29 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,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/>.
*/
#include "mes/lib-mini.h"
void
_exit (int status)
{
asm ("mov____$i32,%rax SYS_exit");
asm ("mov____0x8(%rbp),%rdi !-8");
asm ("syscall");
}

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,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/>.
*/
#include "mes/lib-mini.h"
void
_write (int filedes, void const *buffer, size_t size)
{
asm ("mov____$i32,%rax SYS_write");
asm ("mov____0x8(%rbp),%rdi !-8");
asm ("mov____0x8(%rbp),%rsi !-16");
asm ("mov____0x8(%rbp),%rdx !-24");
asm ("syscall");
}

View file

@ -0,0 +1,56 @@
### GNU Mes --- Maxwell Equations of Software
### Copyright © 2017,2018,2019,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/>.
:_start
push___%rbp
mov____%rsp,%rbp
;; mes c lib io
mov____$i8,%rax !0
movl___%eax,0x32 &GLOBAL___stdin
mov____$i8,%rax !1
movl___%eax,0x32 &GLOBAL___stdout
mov____$i8,%rax !2
movl___%eax,0x32 &GLOBAL___stderr
;; M2-Planet pushes forward
mov____%rbp,%rax ;argc
add____$i8,%rax !8
mov____(%rax),%rax
push___%rax
mov____%rbp,%rax ;argv
add____$i8,%rax !16
push___%rax
mov____%rbp,%rax ;envp
add____$i8,%rax !8
mov____(%rax),%rax
add____$i8,%rax !0x03
shl____$i8,%rax !0x03
add____%rbp,%rax
push___%rax
;; mes c lib environ
mov____%rax,0x32 &GLOBAL_environ
call32 %FUNCTION_main
mov____%rax,%rdi
mov____$i32,%rax SYS_exit
syscall

View file

@ -0,0 +1,34 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mes/lib-mini.h"
int __stdin;
int __stdout;
int __stderr;
char **environ;
int main (int argc, char **argv, char **envp);
/* FIXME: this is going to be called `FUNCTION__start' */
//#int
//#_start ()
//#{
//# ..
//#}

View file

@ -0,0 +1,137 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,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/>.
*/
#include <errno.h>
#include <linux/x86_64/syscall.h>
long
__sys_call (long sys_call)
{
asm ("mov____0x8(%rbp),%rax !-8");
asm ("syscall");
}
long
__sys_call1 (long sys_call, long one)
{
asm ("mov____0x8(%rbp),%rax !-8");
asm ("mov____0x8(%rbp),%rdi !-16");
asm ("syscall");
}
long
__sys_call2 (long sys_call, long one, long two)
{
asm ("mov____0x8(%rbp),%rax !-8");
asm ("mov____0x8(%rbp),%rdi !-16");
asm ("mov____0x8(%rbp),%rsi !-24");
asm ("syscall");
}
long
__sys_call3 (long sys_call, long one, long two, long three)
{
asm ("mov____0x8(%rbp),%rax !-8");
asm ("mov____0x8(%rbp),%rdi !-16");
asm ("mov____0x8(%rbp),%rsi !-24");
asm ("mov____0x8(%rbp),%rdx !-32");
asm ("syscall");
}
long
__sys_call4 (long sys_call, long one, long two, long three, long four)
{
asm ("mov____0x8(%rbp),%rax !-8");
asm ("mov____0x8(%rbp),%rdi !-16");
asm ("mov____0x8(%rbp),%rsi !-24");
asm ("mov____0x8(%rbp),%rdx !-32");
asm ("mov____0x8(%rbp),%r10 !-40");
asm ("syscall");
}
long
_sys_call (long sys_call)
{
long r = __sys_call (sys_call);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call1 (long sys_call, long one)
{
long r = __sys_call1 (sys_call, one);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call2 (long sys_call, long one, long two)
{
long r = __sys_call2 (sys_call, one, two);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call3 (long sys_call, long one, long two, long three)
{
long r = __sys_call3 (sys_call, one, two, three);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}
long
_sys_call4 (long sys_call, long one, long two, long three, long four)
{
long r = __sys_call4 (sys_call, one, two, three, four);
if (r < 0)
{
errno = -r;
r = -1;
}
else
errno = 0;
return r;
}

View file

@ -0,0 +1,74 @@
### Copyright (C) 2016 Jeremiah Orians
### Copyright (C) 2017 Jan Nieuwenhuizen <janneke@gnu.org>
### This file is part of M2-Planet.
###
### M2-Planet 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.
###
### M2-Planet 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 M2-Planet. If not, see <http://www.gnu.org/licenses/>.
### stage0's hex2 format
### !<label> 1 byte relative
### $<label> 2 byte address
### @<label> 2 byte relative
### &<label> 4 byte address
### %<label> 4 byte relative
### if you wish to use this header, you need to add :ELF_end to the end of your
### M1 or hex2 files.
## ELF Header
:ELF_base
7F 45 4C 46 # e_ident[EI_MAG0-3] ELF's magic number
02 # e_ident[EI_CLASS] Indicating 64 bit
01 # e_ident[EI_DATA] Indicating little endianness
01 # e_ident[EI_VERSION] Indicating original elf
03 # e_ident[EI_OSABI] Set at 3 because FreeBSD is strict
00 # e_ident[EI_ABIVERSION] See above
00 00 00 00 00 00 00 # e_ident[EI_PAD]
02 00 # e_type Indicating Executable
3E 00 # e_machine Indicating AMD64
01 00 00 00 # e_version Indicating original elf
&_start 00 00 00 00 # e_entry Address of the entry point
%ELF_program_headers>ELF_base 00 00 00 00 # e_phoff Address of program header table
00 00 00 00 00 00 00 00 # e_shoff Address of section header table
00 00 00 00 # e_flags
40 00 # e_ehsize Indicating our 64 Byte header
38 00 # e_phentsize size of a program header table
01 00 # e_phnum number of entries in program table
00 00 # e_shentsize size of a section header table
00 00 # e_shnum number of entries in section table
00 00 # e_shstrndx index of the section names
:ELF_program_headers
:ELF_program_header__text
01 00 00 00 # ph_type: PT-LOAD = 1
07 00 00 00 # ph_flags: PF-X|PF-W|PF-R = 7
00 00 00 00 00 00 00 00 # ph_offset
&ELF_base 00 00 00 00 # ph_vaddr
&ELF_base 00 00 00 00 # ph_physaddr
%ELF_end>ELF_base 00 00 00 00 # ph_filesz
%ELF_end>ELF_base 00 00 00 00 # ph_memsz
01 00 00 00 00 00 00 00 # ph_align
:ELF_text

View file

@ -0,0 +1,101 @@
## Copyright (C) 2017 Jeremiah Orians
## This file is part of M2-Planet.
##
## M2-Planet 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.
##
## M2-Planet 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 M2-Planet. If not, see <http://www.gnu.org/licenses/>.
DEFINE ADD_IMMEDIATE_to_rax 4805
DEFINE ADD_IMMEDIATE_to_rbp 4881C5
DEFINE ADD_rax_to_rbx 4801C3
DEFINE ADD_rbp_to_rax 4801E8
DEFINE ADD_rbx_to_rax 4801D8
DEFINE AND_rax_rbx 4821D8
DEFINE CALL_IMMEDIATE E8
DEFINE CALL_rax FFD0
DEFINE CMP 4839C3
DEFINE COPY_rax_to_rcx 4889C1
DEFINE COPY_rax_to_rdi 4889C7
DEFINE COPY_rbx_to_rax 4889D8
DEFINE COPY_rbp_to_rax 4889E8
DEFINE COPY_rbx_to_rdi 4889DF
DEFINE COPY_rdi_to_rbp 4889FD
DEFINE COPY_rsp_to_rbp 4889E5
DEFINE COPY_RSP_to_RDI 4889E7
DEFINE CQTO 4899
DEFINE DIVIDE_rax_by_rbx_into_rax 48F7F3
DEFINE DIVIDES_rax_by_rbx_into_rax 48F7FB
DEFINE JUMP E9
DEFINE JUMP_EQ 0F84
DEFINE JUMP_NE 0F85
DEFINE LOAD_BASE_ADDRESS_rax 488D85
DEFINE LOAD_BYTE 480FBE00
DEFINE LOAD_BYTE_rbx 480FBE1B
DEFINE LOAD_EFFECTIVE_ADDRESS_rax 488D8424
DEFINE LOAD_EFFECTIVE_ADDRESS_rdi 488DBC24
DEFINE LOAD_EFFECTIVE_ADDRESS_rdx 488D9424
DEFINE LOAD_EFFECTIVE_ADDRESS_rsi 488DB424
DEFINE LOAD_IMMEDIATE_r10 48C7C2
DEFINE LOAD_IMMEDIATE_rax 48C7C0
DEFINE LOAD_IMMEDIATE_rbx 48C7C3
DEFINE LOAD_IMMEDIATE_rdi 48C7C7
DEFINE LOAD_IMMEDIATE_rdx 48C7C2
DEFINE LOAD_IMMEDIATE_rsi 48C7C6
DEFINE LOAD_INTEGER 488B00
DEFINE LOAD_INTEGER_rbx 488B1B
DEFINE LOAD_INTEGER_rdi 488B3F
DEFINE LOAD_INTEGER_rdx 488B12
DEFINE LOAD_INTEGER_rsi 488B36
DEFINE LOAD_RSP_IMMEDIATE_into_rax 488B8424
DEFINE MODULUS_rax_from_rbx_into_rbx 48F7F3
DEFINE MODULUSS_rax_from_rbx_into_rbx 48F7FB
DEFINE MOVE_rbx_to_rax 4889D8
DEFINE MOVE_rdx_to_rax 4889D0
DEFINE MOVEZX 480FB6C0
DEFINE MOVESX 4863C0
DEFINE MULTIPLY_rax_by_rbx_into_rax 48F7EB
DEFINE MULTIPLYS_rax_by_rbx_into_rax 48F7E3
DEFINE NULL 0000000000000000
DEFINE NOT_rax 48F7D0
DEFINE OR_rax_rbx 4809D8
DEFINE POP_RAX 58
DEFINE POP_RBP 5D
DEFINE POP_RBX 5B
DEFINE POP_RDI 5F
DEFINE PUSH_RAX 50
DEFINE PUSH_RBP 55
DEFINE PUSH_RBX 53
DEFINE PUSH_RDI 57
DEFINE RETURN C3
DEFINE SAL_rax_Immediate8 48C1E0
DEFINE SHL_rax_cl 48D3E0
DEFINE SAL_rax_cl 48D3F0
DEFINE SHR_rax_cl 48D3E8
DEFINE SAR_rax_cl 48D3F8
DEFINE SETA 0F97C0
DEFINE SETAE 0F93C0
DEFINE SETB 0F92C0
DEFINE SETBE 0F96C0
DEFINE SETE 0F94C0
DEFINE SETG 0F9FC0
DEFINE SETGE 0F9DC0
DEFINE SETL 0F9CC0
DEFINE SETLE 0F9EC0
DEFINE SETNE 0F95C0
DEFINE STORE_CHAR 8803
DEFINE STORE_INTEGER 488903
DEFINE SUBTRACT_rax_from_rbx_into_rbx 4829C3
DEFINE SYSCALL 0F05
DEFINE TEST 4885C0
DEFINE XCHG_rax_rbx 4893
DEFINE XOR_rbx_rax_into_rax 4831D8

View file

@ -28,6 +28,7 @@ DEFINE add____$i32,%rdi 4881c7
DEFINE add____$i32,(%rax) 8100 DEFINE add____$i32,(%rax) 8100
DEFINE add____$i32,0x32(%rbp) 8185 DEFINE add____$i32,0x32(%rbp) 8185
DEFINE add____$i8,%rax 4883c0 DEFINE add____$i8,%rax 4883c0
DEFINE add____$i8,%rbp 4883c5
DEFINE add____$i8,%rdi 4883c7 DEFINE add____$i8,%rdi 4883c7
DEFINE add____$i8,%rsp 4883c4 DEFINE add____$i8,%rsp 4883c4
DEFINE add____$i8,(%rax) 8300 DEFINE add____$i8,(%rax) 8300
@ -115,6 +116,7 @@ DEFINE mov____%rbp,%rsp 4889ec
DEFINE mov____%rbp,0x8(%rbp) 48896d DEFINE mov____%rbp,0x8(%rbp) 48896d
DEFINE mov____%rdi,%r8 4989f8 DEFINE mov____%rdi,%r8 4989f8
DEFINE mov____%rdi,%rax 4889f8 DEFINE mov____%rdi,%rax 4889f8
DEFINE mov____%rdi,%rbp 4889fd
DEFINE mov____%rdi,%rcx 4889f9 DEFINE mov____%rdi,%rcx 4889f9
DEFINE mov____%rdi,%rdi 4889ff DEFINE mov____%rdi,%rdi 4889ff
DEFINE mov____%rdi,0x32 48893c25 DEFINE mov____%rdi,0x32 48893c25

View file

@ -20,12 +20,15 @@
# kaem --verbose --strict --file scaffold/argv.kaem # kaem --verbose --strict --file scaffold/argv.kaem
# scaffold/argv-m2 # scaffold/argv-m2
cc_cpu=${cc_cpu:-i386}
mes_cpu=${mes_cpu:-x86} mes_cpu=${mes_cpu:-x86}
stage0_cpu=${stage0_cpu:-x86} stage0_cpu=${stage0_cpu:-x86}
M2-Planet \ M2-Planet \
--debug \ --debug \
--architecture ${stage0_cpu} \ --architecture ${stage0_cpu} \
-D __${cc_cpu}__=1 \
-D __linux__=1 \
-f include/mes/lib-mini.h \ -f include/mes/lib-mini.h \
-f lib/linux/${mes_cpu}-mes-m2/crt1.c \ -f lib/linux/${mes_cpu}-mes-m2/crt1.c \
-f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \

View file

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# Copyright © 2019,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -20,6 +20,7 @@
# kaem --verbose --strict --file scaffold/global-array.kaem # kaem --verbose --strict --file scaffold/global-array.kaem
# scaffold/global-array # scaffold/global-array
cc_cpu=${cc_cpu:-i386}
mes_cpu=${mes_cpu:-x86} mes_cpu=${mes_cpu:-x86}
stage0_cpu=${stage0_cpu:-x86} stage0_cpu=${stage0_cpu:-x86}
@ -27,6 +28,9 @@ M2-Planet \
--bootstrap-mode \ --bootstrap-mode \
--debug \ --debug \
--architecture ${stage0_cpu} \ --architecture ${stage0_cpu} \
-D __${cc_cpu}__=1 \
-D __linux__=1 \
-f lib/linux/${mes_cpu}-mes-m2/crt1.c \
-f lib/mes/globals.c \ -f lib/mes/globals.c \
-f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \
-f lib/linux/${mes_cpu}-mes-m2/_write.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \

View file

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2019,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -20,12 +20,15 @@
# kaem --verbose --strict --file scaffold/hello.kaem # kaem --verbose --strict --file scaffold/hello.kaem
# scaffold/hello-m2 # scaffold/hello-m2
cc_cpu=${cc_cpu:-i386}
mes_cpu=${mes_cpu:-x86} mes_cpu=${mes_cpu:-x86}
stage0_cpu=${stage0_cpu:-x86} stage0_cpu=${stage0_cpu:-x86}
M2-Planet \ M2-Planet \
--debug \ --debug \
--architecture ${stage0_cpu} \ --architecture ${stage0_cpu} \
-D __${cc_cpu}__=1 \
-D __linux__=1 \
-f include/mes/lib-mini.h \ -f include/mes/lib-mini.h \
-f lib/linux/${mes_cpu}-mes-m2/crt1.c \ -f lib/linux/${mes_cpu}-mes-m2/crt1.c \
-f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \

View file

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# Copyright © 2019,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -20,6 +20,7 @@
# kaem --verbose --strict --file scaffold/local-array.kaem # kaem --verbose --strict --file scaffold/local-array.kaem
# scaffold/local-array # scaffold/local-array
cc_cpu=${cc_cpu:-i386}
mes_cpu=${mes_cpu:-x86} mes_cpu=${mes_cpu:-x86}
stage0_cpu=${stage0_cpu:-x86} stage0_cpu=${stage0_cpu:-x86}
@ -27,6 +28,9 @@ M2-Planet \
--bootstrap-mode \ --bootstrap-mode \
--debug \ --debug \
--architecture ${stage0_cpu} \ --architecture ${stage0_cpu} \
-D __${cc_cpu}__=1 \
-D __linux__=1 \
-f lib/linux/${mes_cpu}-mes-m2/crt1.c \
-f lib/mes/globals.c \ -f lib/mes/globals.c \
-f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \
-f lib/linux/${mes_cpu}-mes-m2/_write.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \

View file

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# Copyright © 2019,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -20,6 +20,7 @@
# kaem --verbose --strict --file scaffold/local-static-array.kaem # kaem --verbose --strict --file scaffold/local-static-array.kaem
# scaffold/local-static-array # scaffold/local-static-array
cc_cpu=${cc_cpu:-i386}
mes_cpu=${mes_cpu:-x86} mes_cpu=${mes_cpu:-x86}
stage0_cpu=${stage0_cpu:-x86} stage0_cpu=${stage0_cpu:-x86}
@ -27,6 +28,9 @@ M2-Planet \
--bootstrap-mode \ --bootstrap-mode \
--debug \ --debug \
--architecture ${stage0_cpu} \ --architecture ${stage0_cpu} \
-f lib/linux/${mes_cpu}-mes-m2/crt1.c \
-D __${cc_cpu}__=1 \
-D __linux__=1 \
-f lib/mes/globals.c \ -f lib/mes/globals.c \
-f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \
-f lib/linux/${mes_cpu}-mes-m2/_write.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \

View file

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2019,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -20,12 +20,15 @@
# kaem --verbose --strict --file scaffold/main.kaem # kaem --verbose --strict --file scaffold/main.kaem
# scaffold/main-m2 # scaffold/main-m2
cc_cpu=${cc_cpu:-i386}
mes_cpu=${mes_cpu:-x86} mes_cpu=${mes_cpu:-x86}
stage0_cpu=${stage0_cpu:-x86} stage0_cpu=${stage0_cpu:-x86}
M2-Planet \ M2-Planet \
--debug \ --debug \
--architecture ${stage0_cpu} \ --architecture ${stage0_cpu} \
-D __${cc_cpu}__=1 \
-D __linux__=1 \
-f lib/linux/${mes_cpu}-mes-m2/crt1.c \ -f lib/linux/${mes_cpu}-mes-m2/crt1.c \
-f scaffold/main.c \ -f scaffold/main.c \
-o scaffold/main.M1 -o scaffold/main.M1

View file

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2019,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -20,12 +20,15 @@
# kaem --verbose --strict --file scaffold/read.kaem # kaem --verbose --strict --file scaffold/read.kaem
# scaffold/read-m2 # scaffold/read-m2
cc_cpu=${cc_cpu:-i386}
mes_cpu=${mes_cpu:-x86} mes_cpu=${mes_cpu:-x86}
stage0_cpu=${stage0_cpu:-x86} stage0_cpu=${stage0_cpu:-x86}
M2-Planet \ M2-Planet \
--debug \ --debug \
--architecture ${stage0_cpu} \ --architecture ${stage0_cpu} \
-D __${cc_cpu}__=1 \
-D __linux__=1 \
-f lib/linux/${mes_cpu}-mes-m2/crt1.c \ -f lib/linux/${mes_cpu}-mes-m2/crt1.c \
-f include/mes/lib-mini.h \ -f include/mes/lib-mini.h \
-f lib/linux/${mes_cpu}-mes-m2/_write.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \

View file

@ -373,15 +373,16 @@ waitpid_ (struct scm *pid, struct scm *options)
return cons (make_number (child), make_number (status)); return cons (make_number (child), make_number (status));
} }
#if __M2__ #if __x86_64__
/* Milliseconds for everyone else. */
#define TIME_UNITS_PER_SECOND 1000
#elif __x86_64__
/* Nanoseconds on 64-bit systems with POSIX timers. */ /* Nanoseconds on 64-bit systems with POSIX timers. */
#if __M2__
#define TIME_UNITS_PER_SECOND 1000000000
#else
#define TIME_UNITS_PER_SECOND 1000000000U #define TIME_UNITS_PER_SECOND 1000000000U
#endif
#else #else
/* Milliseconds for everyone else. */ /* Milliseconds for everyone else. */
#define TIME_UNITS_PER_SECOND 1000U #define TIME_UNITS_PER_SECOND 1000
#endif #endif
struct scm * struct scm *