mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
Support the Cygwin build of MPS
* mps/code/prmccyi6.c: * mps/code/cyi6gc.gmk: New files, for the Cygwin build. * mps/code/config.h: * mps/code/lockix.c: * mps/code/prmcix.c: * mps/code/protix.c: * mps/code/protsgix.c: * mps/code/pthrdext.c: * mps/code/testthr.h: * mps/code/thix.c: * mps/code/vmix.c: Port to Cygwin. * mps/configure.ac (x86_64-*-cygwin*/no): Add definitions for Cygwin. * mps/code/mps.c [MPS_PF_CYI6GC]: * mps/code/mpstd.h: Define 64-bit Cygwin stuff. * mps/code/gcbench.c: [MPS_OS_CY]: * mps/code/djbench.c [MPS_OS_CY]: Include alloca.h. * mps/code/arenacv.c (TEST_ARENA_SIZE) [MPS_OS_CY]: Increase to make test pass. (Bug#74805) * mps/code/arenavm.c (VMArenaCreate): Avoid compiler warning.
This commit is contained in:
parent
67161c7fff
commit
15bddbabf9
18 changed files with 190 additions and 18 deletions
|
|
@ -464,7 +464,11 @@ static void testSize(Size size)
|
|||
}
|
||||
|
||||
|
||||
#ifdef MPS_OS_CY /* Bug#74805 */
|
||||
#define TEST_ARENA_SIZE (ARENA_CLIENT_GRAIN_SIZE << 17)
|
||||
#lse
|
||||
#define TEST_ARENA_SIZE ((Size)16<<22)
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ static Res VMArenaCreate(Arena *arenaReturn, ArgList args)
|
|||
VM vm = &vmStruct;
|
||||
Chunk chunk;
|
||||
mps_arg_s arg;
|
||||
char vmParams[VMParamSize];
|
||||
char vmParams[VMParamSize] = {0}; /* Pacify gcc. */
|
||||
|
||||
AVER(arenaReturn != NULL);
|
||||
AVERT(ArgList, args);
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@
|
|||
* <https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html>
|
||||
*/
|
||||
|
||||
#if defined(MPS_OS_LI)
|
||||
#if defined(MPS_OS_LI) || defined(MPS_OS_CY)
|
||||
|
||||
#if defined(_XOPEN_SOURCE) && _XOPEN_SOURCE < 500
|
||||
#undef _XOPEN_SOURCE
|
||||
|
|
@ -616,7 +616,7 @@
|
|||
|
||||
/* POSIX thread extensions configuration -- see <code/pthrdext.c> */
|
||||
|
||||
#if defined(MPS_OS_LI) || defined(MPS_OS_FR)
|
||||
#if defined(MPS_OS_LI) || defined(MPS_OS_FR) || defined(MPS_OS_CY)
|
||||
|
||||
/* PTHREADEXT_SIGSUSPEND -- signal used to suspend a thread
|
||||
* <design/pthreadext#.impl.signals>
|
||||
|
|
|
|||
54
mps/code/cyi6gc.gmk
Normal file
54
mps/code/cyi6gc.gmk
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# -*- makefile -*-
|
||||
#
|
||||
# cyi6gc.gmk: BUILD FOR CYGWIN/x64/GCC PLATFORM
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2001-2020 Ravenbrook Limited. See end of file for license.
|
||||
|
||||
PFM = cyi6gc
|
||||
|
||||
MPMPF = \
|
||||
lockix.c \
|
||||
prmcanan.c \
|
||||
prmccyi6.c \
|
||||
prmcix.c \
|
||||
protix.c \
|
||||
protsgix.c \
|
||||
pthrdext.c \
|
||||
span.c \
|
||||
thix.c \
|
||||
vmix.c
|
||||
|
||||
LIBS = -lm -lpthread
|
||||
|
||||
include gc.gmk
|
||||
include comm.gmk
|
||||
|
||||
|
||||
# C. COPYRIGHT AND LICENSE
|
||||
#
|
||||
# Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
@ -24,6 +24,11 @@
|
|||
|
||||
#include <stdio.h> /* fprintf, stderr */
|
||||
#include <stdlib.h> /* alloca, exit, EXIT_SUCCESS, EXIT_FAILURE */
|
||||
|
||||
#ifdef MPS_OS_CY
|
||||
#include <alloca.h> /* alloca is here on Cygwin */
|
||||
#endif
|
||||
|
||||
#include <time.h> /* CLOCKS_PER_SEC, clock */
|
||||
|
||||
#define DJMUST(expr) \
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@
|
|||
|
||||
#include <stdio.h> /* fprintf, printf, putchars, sscanf, stderr, stdout */
|
||||
#include <stdlib.h> /* alloca, exit, EXIT_FAILURE, EXIT_SUCCESS, strtoul */
|
||||
|
||||
#ifdef MPS_OS_CY
|
||||
#include <alloca.h> /* alloca is here on Cygwin */
|
||||
#endif
|
||||
|
||||
#include <time.h> /* clock, CLOCKS_PER_SEC */
|
||||
|
||||
#define RESMUST(expr) \
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@
|
|||
|
||||
#include "mpm.h"
|
||||
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC)
|
||||
#error "lockix.c is specific to MPS_OS_FR, MPS_OS_LI or MPS_OS_XC"
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC) \
|
||||
&& !defined(MPS_OS_CY)
|
||||
#error "lockix.c is specific to MPS_OS_FR, MPS_OS_LI, MPS_OS_XC, or MPS_OS_CY"
|
||||
#endif
|
||||
|
||||
#include "lock.h"
|
||||
|
|
|
|||
|
|
@ -256,6 +256,21 @@
|
|||
#include "spw3i6.c" /* Windows on x86-64 stack probe */
|
||||
#include "mpsiw3.c" /* Windows interface layer extras */
|
||||
|
||||
/* Cygwin on x86-64 built with GCC */
|
||||
|
||||
#elif defined(MPS_PF_CYI6GC)
|
||||
|
||||
#include "lockix.c" /* Posix locks */
|
||||
#include "thix.c" /* Posix threading */
|
||||
#include "pthrdext.c" /* Posix thread extensions */
|
||||
#include "vmix.c" /* Posix virtual memory */
|
||||
#include "protix.c" /* Posix protection */
|
||||
#include "protsgix.c" /* Posix signal handling */
|
||||
#include "prmcanan.c" /* generic architecture mutator context */
|
||||
#include "prmcix.c" /* Posix mutator context */
|
||||
#include "prmccyi6.c" /* x86-64 for Cygwin mutator context */
|
||||
#include "span.c" /* generic stack probe */
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown platform -- can't determine platform specific parts."
|
||||
|
|
|
|||
|
|
@ -424,6 +424,25 @@
|
|||
#define MPS_PF_ALIGN 16
|
||||
|
||||
|
||||
/* GCC 12.4.0, gcc -E -dM */
|
||||
|
||||
#elif defined(__CYGWIN__) && defined(__x86_64__) && defined(__GNUC__) \
|
||||
&& !defined(__clang__)
|
||||
#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_CYI6GC)
|
||||
#error "specified CONFIG_PF_... inconsistent with detected cyi6gc"
|
||||
#endif
|
||||
#define MPS_PF_CYI6GC
|
||||
#define MPS_PF_STRING "cyi6gc"
|
||||
#define MPS_OS_CY
|
||||
#define MPS_ARCH_I6
|
||||
#define MPS_BUILD_GC
|
||||
#define MPS_T_WORD unsigned long
|
||||
#define MPS_T_ULONGEST unsigned long
|
||||
#define MPS_WORD_WIDTH 64
|
||||
#define MPS_WORD_SHIFT 6
|
||||
#define MPS_PF_ALIGN 8
|
||||
|
||||
|
||||
#else
|
||||
#error "The MPS Kit does not have a configuration for this platform out of the box; see manual/build.txt"
|
||||
#endif
|
||||
|
|
|
|||
58
mps/code/prmccyi6.c
Normal file
58
mps/code/prmccyi6.c
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* prmccyi6.c: MUTATOR CONTEXT x64 (CYGWIN)
|
||||
*
|
||||
* $Id$
|
||||
* Copyright (c) 2001-2020 Ravenbrook Limited. See end of file for license.
|
||||
*
|
||||
* .purpose: Implement the mutator context module. <design/prmc>.
|
||||
*
|
||||
*
|
||||
* ASSUMPTIONS
|
||||
*
|
||||
* .sp: The stack pointer in the context is RSP.
|
||||
*/
|
||||
|
||||
#include "prmcix.h"
|
||||
#include "prmci6.h"
|
||||
|
||||
SRCID(prmcfri6, "$Id$");
|
||||
|
||||
#if !defined(MPS_OS_CY) || !defined(MPS_ARCH_I6)
|
||||
#error "prmccyi6.c is specific to MPS_OS_CY and MPS_ARCH_I6"
|
||||
#endif
|
||||
|
||||
|
||||
Addr MutatorContextSP(MutatorContext context)
|
||||
{
|
||||
AVERT(MutatorContext, context);
|
||||
return (Addr)context->ucontext->uc_mcontext.rsp; /* .sp */
|
||||
}
|
||||
|
||||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
#include "mpm.h"
|
||||
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
|
||||
#error "prmcix.c is specific to MPS_OS_FR or MPS_OS_LI"
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
|
||||
#error "prmcix.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
|
||||
#endif
|
||||
|
||||
#include "prmcix.h"
|
||||
|
|
|
|||
|
|
@ -35,8 +35,9 @@
|
|||
|
||||
#include "mpm.h"
|
||||
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC)
|
||||
#error "protix.c is specific to MPS_OS_FR, MPS_OS_LI or MPS_OS_XC"
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC) \
|
||||
&& !defined(MPS_OS_CY)
|
||||
#error "protix.c is specific to MPS_OS_FR, MPS_OS_LI, MPS_OS_XC, or MPS_OS_CY"
|
||||
#endif
|
||||
|
||||
#include "vm.h"
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
#include "mpm.h"
|
||||
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
|
||||
#error "protsgix.c is specific to MPS_OS_FR or MPS_OS_LI"
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
|
||||
#error "protsgix.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
|
||||
#endif
|
||||
|
||||
#include "prmcix.h"
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
#include "mpm.h"
|
||||
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
|
||||
#error "pthrdext.c is specific to MPS_OS_FR or MPS_OS_LI"
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
|
||||
#error "pthrdext.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
|
||||
#endif
|
||||
|
||||
#include "pthrdext.h"
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ typedef struct testthr_t {
|
|||
void *result; /* result returned from start */
|
||||
} testthr_t;
|
||||
|
||||
#elif defined(MPS_OS_FR) || defined(MPS_OS_LI) || defined(MPS_OS_XC)
|
||||
#elif defined(MPS_OS_FR) || defined(MPS_OS_LI) || defined(MPS_OS_XC) \
|
||||
|| defined(MPS_OS_CY)
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@
|
|||
|
||||
#include "mpm.h"
|
||||
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
|
||||
#error "thix.c is specific to MPS_OS_FR or MPS_OS_LI"
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
|
||||
#error "thix.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
|
||||
#endif
|
||||
|
||||
#include "prmcix.h"
|
||||
|
|
|
|||
|
|
@ -40,8 +40,9 @@
|
|||
|
||||
#include "mpm.h"
|
||||
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC)
|
||||
#error "vmix.c is specific to MPS_OS_FR, MPS_OS_LI or MPS_OS_XC"
|
||||
#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC) \
|
||||
&& !defined(MPS_OS_CY)
|
||||
#error "vmix.c is specific to MPS_OS_FR, MPS_OS_LI, MPS_OS_XC, or MPS_OS_CY"
|
||||
#endif
|
||||
|
||||
#include "vm.h"
|
||||
|
|
|
|||
|
|
@ -180,6 +180,14 @@ case $host/$CLANG in
|
|||
PFMCFLAGS="$CFLAGS_GC"
|
||||
EXEEXT=.exe
|
||||
;;
|
||||
x86_64-*-cygwin*/no)
|
||||
AC_MSG_RESULT([Cygwin x86_64])
|
||||
MPS_OS_NAME=cy
|
||||
MPS_ARCH_NAME=i6
|
||||
MPS_BUILD_NAME=gc
|
||||
PFMCFLAGS="$CFLAGS_GC"
|
||||
EXEEXT=.exe
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([MPS does not support this platform out of the box. See manual/build.txt])
|
||||
esac
|
||||
|
|
|
|||
Loading…
Reference in a new issue