Add mes and mescc-tools-extra

mescc-tools-extra contains two important tools:
- cp
- chmod

mes first builds itself from a mes 0.21 seed as used by guix, and then
builds a mes 0.22 and then mes 0.22 using that created mes 0.22.

It does /not/ use bootstrap.sh as we don't have a proper shell at this
point, it has been manually adapted for kaem.
This commit is contained in:
fosslinux 2020-12-25 18:40:14 +11:00
parent 2706e07556
commit 649d7b68dc
1029 changed files with 120985 additions and 18 deletions

View file

@ -0,0 +1,75 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 1992-2016 Free Software Foundation, Inc.
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
/** Commentary:
Taken from GNU C Library
*/
#define _GNU_SOURCE 1
#define __USE_GNU 1
#define __FILE_defined 1
#include <stdio.h>
#include <mach/mach-init.h>
#include <mach.h>
#include <unistd.h>
mach_port_t __mach_task_self_;
mach_port_t __mach_host_self_;
vm_size_t __vm_page_size = 0;
void
__mach_init (void)
{
kern_return_t err;
#ifdef HAVE_HOST_PAGE_SIZE
if (err = __host_page_size (mach_host_self (), &__vm_page_size))
_exit (err);
#else
{
vm_statistics_data_t stats;
if (err = __vm_statistics (mach_task_self (), &stats))
_exit (err);
__vm_page_size = stats.pagesize;
}
#endif
}
extern mach_port_t __mach_host_self (void);
mach_port_t
mach_host_self (void)
{
if (!__mach_host_self_)
__mach_host_self_ = __mach_host_self ();
return __mach_host_self_;
}
extern mach_port_t __mach_task_self (void);
mach_port_t
mach_task_self (void)
{
if (!__mach_task_self_)
__mach_task_self_ = __mach_task_self ();
return __mach_task_self_;
}

View file

@ -0,0 +1,3 @@
#include <mach/machine/syscall_sw.h>
kernel_trap (__mach_host_self,-29,0)
// weak_alias (__mach_host_self, mach_host_self)

View file

@ -0,0 +1,3 @@
#include <mach/machine/syscall_sw.h>
kernel_trap (__mach_msg_trap,-25,7)
// weak_alias (__mach_msg_trap, mach_msg_trap)

View file

@ -0,0 +1,3 @@
#include <mach/machine/syscall_sw.h>
kernel_trap (__mach_reply_port,-26,0)
// weak_alias (__mach_reply_port, mach_reply_port)

View file

@ -0,0 +1,3 @@
#include <mach/machine/syscall_sw.h>
kernel_trap (__mach_task_self,-28,0)
// weak_alias (__mach_task_self, mach_task_self)

View file

@ -0,0 +1,19 @@
#if 1
#include <mach/machine/syscall_sw.h>
kernel_trap (__mach_thread_self,-27,0)
// weak_alias (__mach_thread_self, mach_thread_self)
#else
.globl __mach_thread_self
.type __mach_thread_self,@function
.align 1<<4
__mach_thread_self: .cfi_startproc
movl $ -27,%eax
.byte 0x9a
.long 0
.word 0x7
ret
.cfi_endproc
.size __mach_thread_self,.-__mach_thread_self
.weak mach_thread_self
mach_thread_self = __mach_thread_self
#endif

View file

@ -0,0 +1,145 @@
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989, 1995 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#include <mach/port.h>
#include <mach/message.h>
#ifdef MACH_MSG_OVERWRITE
/* In variants with this feature, the actual system call is
__mach_msg_overwrite_trap. */
mach_msg_return_t
__mach_msg_trap (mach_msg_header_t *msg,
mach_msg_option_t option,
mach_msg_size_t send_size,
mach_msg_size_t rcv_size,
mach_port_t rcv_name,
mach_msg_timeout_t timeout,
mach_port_t notify)
{
return __mach_msg_overwrite_trap (msg, option, send_size,
rcv_size, rcv_name, timeout, notify,
MACH_MSG_NULL, 0);
}
weak_alias (__mach_msg_trap, mach_msg_trap)
/* See comments below in __mach_msg. */
mach_msg_return_t
__mach_msg_overwrite (mach_msg_header_t *msg,
mach_msg_option_t option,
mach_msg_size_t send_size,
mach_msg_size_t rcv_size,
mach_port_t rcv_name,
mach_msg_timeout_t timeout,
mach_port_t notify,
mach_msg_header_t *rcv_msg,
mach_msg_size_t rcv_msg_size)
{
mach_msg_return_t ret;
/* Consider the following cases:
1. Errors in pseudo-receive (eg, MACH_SEND_INTERRUPTED
plus special bits).
2. Use of MACH_SEND_INTERRUPT/MACH_RCV_INTERRUPT options.
3. RPC calls with interruptions in one/both halves.
*/
ret = __mach_msg_overwrite_trap (msg, option, send_size,
rcv_size, rcv_name, timeout, notify,
rcv_msg, rcv_msg_size);
if (ret == MACH_MSG_SUCCESS)
return MACH_MSG_SUCCESS;
if (!(option & MACH_SEND_INTERRUPT))
while (ret == MACH_SEND_INTERRUPTED)
ret = __mach_msg_overwrite_trap (msg, option, send_size,
rcv_size, rcv_name, timeout, notify,
rcv_msg, rcv_msg_size);
if (!(option & MACH_RCV_INTERRUPT))
while (ret == MACH_RCV_INTERRUPTED)
ret = __mach_msg_overwrite_trap (msg, option & ~MACH_SEND_MSG,
0, rcv_size, rcv_name, timeout, notify,
rcv_msg, rcv_msg_size);
return ret;
}
weak_alias (__mach_msg_overwrite, mach_msg_overwrite)
#endif
mach_msg_return_t
__mach_msg (mach_msg_header_t *msg,
mach_msg_option_t option,
mach_msg_size_t send_size,
mach_msg_size_t rcv_size,
mach_port_t rcv_name,
mach_msg_timeout_t timeout,
mach_port_t notify)
{
mach_msg_return_t ret;
/* Consider the following cases:
1. Errors in pseudo-receive (eg, MACH_SEND_INTERRUPTED
plus special bits).
2. Use of MACH_SEND_INTERRUPT/MACH_RCV_INTERRUPT options.
3. RPC calls with interruptions in one/both halves.
*/
ret = __mach_msg_trap (msg, option, send_size,
rcv_size, rcv_name, timeout, notify);
if (ret == MACH_MSG_SUCCESS)
return MACH_MSG_SUCCESS;
if (!(option & MACH_SEND_INTERRUPT))
while (ret == MACH_SEND_INTERRUPTED)
ret = __mach_msg_trap (msg, option, send_size,
rcv_size, rcv_name, timeout, notify);
if (!(option & MACH_RCV_INTERRUPT))
while (ret == MACH_RCV_INTERRUPTED)
ret = __mach_msg_trap (msg, option & ~MACH_SEND_MSG,
0, rcv_size, rcv_name, timeout, notify);
return ret;
}
// weak_alias (__mach_msg, mach_msg)
mach_msg_return_t
__mach_msg_send (mach_msg_header_t *msg)
{
return __mach_msg (msg, MACH_SEND_MSG,
msg->msgh_size, 0, MACH_PORT_NULL,
MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
}
// weak_alias (__mach_msg_send, mach_msg_send)
mach_msg_return_t
__mach_msg_receive (mach_msg_header_t *msg)
{
return __mach_msg (msg, MACH_RCV_MSG,
0, msg->msgh_size, msg->msgh_local_port,
MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
}
// weak_alias (__mach_msg_receive, mach_msg_receive)