aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorRichard Brooksby2012-08-08 19:02:57 +0100
committerRichard Brooksby2012-08-08 19:02:57 +0100
commit215ef086cb452dbeaea7d86abdd7c9fb237f6271 (patch)
tree089521c3e105c03a5652fb725fafc66fc900531f /mps/code
parente4d51297717dd6cf4326989507409df5005feef4 (diff)
downloademacs-215ef086cb452dbeaea7d86abdd7c9fb237f6271.tar.gz
emacs-215ef086cb452dbeaea7d86abdd7c9fb237f6271.zip
Removed support for old or dead platforms: osf/1, irix, mac system 7, sunos, windows nt on alpha, windows nt on powerpc.
See <https://github.com/datafueled/memory-pool-system/pull/3> for the origin of this change. Copied from Perforce Change: 178872 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/config.h4
-rw-r--r--mps/code/dc.gmk68
-rw-r--r--mps/code/dumper.c3
-rw-r--r--mps/code/eventcnv.c3
-rw-r--r--mps/code/eventrep.c3
-rw-r--r--mps/code/i6cc.gmk72
-rw-r--r--mps/code/iam4cc.gmk62
-rw-r--r--mps/code/ic.gmk62
-rw-r--r--mps/code/lc.gmk65
-rw-r--r--mps/code/mpsioan.c14
-rw-r--r--mps/code/mpsliban.c13
-rw-r--r--mps/code/mpstd.h229
-rw-r--r--mps/code/o1alcc.gmk62
-rw-r--r--mps/code/o1algc.gmk61
-rw-r--r--mps/code/ossu.h134
-rw-r--r--mps/code/protix.c8
-rw-r--r--mps/code/proto1.c241
-rw-r--r--mps/code/protsgix.c4
-rw-r--r--mps/code/protsu.c277
-rw-r--r--mps/code/replay.c3
-rw-r--r--mps/code/s7ppac/Makefile248
-rw-r--r--mps/code/sacss.c3
-rw-r--r--mps/code/sso1al.s82
-rw-r--r--mps/code/sssus8.c104
-rw-r--r--mps/code/sssus8.s81
-rw-r--r--mps/code/sus8gc.gmk57
-rw-r--r--mps/code/table.c4
-rw-r--r--mps/code/testlib.h3
-rw-r--r--mps/code/vmi5.c318
-rw-r--r--mps/code/vmo1.c341
-rw-r--r--mps/code/vmsu.c356
31 files changed, 8 insertions, 2977 deletions
diff --git a/mps/code/config.h b/mps/code/config.h
index 895c4fe7f77..fa944167710 100644
--- a/mps/code/config.h
+++ b/mps/code/config.h
@@ -259,7 +259,7 @@
259 define what signal number to use, and what si_code value to check. 259 define what signal number to use, and what si_code value to check.
260*/ 260*/
261 261
262#if defined(MPS_OS_O1) || defined(MPS_OS_SO) || defined(MPS_OS_FR) 262#if defined(MPS_OS_SO) || defined(MPS_OS_FR)
263#define PROT_SIGNAL (SIGSEGV) 263#define PROT_SIGNAL (SIGSEGV)
264#elif defined(MPS_OS_XC) 264#elif defined(MPS_OS_XC)
265#define PROT_SIGNAL (SIGBUS) 265#define PROT_SIGNAL (SIGBUS)
@@ -267,7 +267,7 @@
267 267
268#if defined(MPS_OS_XC) 268#if defined(MPS_OS_XC)
269#define PROT_SIGINFO_GOOD(info) (1) 269#define PROT_SIGINFO_GOOD(info) (1)
270#elif defined(MPS_OS_O1) || defined(MPS_OS_FR) 270#elif defined(MPS_OS_FR)
271#define PROT_SIGINFO_GOOD(info) ((info)->si_code == SEGV_ACCERR) 271#define PROT_SIGINFO_GOOD(info) ((info)->si_code == SEGV_ACCERR)
272#endif 272#endif
273 273
diff --git a/mps/code/dc.gmk b/mps/code/dc.gmk
deleted file mode 100644
index f2fc6b02d5f..00000000000
--- a/mps/code/dc.gmk
+++ /dev/null
@@ -1,68 +0,0 @@
1# dc.gmk: GNUMAKEFILE FRAGMENT FOR DIGITAL C COMPILER (DEC UNIX/OSF)
2#
3# $Id$
4# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5#
6# See design.buildsys.unix
7#
8# This file is included by platform makefiles that use the Digital C
9# compiler.
10#
11# Options are derived from man cc on schiele
12#
13# There is a potentially useful option -check
14# Unfortunately it produces warnings about non casting printf to void
15# and bogus warnings about non-void functions not having a return statement
16# as the last statement. We would need to cleam our code in order to use
17# the option.
18
19CC = cc
20CFLAGSCOMPILER = -std1 -w2 -warnprotos -portable -readonly_strings
21CFLAGSDEBUG = -g2
22CFLAGSOPT = -O2 -g3
23CFLAGSOPTNODEBUG = -O2
24
25# -M for a dependency file
26
27include comm.gmk
28
29
30# C. COPYRIGHT AND LICENSE
31#
32# Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
33# All rights reserved. This is an open source license. Contact
34# Ravenbrook for commercial licensing options.
35#
36# Redistribution and use in source and binary forms, with or without
37# modification, are permitted provided that the following conditions are
38# met:
39#
40# 1. Redistributions of source code must retain the above copyright
41# notice, this list of conditions and the following disclaimer.
42#
43# 2. Redistributions in binary form must reproduce the above copyright
44# notice, this list of conditions and the following disclaimer in the
45# documentation and/or other materials provided with the distribution.
46#
47# 3. Redistributions in any form must be accompanied by information on how
48# to obtain complete source code for this software and any accompanying
49# software that uses this software. The source code must either be
50# included in the distribution or be available for no more than the cost
51# of distribution plus a nominal fee, and must be freely redistributable
52# under reasonable conditions. For an executable file, complete source
53# code means the source code for all modules it contains. It does not
54# include source code for modules or files that typically accompany the
55# major components of the operating system on which the executable file
56# runs.
57#
58# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
59# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
60# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
61# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
62# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
63# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
64# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
65# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
66# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
67# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
68# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/dumper.c b/mps/code/dumper.c
index 9fe373cf8c2..2c87a5d9b53 100644
--- a/mps/code/dumper.c
+++ b/mps/code/dumper.c
@@ -16,9 +16,6 @@
16#include <stdarg.h> 16#include <stdarg.h>
17#include <assert.h> 17#include <assert.h>
18#include "mpstd.h" 18#include "mpstd.h"
19#ifdef MPS_OS_SU
20#include "ossu.h"
21#endif
22 19
23typedef MPS_T_WORD Word; 20typedef MPS_T_WORD Word;
24typedef struct AddrStruct *Addr; 21typedef struct AddrStruct *Addr;
diff --git a/mps/code/eventcnv.c b/mps/code/eventcnv.c
index 9fd35b9d853..2b98b4b7e01 100644
--- a/mps/code/eventcnv.c
+++ b/mps/code/eventcnv.c
@@ -21,9 +21,6 @@
21#include <string.h> /* for strcmp */ 21#include <string.h> /* for strcmp */
22#include <math.h> /* for sqrt */ 22#include <math.h> /* for sqrt */
23#include "mpstd.h" 23#include "mpstd.h"
24#ifdef MPS_OS_SU
25#include "ossu.h"
26#endif
27 24
28#ifdef MPS_BUILD_MV 25#ifdef MPS_BUILD_MV
29/* MSVC warning 4996 = stdio / C runtime 'unsafe' */ 26/* MSVC warning 4996 = stdio / C runtime 'unsafe' */
diff --git a/mps/code/eventrep.c b/mps/code/eventrep.c
index e0d8e2baa17..7bbf2828eb2 100644
--- a/mps/code/eventrep.c
+++ b/mps/code/eventrep.c
@@ -29,9 +29,6 @@
29#include <stdlib.h> /* for EXIT_FAILURE */ 29#include <stdlib.h> /* for EXIT_FAILURE */
30#include <stdio.h> /* for printf */ 30#include <stdio.h> /* for printf */
31#include "mpstd.h" 31#include "mpstd.h"
32#ifdef MPS_OS_SU
33#include "ossu.h"
34#endif
35 32
36 33
37#ifdef MPS_PF_W3I6MV 34#ifdef MPS_PF_W3I6MV
diff --git a/mps/code/i6cc.gmk b/mps/code/i6cc.gmk
deleted file mode 100644
index c0628181e59..00000000000
--- a/mps/code/i6cc.gmk
+++ /dev/null
@@ -1,72 +0,0 @@
1# ic.gmk: GNUMAKEFILE FRAGMENT FOR IRIX 6 CC (N32 or N64 ABI)
2#
3# $Id$
4# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5#
6# This file is included by platform makefiles that use the IRIX 6 CC
7# compiler. It defines the compiler specific variables that the
8# common makefile fragment (<code/comm.gmk>) requires.
9
10
11CC = cc
12
13
14# suppress error(1174): function "foo" was declared but never referenced
15# because it happens with vfork in <unistd.h> included from vmi5.c
16# suppress error(1196): function declared implicitly
17# because it happens with __vfork in <unistd.h> included from vmi5.c
18# suppress remark(1209): 'controlling expression is constant'
19# because it occurs in 'while(0)' and statically determined checks
20# suppress remark(1552): 'variable "foo" was set but never used'
21# (e.g. variables only used in asserts)
22# can't use -pedantic because Irix header files have #ident
23
24CFLAGSCOMPILER = -ansi -fullwarn -w2 -diag_error 1000-9999 \
25 -diag_suppress 1174,1196,1209,1552
26CFLAGSDEBUG = -g
27CFLAGSOPT = -O -g3
28CFLAGSOPTNODEBUG = -O
29
30
31include comm.gmk
32
33
34# C. COPYRIGHT AND LICENSE
35#
36# Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
37# All rights reserved. This is an open source license. Contact
38# Ravenbrook for commercial licensing options.
39#
40# Redistribution and use in source and binary forms, with or without
41# modification, are permitted provided that the following conditions are
42# met:
43#
44# 1. Redistributions of source code must retain the above copyright
45# notice, this list of conditions and the following disclaimer.
46#
47# 2. Redistributions in binary form must reproduce the above copyright
48# notice, this list of conditions and the following disclaimer in the
49# documentation and/or other materials provided with the distribution.
50#
51# 3. Redistributions in any form must be accompanied by information on how
52# to obtain complete source code for this software and any accompanying
53# software that uses this software. The source code must either be
54# included in the distribution or be available for no more than the cost
55# of distribution plus a nominal fee, and must be freely redistributable
56# under reasonable conditions. For an executable file, complete source
57# code means the source code for all modules it contains. It does not
58# include source code for modules or files that typically accompany the
59# major components of the operating system on which the executable file
60# runs.
61#
62# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
63# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
64# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
65# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
66# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
67# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
68# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
69# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
70# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
71# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
72# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/iam4cc.gmk b/mps/code/iam4cc.gmk
deleted file mode 100644
index 4519d55c722..00000000000
--- a/mps/code/iam4cc.gmk
+++ /dev/null
@@ -1,62 +0,0 @@
1# iam4cc.gmk: BUILD FOR IRIX 6 N32/MIPS IV/CC PLATFORM
2#
3# $Id$
4# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5#
6# This is the GNU makefile for platform.iam4cc.
7
8PFM = iam4cc
9PFMDEFS = -n32
10
11MPMPF = lockan.c than.c vmi5.c \
12 protan.c prmcan.c ssan.c span.c
13SWPF = than.c vmi5.c protsw.c prmcan.c ssan.c
14
15LIBS = -lm
16
17LINKFLAGS = -n32
18ARFLAGSPFM = s
19
20AR=/bin/ar
21include i6cc.gmk
22
23
24# C. COPYRIGHT AND LICENSE
25#
26# Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
27# All rights reserved. This is an open source license. Contact
28# Ravenbrook for commercial licensing options.
29#
30# Redistribution and use in source and binary forms, with or without
31# modification, are permitted provided that the following conditions are
32# met:
33#
34# 1. Redistributions of source code must retain the above copyright
35# notice, this list of conditions and the following disclaimer.
36#
37# 2. Redistributions in binary form must reproduce the above copyright
38# notice, this list of conditions and the following disclaimer in the
39# documentation and/or other materials provided with the distribution.
40#
41# 3. Redistributions in any form must be accompanied by information on how
42# to obtain complete source code for this software and any accompanying
43# software that uses this software. The source code must either be
44# included in the distribution or be available for no more than the cost
45# of distribution plus a nominal fee, and must be freely redistributable
46# under reasonable conditions. For an executable file, complete source
47# code means the source code for all modules it contains. It does not
48# include source code for modules or files that typically accompany the
49# major components of the operating system on which the executable file
50# runs.
51#
52# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
53# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
54# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
55# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
56# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
57# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
58# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
59# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
60# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
62# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/ic.gmk b/mps/code/ic.gmk
deleted file mode 100644
index d8a1d5463ac..00000000000
--- a/mps/code/ic.gmk
+++ /dev/null
@@ -1,62 +0,0 @@
1# ic.gmk: GNUMAKEFILE FRAGMENT FOR IRIX CC (IRIX 4 OR 5)
2#
3# $Id$
4# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5#
6# This file is included by platform makefiles that use the IRIX CC
7# compiler. It defines the compiler specific variables that the
8# common makefile fragment (<code/comm.gmk>) requires.
9
10# We need a symbol for a non-empty definition with empty value
11ifdef MPS_EMPTY
12error "ic.gmk: MPS_EMPTY defined"
13endif
14
15CC = cc
16CFLAGSCOMPILER = $(MPS_EMPTY)
17CFLAGSDEBUG = -g
18CFLAGSOPT = -O -g
19CFLAGSOPTNODEBUG = -O
20
21include comm.gmk
22
23
24# C. COPYRIGHT AND LICENSE
25#
26# Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
27# All rights reserved. This is an open source license. Contact
28# Ravenbrook for commercial licensing options.
29#
30# Redistribution and use in source and binary forms, with or without
31# modification, are permitted provided that the following conditions are
32# met:
33#
34# 1. Redistributions of source code must retain the above copyright
35# notice, this list of conditions and the following disclaimer.
36#
37# 2. Redistributions in binary form must reproduce the above copyright
38# notice, this list of conditions and the following disclaimer in the
39# documentation and/or other materials provided with the distribution.
40#
41# 3. Redistributions in any form must be accompanied by information on how
42# to obtain complete source code for this software and any accompanying
43# software that uses this software. The source code must either be
44# included in the distribution or be available for no more than the cost
45# of distribution plus a nominal fee, and must be freely redistributable
46# under reasonable conditions. For an executable file, complete source
47# code means the source code for all modules it contains. It does not
48# include source code for modules or files that typically accompany the
49# major components of the operating system on which the executable file
50# runs.
51#
52# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
53# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
54# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
55# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
56# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
57# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
58# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
59# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
60# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
62# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/lc.gmk b/mps/code/lc.gmk
deleted file mode 100644
index 594e4764bc8..00000000000
--- a/mps/code/lc.gmk
+++ /dev/null
@@ -1,65 +0,0 @@
1# lc.gmk: GNUMAKEFILE FRAGMENT FOR LCC
2#
3# $Id$
4# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5#
6# This file is included by platform makefiles that use the LCC
7# compiler. It defines the compiler specific variables that the
8# common makefile fragment (<code/comm.gmk>) requires.
9#
10# .optimize.noflags: lcc does some minimal amount of optimization all
11# the time and ignores the -O flag. Hence the empty *OPT* macros.
12
13# We need a symbol for a non-empty definition with empty value
14ifdef MPS_EMPTY
15error "lc.gmk: MPS_EMPTY defined"
16endif
17
18CC = lcc
19CFLAGSCOMPILER = -I/usr/include
20CFLAGSDEBUG = -g
21CFLAGSOPT = $(MPS_EMPTY)
22CFLAGSOPTNODEBUG = $(MPS_EMPTY)
23
24include comm.gmk
25
26
27# C. COPYRIGHT AND LICENSE
28#
29# Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
30# All rights reserved. This is an open source license. Contact
31# Ravenbrook for commercial licensing options.
32#
33# Redistribution and use in source and binary forms, with or without
34# modification, are permitted provided that the following conditions are
35# met:
36#
37# 1. Redistributions of source code must retain the above copyright
38# notice, this list of conditions and the following disclaimer.
39#
40# 2. Redistributions in binary form must reproduce the above copyright
41# notice, this list of conditions and the following disclaimer in the
42# documentation and/or other materials provided with the distribution.
43#
44# 3. Redistributions in any form must be accompanied by information on how
45# to obtain complete source code for this software and any accompanying
46# software that uses this software. The source code must either be
47# included in the distribution or be available for no more than the cost
48# of distribution plus a nominal fee, and must be freely redistributable
49# under reasonable conditions. For an executable file, complete source
50# code means the source code for all modules it contains. It does not
51# include source code for modules or files that typically accompany the
52# major components of the operating system on which the executable file
53# runs.
54#
55# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
56# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
57# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
58# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
59# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
60# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
62# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
63# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
64# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
65# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/mpsioan.c b/mps/code/mpsioan.c
index bd19b922056..ab83d5b69fc 100644
--- a/mps/code/mpsioan.c
+++ b/mps/code/mpsioan.c
@@ -11,20 +11,6 @@
11 11
12#include "mpstd.h" 12#include "mpstd.h"
13 13
14#ifdef MPS_OS_SU
15
16extern int fclose (FILE *stream);
17extern int fflush (FILE *stream);
18extern size_t fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream);
19
20/* These functions are used in the macro definitions of putc and getc
21 * but not declared in stdio.h.
22 */
23extern int _filbuf(FILE *stream);
24extern int _flsbuf(unsigned char c, FILE *stream);
25
26#endif
27
28#ifdef MPS_OS_XC 14#ifdef MPS_OS_XC
29#include "osxc.h" 15#include "osxc.h"
30#endif 16#endif
diff --git a/mps/code/mpsliban.c b/mps/code/mpsliban.c
index 97fe98f0c6a..af0d3468d8a 100644
--- a/mps/code/mpsliban.c
+++ b/mps/code/mpsliban.c
@@ -26,9 +26,6 @@
26 26
27#include "mpstd.h" 27#include "mpstd.h"
28 28
29#ifdef MPS_OS_SU
30#include "ossu.h"
31#endif
32#ifdef MPS_OS_XC 29#ifdef MPS_OS_XC
33#include "osxc.h" 30#include "osxc.h"
34#endif 31#endif
@@ -38,16 +35,6 @@ struct itimerspec; /* stop complaints from time.h */
38#endif 35#endif
39#include <time.h> 36#include <time.h>
40 37
41#ifdef MPS_OS_SU
42extern int fputc (int c, FILE *stream);
43extern int fputs (const char *s, FILE *stream);
44extern clock_t clock(void);
45extern long strtol(const char *, char **, int);
46/* @@@@ This doesn't do quite the right thing, but will get by. */
47#define strtoul(a,b,c) (unsigned long)strtol(a, b, c)
48extern void *memset(void *, int, size_t);
49#endif
50
51#include <stdlib.h> 38#include <stdlib.h>
52#include <stdio.h> 39#include <stdio.h>
53#include <string.h> 40#include <string.h>
diff --git a/mps/code/mpstd.h b/mps/code/mpstd.h
index 4a8a0875ca3..58de5a832da 100644
--- a/mps/code/mpstd.h
+++ b/mps/code/mpstd.h
@@ -55,83 +55,6 @@
55 */ 55 */
56 56
57 57
58/* Irix 5/6 man cc and man abi. We can't check for _ABIO32 (see
59 * os.i5), as we have to support Irix 5.2, which doesn't define it. We
60 * check the value of _MIPS_FPSET, as it is defined across all Irix 5
61 * and 6 platforms, and on Irix 6 distinguishes O32 from the other two
62 * ABIs. When we support the other ABIs, we need a new OS name for
63 * them. Alignment from testing.
64 */
65
66#if defined(__sgi) && defined(__unix) && defined(__mips) \
67 && defined(_SYSTYPE_SVR4) && (_MIPS_FPSET == 16)
68#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_I5M2CC)
69#error "specified CONFIG_PF_... inconsistent with detected i5m2cc"
70#endif
71#define MPS_PF_I5M2CC
72#define MPS_PF_STRING "i5m2cc"
73#define MPS_OS_I5
74#define MPS_ARCH_M2
75#define MPS_BUILD_CC
76#define MPS_T_WORD unsigned long
77#define MPS_T_ULONGEST unsigned long
78#define MPS_WORD_WIDTH 32
79#define MPS_WORD_SHIFT 5
80#define MPS_PF_ALIGN 8
81
82/* See above. Alignment from testing. */
83
84#elif defined(__sgi) && defined(__unix) && defined(__mips) \
85 && defined(_SYSTYPE_SVR4) && defined(_ABIN32)
86#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_IAM4CC)
87#error "specified CONFIG_PF_... inconsistent with detected iam4cc"
88#endif
89#define MPS_PF_IAM4CC
90#define MPS_PF_STRING "iam4cc"
91#define MPS_OS_IA
92#define MPS_ARCH_M4
93#define MPS_BUILD_CC
94#define MPS_T_WORD unsigned long
95#define MPS_T_ULONGEST unsigned long
96#define MPS_WORD_WIDTH 32
97#define MPS_WORD_SHIFT 5
98#define MPS_PF_ALIGN 8
99
100/* winnt.h from MS VC 2.0 */
101
102#elif defined(_MSC_VER) && defined(_WIN32) && defined(_M_ALPHA)
103#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3ALMV)
104#error "specified CONFIG_PF_... inconsistent with detected w3almv"
105#endif
106#define MPS_PF_W3ALMV
107#define MPS_PF_STRING "w3almv"
108#define MPS_OS_W3
109#define MPS_ARCH_AL
110#define MPS_BUILD_MV
111#define MPS_T_WORD unsigned long
112#define MPS_T_ULONGEST unsigned long
113#define MPS_WORD_WIDTH 32
114#define MPS_WORD_SHIFT 5
115#define MPS_PF_ALIGN 4
116
117/* winnt.h from MS VC 2.0 */
118
119#elif defined(_MSC_VER) && defined(_WIN32) && defined(_M_PPC)
120#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3PPMV)
121#error "specified CONFIG_PF_... inconsistent with detected w3ppmv"
122#endif
123#define MPS_PF_W3PPMV
124#define MPS_PF_STRING "w3ppmv"
125#define MPS_OS_W3
126#define MPS_ARCH_PP
127#define MPS_BUILD_MV
128#define MPS_T_WORD unsigned long
129#define MPS_T_ULONGEST unsigned long
130#define MPS_WORD_WIDTH 32
131#define MPS_WORD_SHIFT 5
132#define MPS_PF_ALIGN 4
133
134
135/* Visual C++ 2.0, Books Online, C/C++ Book, Preprocessor Reference, 58/* Visual C++ 2.0, Books Online, C/C++ Book, Preprocessor Reference,
136 * Chapter 1: The Preprocessor, Macros, Predefined Macros. 59 * Chapter 1: The Preprocessor, Macros, Predefined Macros.
137 * Alignment of 4 would work, but the MS library uses 8 bytes for 60 * Alignment of 4 would work, but the MS library uses 8 bytes for
@@ -139,7 +62,7 @@
139 * VC malloc is 16! 62 * VC malloc is 16!
140 */ 63 */
141 64
142#elif defined(_MSC_VER) && defined(_WIN32) && defined(_M_IX86) 65#if defined(_MSC_VER) && defined(_WIN32) && defined(_M_IX86)
143#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I3MV) 66#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I3MV)
144#error "specified CONFIG_PF_... inconsistent with detected w3i3mv" 67#error "specified CONFIG_PF_... inconsistent with detected w3i3mv"
145#endif 68#endif
@@ -181,86 +104,6 @@
181#define MPS_PF_ALIGN 16 104#define MPS_PF_ALIGN 16
182 105
183 106
184/* MW C/C++/ASM Lang Ref (CW9), pp. 184-186. Metrowerks does not document
185 * a way to determine the OS -- we assume MacOS 7.
186 */
187
188#elif (defined(__MWERKS__) && __MC68K__ == 1)
189#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_S760MW)
190#error "specified CONFIG_PF_... inconsistent with detected s760mw"
191#endif
192#define MPS_PF_S760MW
193#define MPS_PF_STRING "s760mw"
194#define MPS_OS_S7
195#define MPS_ARCH_60
196#define MPS_BUILD_MW
197#define MPS_T_WORD unsigned long
198#define MPS_T_ULONGEST unsigned long
199#define MPS_WORD_WIDTH 32
200#define MPS_WORD_SHIFT 5
201#define MPS_PF_ALIGN 1
202
203/* MW C/C++/ASM Lang Ref (CW9), pp. 184-186. Metrowerks does not document
204 * a way to determine the OS -- we assume MacOS 7.
205 */
206
207#elif defined(__MWERKS__) && __POWERPC__ == 1
208#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_S7PPMW)
209#error "specified CONFIG_PF_... inconsistent with detected s7ppmw"
210#endif
211#define MPS_PF_S7PPMW
212#define MPS_PF_STRING "s7ppmw"
213#define MPS_OS_S7
214#define MPS_ARCH_PP
215#define MPS_BUILD_MW
216#define MPS_T_WORD unsigned long
217#define MPS_T_ULONGEST unsigned long
218#define MPS_WORD_WIDTH 32
219#define MPS_WORD_SHIFT 5
220#define MPS_PF_ALIGN 8 /* .macos.ppc.align */
221
222/* 1. MPW 3.0 C Ref, p. 43.
223 * 2. MPW SC/SCpp C/C++ Compiler for 68k Macintosh, p 3-60.
224 * These are the two MPW 68k compilers. They do not define anything
225 * which lets us determine the system version.
226 */
227
228#elif defined(m68k) && (defined (applec) || defined(__SC__))
229#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_S760AC)
230#error "specified CONFIG_PF_... inconsistent with detected s760ac"
231#endif
232#define MPS_PF_S760AC
233#define MPS_PF_STRING "s760ac"
234#define MPS_OS_S7
235#define MPS_ARCH_60
236#define MPS_BUILD_AC
237#define MPS_T_WORD unsigned long
238#define MPS_T_ULONGEST unsigned long
239#define MPS_WORD_WIDTH 32
240#define MPS_WORD_SHIFT 5
241#define MPS_PF_ALIGN 1
242
243/* 1. C++/C Compiler for Macintosh with PowerPC, p 3-36.
244 * 2. MPW MrC/MrCpp C/C++ Compiler for Power Macintosh, p 3-57.
245 * These are the two MPW PowerPC compilers. They do not define anything
246 * which lets us determine the system version.
247 */
248
249#elif defined(__PPCC__) || (defined(__MRC__) && defined(__POWERPC))
250#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_S7PPAC)
251#error "specified CONFIG_PF_... inconsistent with detected s7ppac"
252#endif
253#define MPS_PF_S7PPAC
254#define MPS_PF_STRING "s7ppac"
255#define MPS_OS_S7
256#define MPS_ARCH_PP
257#define MPS_BUILD_AC
258#define MPS_T_WORD unsigned long
259#define MPS_T_ULONGEST unsigned long
260#define MPS_WORD_WIDTH 32
261#define MPS_WORD_SHIFT 5
262#define MPS_PF_ALIGN 8 /* .macos.ppc.align */
263
264/* GCC 2.7.2.1, gcc -E -dM -traditional-cpp and <URL:http://developer.apple.c 107/* GCC 2.7.2.1, gcc -E -dM -traditional-cpp and <URL:http://developer.apple.c
265 * om/techpubs/macosx/System/Documentation/Developer/YellowBox/Reference/DevT 108 * om/techpubs/macosx/System/Documentation/Developer/YellowBox/Reference/DevT
266 * ools/Preprocessor/Preprocessor.[ef].html> 109 * ools/Preprocessor/Preprocessor.[ef].html>
@@ -341,42 +184,6 @@
341#define MPS_WORD_SHIFT 6 184#define MPS_WORD_SHIFT 6
342#define MPS_PF_ALIGN 8 185#define MPS_PF_ALIGN 8
343 186
344/* GCC 2.5.8, gcc -E -dM, (__SVR4 indicates Solaris) */
345
346#elif defined(__sun__) && defined(__sparc__) && defined(__GNUC__) \
347 && !defined(__svr4__)
348#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_SUS8GC)
349#error "specified CONFIG_PF_... inconsistent with detected sus8gc"
350#endif
351#define MPS_PF_SUS8GC
352#define MPS_PF_STRING "sus8gc"
353#define MPS_OS_SU
354#define MPS_ARCH_S8
355#define MPS_BUILD_GC
356#define MPS_T_WORD unsigned long
357#define MPS_T_ULONGEST unsigned long
358#define MPS_WORD_WIDTH 32
359#define MPS_WORD_SHIFT 5
360#define MPS_PF_ALIGN 8
361
362/* LCC 3.4 (ish), man page */
363
364#elif defined(sun) && defined(sparc) && defined(__LCC__) \
365 && !defined(__svr4__)
366#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_SUS8LC)
367#error "specified CONFIG_PF_... inconsistent with detected sus8lc"
368#endif
369#define MPS_PF_SUS8LC
370#define MPS_PF_STRING "sus8lc"
371#define MPS_OS_SU
372#define MPS_ARCH_S8
373#define MPS_BUILD_LC
374#define MPS_T_WORD unsigned long
375#define MPS_T_ULONGEST unsigned long
376#define MPS_WORD_WIDTH 32
377#define MPS_WORD_SHIFT 5
378#define MPS_PF_ALIGN 8
379
380/* GCC 2.5.8, gcc -E -dM */ 187/* GCC 2.5.8, gcc -E -dM */
381 188
382#elif defined(__sun__) && defined(__sparc__) && defined(__GNUC__) \ 189#elif defined(__sun__) && defined(__sparc__) && defined(__GNUC__) \
@@ -416,40 +223,6 @@
416#define MPS_WORD_SHIFT 5 223#define MPS_WORD_SHIFT 5
417#define MPS_PF_ALIGN 8 224#define MPS_PF_ALIGN 8
418 225
419/* GCC 2.6.3, gcc -E -dM */
420
421#elif defined(__osf__) && defined(__alpha__) && defined(__GNUC__)
422#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_O1ALGC)
423#error "specified CONFIG_PF_... inconsistent with detected o1algc"
424#endif
425#define MPS_PF_O1ALGC
426#define MPS_PF_STRING "o1algc"
427#define MPS_OS_O1
428#define MPS_ARCH_AL
429#define MPS_BUILD_GC
430#define MPS_T_WORD unsigned long
431#define MPS_T_ULONGEST unsigned long
432#define MPS_WORD_WIDTH 64
433#define MPS_WORD_SHIFT 6
434#define MPS_PF_ALIGN 8
435
436/* From the cc(1) man page */
437
438#elif defined(__osf__) && defined(__alpha) && defined(__DECC)
439#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_O1ALCC)
440#error "specified CONFIG_PF_... inconsistent with detected o1alcc"
441#endif
442#define MPS_PF_O1ALCC
443#define MPS_PF_STRING "o1alcc"
444#define MPS_OS_O1
445#define MPS_ARCH_AL
446#define MPS_BUILD_CC
447#define MPS_T_WORD unsigned long
448#define MPS_T_ULONGEST unsigned long
449#define MPS_WORD_WIDTH 64
450#define MPS_WORD_SHIFT 6
451#define MPS_PF_ALIGN 8
452
453/* GCC 2.6.3, gcc -E -dM 226/* GCC 2.6.3, gcc -E -dM
454 * The actual granularity of GNU malloc is 8, but field alignments are 227 * The actual granularity of GNU malloc is 8, but field alignments are
455 * all 4. 228 * all 4.
diff --git a/mps/code/o1alcc.gmk b/mps/code/o1alcc.gmk
deleted file mode 100644
index ab322c51005..00000000000
--- a/mps/code/o1alcc.gmk
+++ /dev/null
@@ -1,62 +0,0 @@
1# o1alcc.gmk: BUILD FOR OSF/1, ALPHA, DIGITAL C PLATFORM
2#
3# $Id$
4# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5#
6# This is the GNU makefile for platform.o1alcc.
7#
8# _ANSI_C_SOURCE is defined in PFMDEFS to avoid bug in library headers
9# which define TRUE and FALSE.
10#
11
12PFM = o1alcc
13PFMDEFS = -D_ANSI_C_SOURCE
14
15MPMPF = lockan.c than.c vmo1.c \
16 proto1.c prmcan.c span.c
17MPMS = sso1al.s
18
19LIBS = -lm
20
21include dc.gmk
22
23
24# C. COPYRIGHT AND LICENSE
25#
26# Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
27# All rights reserved. This is an open source license. Contact
28# Ravenbrook for commercial licensing options.
29#
30# Redistribution and use in source and binary forms, with or without
31# modification, are permitted provided that the following conditions are
32# met:
33#
34# 1. Redistributions of source code must retain the above copyright
35# notice, this list of conditions and the following disclaimer.
36#
37# 2. Redistributions in binary form must reproduce the above copyright
38# notice, this list of conditions and the following disclaimer in the
39# documentation and/or other materials provided with the distribution.
40#
41# 3. Redistributions in any form must be accompanied by information on how
42# to obtain complete source code for this software and any accompanying
43# software that uses this software. The source code must either be
44# included in the distribution or be available for no more than the cost
45# of distribution plus a nominal fee, and must be freely redistributable
46# under reasonable conditions. For an executable file, complete source
47# code means the source code for all modules it contains. It does not
48# include source code for modules or files that typically accompany the
49# major components of the operating system on which the executable file
50# runs.
51#
52# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
53# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
54# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
55# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
56# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
57# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
58# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
59# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
60# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
62# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/o1algc.gmk b/mps/code/o1algc.gmk
deleted file mode 100644
index 361e0ec45fe..00000000000
--- a/mps/code/o1algc.gmk
+++ /dev/null
@@ -1,61 +0,0 @@
1# o1algc.gmk: BUILD FOR OSF/1, ALPHA, GCC PLATFORM
2#
3# $Id$
4# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5#
6# _ANSI_C_SOURCE is defined in PFMDEFS to avoid bug in library headers
7# which define TRUE and FALSE.
8
9PFM = o1algc
10PFMDEFS = -D_ANSI_C_SOURCE
11
12MPMPF = lockan.c than.c vmo1.c \
13 proto1.c prmcan.c span.c
14MPMS = sso1al.s
15
16LIBS = -lm
17
18include gc.gmk
19
20include comm.gmk
21
22
23# C. COPYRIGHT AND LICENSE
24#
25# Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
26# All rights reserved. This is an open source license. Contact
27# Ravenbrook for commercial licensing options.
28#
29# Redistribution and use in source and binary forms, with or without
30# modification, are permitted provided that the following conditions are
31# met:
32#
33# 1. Redistributions of source code must retain the above copyright
34# notice, this list of conditions and the following disclaimer.
35#
36# 2. Redistributions in binary form must reproduce the above copyright
37# notice, this list of conditions and the following disclaimer in the
38# documentation and/or other materials provided with the distribution.
39#
40# 3. Redistributions in any form must be accompanied by information on how
41# to obtain complete source code for this software and any accompanying
42# software that uses this software. The source code must either be
43# included in the distribution or be available for no more than the cost
44# of distribution plus a nominal fee, and must be freely redistributable
45# under reasonable conditions. For an executable file, complete source
46# code means the source code for all modules it contains. It does not
47# include source code for modules or files that typically accompany the
48# major components of the operating system on which the executable file
49# runs.
50#
51# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
52# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
53# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
54# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
55# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
56# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
57# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
58# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
59# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
61# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/ossu.h b/mps/code/ossu.h
deleted file mode 100644
index 2207633a2a6..00000000000
--- a/mps/code/ossu.h
+++ /dev/null
@@ -1,134 +0,0 @@
1/* ossu.h: SUNOS ANSI COMPATABILITY HEADER
2 *
3 * $Id$
4 *
5 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
6 *
7 * .purpose: This header defines some things which are part of the ANSI
8 * standard but missing from the C compiler / environment.
9 *
10 * .history: This header was imported from the MLWorks runtime system,
11 * when it had the following id:
12 * src:OS:SunOS:ansi.h,v 1.2 1994/06/09 14:24:35 nickh
13 */
14
15#ifndef ossu_h
16#define ossu_h
17
18#include <stdarg.h>
19#include <stddef.h>
20#include <stdio.h>
21#include <sys/types.h>
22#include <time.h>
23
24
25/* stddef.h */
26
27#ifndef offsetof /* true for platform.sus8lc for example */
28#define offsetof(ty,mem) ((size_t)((char*)&((ty*)0)->(mem) - (char*)0))
29#endif
30
31
32/* stdio.h things */
33
34extern int fclose (FILE *stream);
35extern int fflush (FILE *stream);
36extern int fgetc (FILE *stream);
37extern int ungetc (int c, FILE *stram);
38extern int fputc (int c, FILE *stream);
39extern int printf (const char *format, ...);
40extern int fprintf (FILE *stream, const char *format, ...);
41extern int vfprintf (FILE *stream, const char *format, va_list arg);
42extern int vsprintf (char *s, const char *format, va_list arg);
43extern int fputs (const char *s, FILE *stream);
44extern int puts(const char *);
45extern int fscanf (FILE *stream, const char *format, ...);
46extern int sscanf (const char *s, const char *format, ...);
47extern int fseek (FILE *stream, long int offset, int whence);
48extern size_t fread (void *ptr, size_t size, size_t nmemb, FILE *stream);
49extern size_t fwrite (const void *ptr, size_t size, size_t nmemb,
50 FILE *stream);
51
52/* these functions are used in the macro definitions of putc and getc
53but not declared in stdio.h */
54
55extern int _filbuf(FILE *stream);
56
57extern int _flsbuf(unsigned char c, FILE *stream);
58
59
60/* time.h things */
61
62extern size_t strftime (char *s, size_t maxsize, const char *format,
63 const struct tm *timeptr);
64extern time_t time (time_t *timer);
65extern clock_t clock(void);
66
67
68/* stdlib.h things */
69
70extern int system(const char *string);
71extern long strtol(const char *, char **, int);
72#define EXIT_FAILURE 1
73#define EXIT_SUCCESS 0
74/* @@@@ This doesn't do quite the right thing, but will get by */
75#define strtoul(a,b,c) (unsigned long)strtol((a), (b), (c))
76
77
78/* string.h things */
79
80extern void *memset(void *, int, size_t);
81
82
83#ifdef MPS_PF_SUS8LC
84/* .hack.malloc: builder.lc (LCC) uses Sun's header files. Sun's
85 * stdlib.h is broken, as it has an incorrect declaration of malloc.
86 * We fix that here in a very hacky way.
87 */
88#define malloc(x) (void *)malloc(x)
89#endif /* MPS_PF_SUS8LC */
90
91
92#endif /* ossu_h */
93
94
95/* C. COPYRIGHT AND LICENSE
96 *
97 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
98 * All rights reserved. This is an open source license. Contact
99 * Ravenbrook for commercial licensing options.
100 *
101 * Redistribution and use in source and binary forms, with or without
102 * modification, are permitted provided that the following conditions are
103 * met:
104 *
105 * 1. Redistributions of source code must retain the above copyright
106 * notice, this list of conditions and the following disclaimer.
107 *
108 * 2. Redistributions in binary form must reproduce the above copyright
109 * notice, this list of conditions and the following disclaimer in the
110 * documentation and/or other materials provided with the distribution.
111 *
112 * 3. Redistributions in any form must be accompanied by information on how
113 * to obtain complete source code for this software and any accompanying
114 * software that uses this software. The source code must either be
115 * included in the distribution or be available for no more than the cost
116 * of distribution plus a nominal fee, and must be freely redistributable
117 * under reasonable conditions. For an executable file, complete source
118 * code means the source code for all modules it contains. It does not
119 * include source code for modules or files that typically accompany the
120 * major components of the operating system on which the executable file
121 * runs.
122 *
123 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
124 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
125 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
126 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
127 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
128 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
129 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
130 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
131 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
132 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
133 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
134 */
diff --git a/mps/code/protix.c b/mps/code/protix.c
index 67daa072e77..513e640d624 100644
--- a/mps/code/protix.c
+++ b/mps/code/protix.c
@@ -4,9 +4,7 @@
4 * Copyright (c) 2001,2007 Ravenbrook Limited. See end of file for license. 4 * Copyright (c) 2001,2007 Ravenbrook Limited. See end of file for license.
5 * 5 *
6 * Somewhat generic across different Unix systems. Shared between 6 * Somewhat generic across different Unix systems. Shared between
7 * Darwin (OS X), OSF/1 (DIGITAL UNIX), FreeBSD, and Linux. 7 * Darwin (OS X), FreeBSD, and Linux.
8 *
9 * May not actually work on OSF/1 due to lack of available machines.
10 * 8 *
11 * This file does not contain a signal handler. That's in protsgix.c 9 * This file does not contain a signal handler. That's in protsgix.c
12 * (for FreeBSD and Darwin on Intel); in protxcpp.c (for Darwin on 10 * (for FreeBSD and Darwin on Intel); in protxcpp.c (for Darwin on
@@ -48,8 +46,8 @@
48 46
49#include "mpm.h" 47#include "mpm.h"
50 48
51#if !defined(MPS_OS_LI) && !defined(MPS_OS_FR) && !defined(MPS_OS_XC) && !defined(MPS_OS_O1) 49#if !defined(MPS_OS_LI) && !defined(MPS_OS_FR) && !defined(MPS_OS_XC)
52#error "protix.c is Unix-specific, currently for MPS_OS_LI FR XC O1" 50#error "protix.c is Unix-specific, currently for MPS_OS_LI FR XC"
53#endif 51#endif
54#ifndef PROTECTION 52#ifndef PROTECTION
55#error "protix.c implements protection, but PROTECTION is not set" 53#error "protix.c implements protection, but PROTECTION is not set"
diff --git a/mps/code/proto1.c b/mps/code/proto1.c
deleted file mode 100644
index ca2473fdc96..00000000000
--- a/mps/code/proto1.c
+++ /dev/null
@@ -1,241 +0,0 @@
1/* proto1.c: PROTECTION FOR DIGITAL UNIX
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 */
6
7
8/* open sesame magic, see standards(5) */
9#define _POSIX_C_SOURCE 199309L
10#define _XOPEN_SOURCE_EXTENDED 1
11
12#include "mpm.h"
13
14#ifndef MPS_OS_O1
15#error "proto1.c is OSF/1-specific, but MPS_OS_O1 is not set"
16#endif
17#ifndef PROTECTION
18#error "proto1.c implements protection, but PROTECTION is not set"
19#endif
20
21#include <limits.h>
22#include <stddef.h>
23#include <stdlib.h>
24#include <signal.h>
25#include <siginfo.h>
26#include <sys/mman.h>
27/* for getpid() */
28#include <unistd.h>
29
30SRCID(proto1, "$Id$");
31
32
33/* The previously-installed signal action, as returned by */
34/* sigaction(3). See ProtSetup. */
35
36static struct sigaction sigNext;
37
38
39/* == Protection Signal Handler ==
40 *
41 * This is the signal handler installed by ProtSetup to deal with
42 * protection faults. It is installed on the SIGSEGV signal.
43 * It decodes the protection fault details from the signal context
44 * and passes them to ArenaAccess, which attempts to handle the
45 * fault and remove its cause. If the fault is handled, then
46 * the handler returns and execution resumes. If it isn't handled,
47 * then sigHandle does its best to pass the signal on to the
48 * previously installed signal handler (sigNext).
49 *
50 * .sigh.addr: We assume that the OS decodes the address to something
51 * sensible
52 * .sigh.limit: We throw away the limit information.
53 */
54
55static void sigHandle(int sig, siginfo_t *info, void *context)
56{
57 int e;
58 sigset_t sigset, oldset;
59 struct sigaction sa;
60
61 AVER(sig == SIGSEGV);
62 AVER(info != NULL);
63
64 if(info->si_code == SEGV_ACCERR) {
65 AccessSet mode;
66 Addr base, limit;
67
68 /* We can't determine the access mode (read, write, etc.) */
69 /* under Solaris without decoding the faulting instruction. */
70 /* Don't bother, yet. We can do this if necessary. */
71
72 mode = AccessREAD | AccessWRITE;
73
74 /* We assume that the access is for one word at the address. */
75
76 base = (Addr)info->si_addr;
77 limit = AddrAdd(base, (Size)sizeof(Addr));
78
79 /* Offer each protection structure the opportunity to handle the */
80 /* exception. If it succeeds, then allow the mutator to continue. */
81
82 /* MutatorFaultContext parameter is a dummy parameter in this */
83 /* implementation */
84 if(ArenaAccess(base, mode, NULL))
85 return;
86 }
87
88 /* The exception was not handled by any known protection structure, */
89 /* so throw it to the previously installed handler. */
90
91 /* @@ This is really weak.
92 * Need to implement rest of the contract of sigaction */
93
94 e = sigaction(SIGSEGV, &sigNext, &sa);
95 AVER(e == 0);
96 sigemptyset(&sigset);
97 sigaddset(&sigset, SIGSEGV);
98 e = sigprocmask(SIG_UNBLOCK, &sigset, &oldset);
99 AVER(e == 0);
100 kill(getpid(), SIGSEGV);
101 e = sigprocmask(SIG_SETMASK, &oldset, NULL);
102 AVER(e == 0);
103 e = sigaction(SIGSEGV, &sa, NULL);
104 AVER(e == 0);
105}
106
107
108/* ProtSetup -- global protection setup
109 *
110 * Under DIGITAL UNIX, the global setup involves installing a signal handler
111 * on SIGSEGV to catch and handle protection faults (see sigHandle).
112 * The previous handler is recorded so that it can be reached from
113 * sigHandle if it fails to handle the fault.
114 *
115 * NOTE: There are problems with this approach:
116 * 1. we can't honor the wishes of the sigaction(2) entry for the
117 * previous handler,
118 * 2. what if this thread is suspended just after calling signal(3)?
119 * The sigNext variable will never be initialized!
120 */
121
122void ProtSetup(void)
123{
124 struct sigaction sa;
125 int result;
126
127 sa.sa_sigaction = sigHandle;
128 sa.sa_flags = SA_SIGINFO;
129
130 result = sigaction(SIGSEGV, &sa, &sigNext);
131 AVER(result == 0);
132}
133
134
135/* ProtSet -- set protection
136 *
137 * This is just a thin veneer on top of mprotect(2).
138 */
139
140void ProtSet(Addr base, Addr limit, AccessSet mode)
141{
142 int flags;
143
144 AVER(sizeof(size_t) == sizeof(Addr));
145 AVER(base < limit);
146 AVER(base != 0);
147 AVER(AddrOffset(base, limit) <= INT_MAX); /* should be redundant */
148
149 /* convert between MPS AccessSet and UNIX PROT thingies. */
150 switch(mode) {
151 case AccessWRITE | AccessREAD:
152 case AccessREAD: /* forbids writes as well */
153 flags = PROT_NONE;
154 break;
155 case AccessWRITE:
156 flags = PROT_READ | PROT_EXEC;
157 break;
158 case AccessSetEMPTY:
159 flags = PROT_READ | PROT_WRITE | PROT_EXEC;
160 break;
161 default:
162 NOTREACHED;
163 flags = PROT_NONE;
164 }
165
166 if(mprotect((void *)base, (size_t)AddrOffset(base, limit), flags) != 0)
167 NOTREACHED;
168}
169
170
171/* ProtSync -- synchronize protection settings with hardware
172 *
173 * This does nothing under Solaris.
174 */
175
176void ProtSync(Arena arena)
177{
178 UNUSED(arena);
179 NOOP;
180}
181
182
183/* ProtTramp -- protection trampoline
184 *
185 * The protection trampoline is trivial under DIGITAL UNIX, as there is
186 * nothing that needs to be done in the dynamic context of the mutator in
187 * order to catch faults. (Contrast this with Win32 Structured Exception
188 * Handling.)
189 */
190
191void ProtTramp(void **resultReturn, void *(*f)(void *, size_t),
192 void *p, size_t s)
193{
194 AVER(resultReturn != NULL);
195 AVER(FUNCHECK(f));
196 /* Can't check p and s as they are interpreted by the client */
197
198 *resultReturn = (*f)(p, s);
199}
200
201
202/* C. COPYRIGHT AND LICENSE
203 *
204 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
205 * All rights reserved. This is an open source license. Contact
206 * Ravenbrook for commercial licensing options.
207 *
208 * Redistribution and use in source and binary forms, with or without
209 * modification, are permitted provided that the following conditions are
210 * met:
211 *
212 * 1. Redistributions of source code must retain the above copyright
213 * notice, this list of conditions and the following disclaimer.
214 *
215 * 2. Redistributions in binary form must reproduce the above copyright
216 * notice, this list of conditions and the following disclaimer in the
217 * documentation and/or other materials provided with the distribution.
218 *
219 * 3. Redistributions in any form must be accompanied by information on how
220 * to obtain complete source code for this software and any accompanying
221 * software that uses this software. The source code must either be
222 * included in the distribution or be available for no more than the cost
223 * of distribution plus a nominal fee, and must be freely redistributable
224 * under reasonable conditions. For an executable file, complete source
225 * code means the source code for all modules it contains. It does not
226 * include source code for modules or files that typically accompany the
227 * major components of the operating system on which the executable file
228 * runs.
229 *
230 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
231 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
232 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
233 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
234 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
235 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
236 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
237 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
238 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
239 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
240 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
241 */
diff --git a/mps/code/protsgix.c b/mps/code/protsgix.c
index 94b0dae6aa1..ee47676a933 100644
--- a/mps/code/protsgix.c
+++ b/mps/code/protsgix.c
@@ -18,8 +18,8 @@
18 18
19#include "mpm.h" 19#include "mpm.h"
20 20
21#if !defined(MPS_OS_XC) && !defined(MPS_OS_FR) && !defined(MPS_OS_O1) 21#if !defined(MPS_OS_XC) && !defined(MPS_OS_FR)
22#error "protsgix.c is Unix-specific, currently for MPS_OS_O1 FR or XC" 22#error "protsgix.c is Unix-specific, currently for MPS_OS_FR or XC"
23#endif 23#endif
24#if defined(MPS_OS_XC) && defined(MPS_ARCH_PP) 24#if defined(MPS_OS_XC) && defined(MPS_ARCH_PP)
25#error "protsgix.c does not work on Darwin on PowerPC. Use protxcpp.c" 25#error "protsgix.c does not work on Darwin on PowerPC. Use protxcpp.c"
diff --git a/mps/code/protsu.c b/mps/code/protsu.c
deleted file mode 100644
index 5640cde1379..00000000000
--- a/mps/code/protsu.c
+++ /dev/null
@@ -1,277 +0,0 @@
1/* protsu.c: PROTECTION FOR SUNOS
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 *
6 * DESIGN
7 *
8 * see <design/prot/> for the generic design (including the interface),
9 * and <design/protsu/> for the design specific to this implementation.
10 *
11 * TRANSGRESSIONS
12 *
13 * .hack.sigdfl: GCC 2.5.8 produces a warning when we use SIG_DFL with
14 * -Wstrict-prototypes, which we want. SIG_DFL is just zero, so we
15 * have our own definition. We don't expect SIG_DFL to change, because
16 * that would break SunOS binaries. *sigh*
17 */
18
19#include "mpm.h"
20
21#ifndef MPS_OS_SU
22#error "protsu.c is SunOS 4 specific, but MPS_OS_SU is not set"
23#endif
24#ifndef PROTECTION
25#error "protsu.c implements protection, but PROTECTION is not set"
26#endif
27
28#include <sys/mman.h>
29#include <signal.h>
30#include <limits.h>
31
32SRCID(protsu, "$Id$");
33
34
35/* Fix up unprototyped system calls. */
36
37extern int getpagesize(void);
38extern int getpid(void);
39/* .depend.caddrt.self-promote: The following prototype for mprotect
40 * assumes that the type caddr_t is compatible with type that is produced
41 * when the default argument promotions are applied to caddr_t. See
42 * ISO C clause 6.3.2.2. caddr_t is defined is defined in
43 * /usr/include/sys/types.h to be char *, so this assumption is valid.
44 */
45extern int mprotect(caddr_t, int, int);
46extern int sigblock(int);
47extern int sigsetmask(int);
48typedef void (*handler_t)(int, int, struct sigcontext *, char *);
49
50
51/* .hack.sigdfl */
52#ifndef SIG_DFL
53#error "protsu.c expected SIG_DFL to be declared by signal.h"
54#else
55#undef SIG_DFL
56#define SIG_DFL ((handler_t)0)
57#endif
58
59
60/* Pointer to the previously-installed signal handler, as returned by */
61/* signal(3). See ProtSetup. */
62
63static handler_t sigNext = NULL;
64
65
66/* sigHandle -- protection signal handler
67 *
68 * This is the signal handler installed by ProtSetup to deal with
69 * protection faults. It is installed on the SIGSEGV signal.
70 * It decodes the protection fault details from the signal context
71 * and passes them to ArenaAccess, which attempts to handle the
72 * fault and remove its cause. If the fault is handled, then
73 * the handler returns and execution resumes.
74 *
75 * If it isn't handled, then sigHandle does its best to pass the signal
76 * on to the previously installed signal handler (sigNext). sigHandle
77 * cannot emulate a signal precisely. The problems are that the signal
78 * mask for that signal (set by sigvec) will not be set properly, also
79 * the handler will be executed on the current stack and not on its own
80 * stack (if it requested it).
81 *
82 * .assume.addr: This code assumes that the system will decode the
83 * address of the protection violation. This is documented in the
84 * "ADDR" section of the sigvec(2) man page.
85 *
86 * .sigh.decode: We can't determine the access mode (read, write, etc.)
87 * without decoding the faulting instruction. We don't bother to do
88 * this yet. It can be done later, if necessary.
89 *
90 * .sigh.size: We also assume that the access only affects the page
91 * of the faulting address, i.e. is a single word access or a double-
92 * aligned double-word access.
93 */
94
95static void sigHandle(int sig, int code,
96 struct sigcontext *scp, char *addr)
97{
98 AVER(sig == SIGSEGV);
99 AVER(scp != NULL);
100
101 if(code == SEGV_PROT) {
102 AccessSet mode;
103 AVER(addr != SIG_NOADDR); /* .assume.addr */
104 mode = AccessREAD | AccessWRITE; /* .sigh.decode */
105 /* MutatorFaultContext parameter is a dummy parameter in */
106 /* this implementation */
107 if(ArenaAccess((Addr)addr, mode, NULL)) /* .sigh.size */
108 return;
109 }
110
111 /* The exception was not handled by any known protection structure, */
112 /* so throw it to the previously installed handler. */
113 AVER(sigNext != NULL);
114 (*sigNext)(sig, code, scp, addr);
115}
116
117
118/* sigDefault -- default signal handler
119 *
120 * This is a signal handler used as sigNext if the previous handler
121 * returned by signal(3) was SIG_DFL. It does its best to get to
122 * the default handler, which will probably dump core.
123 */
124
125static void sigDefault(int sig, int code,
126 struct sigcontext *scp, char *addr)
127{
128 UNUSED(sig);
129 UNUSED(code);
130 UNUSED(scp);
131 UNUSED(addr);
132
133 AVER(sig == SIGSEGV);
134
135 (void)sigsetmask(sigblock(0) & ~sigmask(SIGSEGV));
136 (void)signal(SIGSEGV, SIG_DFL);
137 (void)kill(getpid(), SIGSEGV);
138 NOTREACHED;
139 abort();
140}
141
142
143/* ProtSetup -- global protection setup
144 *
145 * NOTE: There are problems with this approach:
146 * 1. If the thread is suspended just after calling signal(3)
147 * then the sigNext variable will not be set and sigHandle will
148 * be installed as the signal handler. sigHandle will fall over
149 * if it tries to call the next handler in the chain.
150 */
151
152void ProtSetup(void)
153{
154 handler_t next;
155
156 /* ProtSetup is called exactly once, see <design/prot/#if.setup> */
157 AVER(sigNext == NULL);
158
159 next = signal(SIGSEGV, sigHandle);
160 /* should always succeed as our parameters are valid */
161 AVER(next != (handler_t)-1);
162
163 if(next == SIG_DFL) /* use the suicide function */
164 sigNext = sigDefault;
165 else
166 sigNext = next;
167}
168
169
170/* ProtSet -- set the protection for a page
171 *
172 * This is just a thin veneer on top of mprotect(2).
173 *
174 * .assume.size: We asssume the type int and the type Size are the
175 * same size. This assumption is made in the call to mprotect.
176 */
177
178void ProtSet(Addr base, Addr limit, AccessSet mode)
179{
180 int flags;
181
182 AVER(sizeof(int) == sizeof(Size)); /* See .assume.size */
183 AVER(base < limit);
184 AVER(base != (Addr)0);
185 /* we assume that the difference between limit and base (which is */
186 /* positive) will fit in an int */
187 AVER(AddrOffset(base, limit) <= INT_MAX); /* should be redundant */
188 /* There is no AccessSetCheck, so we don't */
189
190 /* convert between MPS AccessSet and SunOS PROT thingies. */
191 switch(mode) {
192 case AccessWRITE | AccessREAD:
193 case AccessREAD: /* forbids writes as well */
194 flags = PROT_NONE;
195 break;
196 case AccessWRITE:
197 flags = PROT_READ | PROT_EXEC;
198 break;
199 case AccessSetEMPTY:
200 flags = PROT_READ | PROT_WRITE | PROT_EXEC;
201 break;
202 default:
203 NOTREACHED;
204 flags = PROT_NONE;
205 }
206
207 /* 2nd arg to mprotect, .assume.size */
208 if(mprotect((caddr_t)base, (int)AddrOffset(base, limit), flags) != 0) {
209 /* <design/protsu/#fun.set.assume.mprotect> */
210 NOTREACHED;
211 }
212}
213
214
215/* ProtSync -- synchronize protection settings with hardware */
216
217void ProtSync(Arena arena)
218{
219 AVERT(Arena, arena);
220 UNUSED(arena);
221 NOOP;
222}
223
224
225/* ProtTramp -- protection trampoline */
226
227void ProtTramp(void **resultReturn, void *(*f)(void *, size_t),
228 void *p, size_t s)
229{
230 AVER(resultReturn != NULL);
231 AVER(FUNCHECK(f));
232 /* Can't check p and s as they are interpreted by the client */
233
234 *resultReturn = (*f)(p, s);
235}
236
237
238/* C. COPYRIGHT AND LICENSE
239 *
240 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
241 * All rights reserved. This is an open source license. Contact
242 * Ravenbrook for commercial licensing options.
243 *
244 * Redistribution and use in source and binary forms, with or without
245 * modification, are permitted provided that the following conditions are
246 * met:
247 *
248 * 1. Redistributions of source code must retain the above copyright
249 * notice, this list of conditions and the following disclaimer.
250 *
251 * 2. Redistributions in binary form must reproduce the above copyright
252 * notice, this list of conditions and the following disclaimer in the
253 * documentation and/or other materials provided with the distribution.
254 *
255 * 3. Redistributions in any form must be accompanied by information on how
256 * to obtain complete source code for this software and any accompanying
257 * software that uses this software. The source code must either be
258 * included in the distribution or be available for no more than the cost
259 * of distribution plus a nominal fee, and must be freely redistributable
260 * under reasonable conditions. For an executable file, complete source
261 * code means the source code for all modules it contains. It does not
262 * include source code for modules or files that typically accompany the
263 * major components of the operating system on which the executable file
264 * runs.
265 *
266 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
267 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
268 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
269 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
270 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
271 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
272 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
273 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
274 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
275 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
276 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
277 */
diff --git a/mps/code/replay.c b/mps/code/replay.c
index 00dee793b7c..9dd34557d10 100644
--- a/mps/code/replay.c
+++ b/mps/code/replay.c
@@ -19,9 +19,6 @@
19#include <stdlib.h> /* for EXIT_FAILURE */ 19#include <stdlib.h> /* for EXIT_FAILURE */
20#include <string.h> /* for strcmp */ 20#include <string.h> /* for strcmp */
21#include "mpstd.h" 21#include "mpstd.h"
22#ifdef MPS_OS_SU
23#include "ossu.h"
24#endif
25 22
26 23
27#ifdef MPS_PF_W3I6MV 24#ifdef MPS_PF_W3I6MV
diff --git a/mps/code/s7ppac/Makefile b/mps/code/s7ppac/Makefile
deleted file mode 100644
index 0b4d001df02..00000000000
--- a/mps/code/s7ppac/Makefile
+++ /dev/null
@@ -1,248 +0,0 @@
1# impl.makefile.s7ppac: S7PPAC MPW MAKE FILE
2#
3# $Id$
4#
5# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
6
7# .limit.epcore: This only knows about making the mmsw libraries for
8# MM/EP-core.
9#
10# .usage: To invoke:
11#
12# directory {...}s7ppac
13# BuildProgram -d Variety mmsw
14#
15# (this builds mmsw_TI.o, mmsw_HI.o, and mmsw_WE.o)
16#
17# to clean everything else away:
18#
19# directory {...}s7ppac
20# BuildProgram -d Variety clean
21#
22# Notes:
23#
24# .dep.accum: If several single-f rules all produce the same product
25# (left-hand-side of the f), they act together: at most one may have a
26# body, the others only add additional dependencies.
27
28
29# Options cribbed from SWbuild!macos:rules:rulemrc4.make(trunk.3)
30CC_OPT_CONTROL= -nomfmem -y "{TempFolder}"
31CC_OPT_SOURCE= -inclpath nosystem
32CC_OPT_OBJECT= -align power -char signed -enum int -fp_contract off -ldsize 128 -target ppc
33
34CC_OPTT_AbsAPAD= -ansi strict -proto strict -typecheck strict
35# Plus "warnings are errors":
36CC_OPTT={CC_OPTT_AbsAPAD} -w error
37
38CC_OPTR_Dbg= -opt off -sym on -tb on
39CC_OPTR_Qkb= -opt off -sym off -tb on
40CC_OPTR_Spd= -opt speed,nounroll -sym off -tb on
41CC_OPTR_= -opt speed,nounroll -sym off -w 35
42
43SYS_CINCLUDES= -i {CIncludes96}
44
45
46BB_OPT_CONTROL= -nomf -linkfaster on
47BB_OPT_SOURCE=
48BB_OPT_OBJECT= -xm Library
49
50BB_OPTR_Dbg= -sym on
51BB_OPTR_Qkb= -sym off
52BB_OPTR_Spd= -sym off
53BB_OPTR_= -sym off
54
55
56PRODDEFINES= -d CONFIG_VAR_{Variety} -d CONFIG_PROD_EPCORE
57
58":" Ä "::"
59
60OSffx = .c.{Variety}.o
61
62.c.TI.o Ä .c
63 {MPWCommands96}MrC2.0.2d1 ¶
64 -o {Targ} ¶
65 {CC_OPTT} ¶
66 {CC_OPTR_Dbg} ¶
67 {CC_OPT_CONTROL} {CC_OPT_SOURCE} {CC_OPT_OBJECT} ¶
68 {ENVDEFINES} {PRODDEFINES} ¶
69 {SYS_CINCLUDES} ¶
70 {DepDir}{Default}.c
71
72.c.CI.o Ä .c
73 {MPWCommands96}MrC2.0.2d1 ¶
74 -o {Targ} ¶
75 {CC_OPTT} ¶
76 {CC_OPTR_Dbg} ¶
77 {CC_OPT_CONTROL} {CC_OPT_SOURCE} {CC_OPT_OBJECT} ¶
78 {ENVDEFINES} {PRODDEFINES} ¶
79 {SYS_CINCLUDES} ¶
80 {DepDir}{Default}.c
81
82.c.HI.o Ä .c
83 {MPWCommands96}MrC2.0.2d1 ¶
84 -o {Targ} ¶
85 {CC_OPTT} ¶
86 {CC_OPTR_} ¶
87 {CC_OPT_CONTROL} {CC_OPT_SOURCE} {CC_OPT_OBJECT} ¶
88 {ENVDEFINES} {PRODDEFINES} ¶
89 {SYS_CINCLUDES} ¶
90 {DepDir}{Default}.c
91
92.c.HE.o Ä .c
93 {MPWCommands96}MrC2.0.2d1 ¶
94 -o {Targ} ¶
95 {CC_OPTT} ¶
96 {CC_OPTR_} ¶
97 {CC_OPT_CONTROL} {CC_OPT_SOURCE} {CC_OPT_OBJECT} ¶
98 {ENVDEFINES} {PRODDEFINES} ¶
99 {SYS_CINCLUDES} ¶
100 {DepDir}{Default}.c
101
102.c.WE.o Ä .c
103 {MPWCommands96}MrC2.0.2d1 ¶
104 -o {Targ} ¶
105 {CC_OPTT} ¶
106 {CC_OPTR_} ¶
107 {CC_OPT_CONTROL} {CC_OPT_SOURCE} {CC_OPT_OBJECT} ¶
108 {ENVDEFINES} {PRODDEFINES} ¶
109 {SYS_CINCLUDES} ¶
110 {DepDir}{Default}.c
111
112# version.o has a special rule so that it is always built
113version{OSffx} Ä $OutOfDate
114
115mmsw_{Variety}.o Ä ¶
116 version{OSffx} ¶
117 assert{OSffx} ¶
118 ring{OSffx} ¶
119 mpm{OSffx} ¶
120 bt{OSffx} ¶
121 boot{OSffx} ¶
122 arenacl{OSffx} ¶
123 arenavmx{OSffx} ¶
124 locus{OSffx} ¶
125 arena{OSffx} ¶
126 global{OSffx} ¶
127 tract{OSffx} ¶
128 walk{OSffx} ¶
129 reserv{OSffx} ¶
130 pool{OSffx} ¶
131 poolmfs{OSffx} ¶
132 poolmv{OSffx} ¶
133 root{OSffx} ¶
134 format{OSffx} ¶
135 buffer{OSffx} ¶
136 ref{OSffx} ¶
137 trace{OSffx} ¶
138 protsw{OSffx} ¶
139 shield{OSffx} ¶
140 than{OSffx} ¶
141 ssan{OSffx} ¶
142 mpsi{OSffx} ¶
143 ld{OSffx} ¶
144 poolabs{OSffx} ¶
145 poolepdl{OSffx} ¶
146 poolepvm{OSffx} ¶
147 poolams{OSffx} ¶
148 protocol{OSffx} ¶
149 action{OSffx} ¶
150 seg{OSffx} ¶
151 sac{OSffx} ¶
152 event{OSffx} ¶
153 mpsioan{OSffx} ¶
154 dbgpool{OSffx} ¶
155 meter{OSffx} ¶
156 poolmrg{OSffx} ¶
157 poolmvff{OSffx} ¶
158 splay{OSffx} ¶
159 cbs{OSffx} ¶
160 message{OSffx}
161
162mmsw_TI.o Ä # .dep.accum
163 {MPWCommands97}PPCLink1.5 ¶
164 -o {Targ} ¶
165 {BB_OPTR_Dbg} ¶
166 {BB_OPT_CONTROL} {BB_OPT_SOURCE} {BB_OPT_OBJECT} ¶
167 {Deps}
168
169mmsw_CI.o Ä # .dep.accum
170 {MPWCommands97}PPCLink1.5 ¶
171 -o {Targ} ¶
172 {BB_OPTR_Dbg} ¶
173 {BB_OPT_CONTROL} {BB_OPT_SOURCE} {BB_OPT_OBJECT} ¶
174 {Deps}
175
176mmsw_HI.o Ä # .dep.accum
177 {MPWCommands97}PPCLink1.5 ¶
178 -o {Targ} ¶
179 {BB_OPTR_} ¶
180 {BB_OPT_CONTROL} {BB_OPT_SOURCE} {BB_OPT_OBJECT} ¶
181 {Deps}
182
183mmsw_HE.o Ä # .dep.accum
184 {MPWCommands97}PPCLink1.5 ¶
185 -o {Targ} ¶
186 {BB_OPTR_} ¶
187 {BB_OPT_CONTROL} {BB_OPT_SOURCE} {BB_OPT_OBJECT} ¶
188 {Deps}
189
190mmsw_WE.o Ä # .dep.accum
191 {MPWCommands97}PPCLink1.5 ¶
192 -o {Targ} ¶
193 {BB_OPTR_} ¶
194 {BB_OPT_CONTROL} {BB_OPT_SOURCE} {BB_OPT_OBJECT} ¶
195 {Deps}
196
197
198cleanall Ä
199 Delete Å.o
200
201clean Ä
202 Delete Å.c.Å.o
203
204mmsw Ä
205 BuildProgram -d Variety=TI mmsw_TI.o
206 BuildProgram -d Variety=HI mmsw_HI.o
207 BuildProgram -d Variety=WE mmsw_WE.o
208
209
210# C. COPYRIGHT AND LICENSE
211#
212# Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
213# All rights reserved. This is an open source license. Contact
214# Ravenbrook for commercial licensing options.
215#
216# Redistribution and use in source and binary forms, with or without
217# modification, are permitted provided that the following conditions are
218# met:
219#
220# 1. Redistributions of source code must retain the above copyright
221# notice, this list of conditions and the following disclaimer.
222#
223# 2. Redistributions in binary form must reproduce the above copyright
224# notice, this list of conditions and the following disclaimer in the
225# documentation and/or other materials provided with the distribution.
226#
227# 3. Redistributions in any form must be accompanied by information on how
228# to obtain complete source code for this software and any accompanying
229# software that uses this software. The source code must either be
230# included in the distribution or be available for no more than the cost
231# of distribution plus a nominal fee, and must be freely redistributable
232# under reasonable conditions. For an executable file, complete source
233# code means the source code for all modules it contains. It does not
234# include source code for modules or files that typically accompany the
235# major components of the operating system on which the executable file
236# runs.
237#
238# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
239# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
240# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
241# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
242# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
243# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
244# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
245# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
246# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
247# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
248# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/sacss.c b/mps/code/sacss.c
index 6c5067583db..5378bc5e768 100644
--- a/mps/code/sacss.c
+++ b/mps/code/sacss.c
@@ -15,9 +15,6 @@
15 15
16#include <stdio.h> 16#include <stdio.h>
17#include "mpstd.h" 17#include "mpstd.h"
18#ifdef MPS_OS_SU
19#include "ossu.h"
20#endif
21#include <stdlib.h> 18#include <stdlib.h>
22#include <stdarg.h> 19#include <stdarg.h>
23#ifdef MPS_OS_IA 20#ifdef MPS_OS_IA
diff --git a/mps/code/sso1al.s b/mps/code/sso1al.s
deleted file mode 100644
index 1c2b2b35a92..00000000000
--- a/mps/code/sso1al.s
+++ /dev/null
@@ -1,82 +0,0 @@
1 # sso1al.s: STACK SCANNING FOR DIGITAL UNIX / ALPHA
2 #
3 # $Id$
4 # Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 #
6 # .readership: Any MPS developer that is prepared to read Alpha
7 # assembly code in DIGITAL UNIX 'as' syntax.
8 #
9 # See <design/sso1al/> for the design (exists).
10
11
12.globl StackScan
13.globl TraceScanArea
14
15.ent StackScan
16StackScan:
17ldgp $gp,0($27) # faff with global pointer
18lda $sp,-64($sp) # build and declare frame and saveregs
19.frame $sp,64,$26
20.mask 0x400FE00,-64
21stq $26,0($sp) # dump ra and other regs so that they get fixed
22stq $9,8($sp)
23stq $10,16($sp)
24stq $11,24($sp)
25stq $12,32($sp)
26stq $13,40($sp)
27stq $14,48($sp)
28stq $15,56($sp)
29.prologue 1
30
31 # bis $31,$16,$16 1st arg to TraceScanArea is same as our 1st arg
32bis $31,$17,$18 # area to be scanned is from $sp to StackBot
33bis $31,$sp,$17
34
35jsr $26,TraceScanArea
36ldgp $gp,0($26)
37 # our result is TraceScanArea's result, so leave $0 untouched
38
39ldq $26,0($sp)
40lda $sp,+64($sp)
41ret $31,($26),1
42.end StackScan
43
44 # C. COPYRIGHT AND LICENSE
45 #
46 # Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
47 # All rights reserved. This is an open source license. Contact
48 # Ravenbrook for commercial licensing options.
49 #
50 # Redistribution and use in source and binary forms, with or without
51 # modification, are permitted provided that the following conditions are
52 # met:
53 #
54 # 1. Redistributions of source code must retain the above copyright
55 # notice, this list of conditions and the following disclaimer.
56 #
57 # 2. Redistributions in binary form must reproduce the above copyright
58 # notice, this list of conditions and the following disclaimer in the
59 # documentation and/or other materials provided with the distribution.
60 #
61 # 3. Redistributions in any form must be accompanied by information on how
62 # to obtain complete source code for this software and any accompanying
63 # software that uses this software. The source code must either be
64 # included in the distribution or be available for no more than the cost
65 # of distribution plus a nominal fee, and must be freely redistributable
66 # under reasonable conditions. For an executable file, complete source
67 # code means the source code for all modules it contains. It does not
68 # include source code for modules or files that typically accompany the
69 # major components of the operating system on which the executable file
70 # runs.
71 #
72 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
73 # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
74 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
75 # PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
76 # COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
77 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
78 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
79 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
80 # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
81 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
82 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/sssus8.c b/mps/code/sssus8.c
deleted file mode 100644
index 0a28bfc6650..00000000000
--- a/mps/code/sssus8.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/* sssus8.c: SPARC STACK SCANNING
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 * Portions copyright (c) 2002 Global Graphics Software.
6 *
7 * This scans the stack and fixes the registers which may contain
8 * roots. See <design/thread-manager/>.
9 *
10 * .roots: The non-global registers are preserved into the stackframe
11 * by the "ta 3" instruction. This leaves the global registers.
12 * According to the Sparc Architecture Manual:
13 * %g1 is assumed to be volatile across procedure calls
14 * %g2...%g4 are "reserved for use by application programmer"
15 * %g5...%g7 are "nonvolatile and reserved for (as-yet-undefined)
16 * use by the execution environment"
17 * To be safe %g2 to %g7 are pushed onto the stack before scanning
18 * it just in case.
19 *
20 * ASSUMPTIONS
21 *
22 * .assume.align: The stack pointer is assumed to be aligned on a word
23 * boundary.
24 *
25 * .assume.asm.stack: The compiler must not do wacky things with the
26 * stack pointer around a call since we need to ensure that the
27 * callee-save regs are visible during TraceScanArea.
28 *
29 * .assume.asm.order: The volatile modifier should prevent movement
30 * of code, which might break .assume.asm.stack.
31 */
32
33#include "mpm.h"
34#include <alloca.h>
35
36SRCID(sssus8, "$Id$");
37
38
39/* .assume.asm.order */
40#define ASMV(x) __asm__ volatile (x)
41
42
43Res StackScan(ScanState ss, Addr *stackBot)
44{
45 Addr *stackTop;
46 Res res;
47 void *globals;
48
49 /* We expect C will save the caller's window, but we don't really care, */
50 /* because it's bound to be an MPS window. */
51 globals = alloca(24); /* for 6 globals */
52 ASMV("std %%g2, [%0]" : : "r" (globals)); /* double stores */
53 ASMV("std %%g4, [%0 + 8]" : : "r" (globals));
54 ASMV("std %%g6, [%0 + 16]" : : "r" (globals));
55 ASMV("ta 3"); /* flushes register windows onto stack */
56 ASMV("mov %%sp, %0" : "=r" (stackTop)); /* stackTop = sp */
57
58 AVER(AddrIsAligned((Addr)stackTop, sizeof(Addr))); /* .assume.align */
59 res = TraceScanArea(ss, stackTop, stackBot);
60
61 return res;
62}
63
64
65/* C. COPYRIGHT AND LICENSE
66 *
67 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
68 * All rights reserved. This is an open source license. Contact
69 * Ravenbrook for commercial licensing options.
70 *
71 * Redistribution and use in source and binary forms, with or without
72 * modification, are permitted provided that the following conditions are
73 * met:
74 *
75 * 1. Redistributions of source code must retain the above copyright
76 * notice, this list of conditions and the following disclaimer.
77 *
78 * 2. Redistributions in binary form must reproduce the above copyright
79 * notice, this list of conditions and the following disclaimer in the
80 * documentation and/or other materials provided with the distribution.
81 *
82 * 3. Redistributions in any form must be accompanied by information on how
83 * to obtain complete source code for this software and any accompanying
84 * software that uses this software. The source code must either be
85 * included in the distribution or be available for no more than the cost
86 * of distribution plus a nominal fee, and must be freely redistributable
87 * under reasonable conditions. For an executable file, complete source
88 * code means the source code for all modules it contains. It does not
89 * include source code for modules or files that typically accompany the
90 * major components of the operating system on which the executable file
91 * runs.
92 *
93 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
94 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
95 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
96 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
97 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
98 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
99 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
100 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
101 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
102 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
103 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
104 */
diff --git a/mps/code/sssus8.s b/mps/code/sssus8.s
deleted file mode 100644
index d8ed21fffc7..00000000000
--- a/mps/code/sssus8.s
+++ /dev/null
@@ -1,81 +0,0 @@
1! sssus8.s: STACK SCANNING
2!
3! $Id$
4!
5! Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
6!
7! This scans the stack and the preserved integer registers.
8! See <design/thread-manager/>.
9!
10! This file is identical to <code/sssos8.s>, except for the
11! leading underscore convention on C names. They should be
12! changed in parallel.
13!
14! The non-global registers are preserved into the stackframe
15! by the "ta 3" instruction. This leaves the global registers.
16! According to the Sparc Architecture Manual:
17! %g1 is assumed to be volatile across procedure calls
18! %g2...%g4 are "reserved for use by application programmer"
19! %g5...%g7 are "nonvolatile and reserved for (as-yet-undefined)
20! use by the execution environment"
21! To be safe %g2 to %g7 are pushed onto the stack before scanning
22! it just in case.
23
24.text
25 .align 4
26 .global _StackScan
27_StackScan: !(ss, stackBot)
28 save %sp,-120,%sp !23 required + 6 globals = 29 words, 8-aligned
29
30 std %g6,[%fp-8] !double stores
31 std %g4,[%fp-16]
32 std %g2,[%fp-24]
33 ta 3 !flushes register windows onto stack
34
35 mov %i0,%o0 !ss
36 sub %fp,24,%o1 !stackTop (base)
37 call _TraceScanArea !(stackTop,stackBot,trace,rank) returns e
38 mov %i1,%o2 !ds!stackBot (limit)
39
40 ret
41 restore %g0,%o0,%o0 !ds!return e
42
43! C. COPYRIGHT AND LICENSE
44!
45! Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
46! All rights reserved. This is an open source license. Contact
47! Ravenbrook for commercial licensing options.
48!
49! Redistribution and use in source and binary forms, with or without
50! modification, are permitted provided that the following conditions are
51! met:
52!
53! 1. Redistributions of source code must retain the above copyright
54! notice, this list of conditions and the following disclaimer.
55!
56! 2. Redistributions in binary form must reproduce the above copyright
57! notice, this list of conditions and the following disclaimer in the
58! documentation and/or other materials provided with the distribution.
59!
60! 3. Redistributions in any form must be accompanied by information on how
61! to obtain complete source code for this software and any accompanying
62! software that uses this software. The source code must either be
63! included in the distribution or be available for no more than the cost
64! of distribution plus a nominal fee, and must be freely redistributable
65! under reasonable conditions. For an executable file, complete source
66! code means the source code for all modules it contains. It does not
67! include source code for modules or files that typically accompany the
68! major components of the operating system on which the executable file
69! runs.
70!
71! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
72! IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
73! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
74! PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
75! COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
76! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
77! NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
78! USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
79! ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
80! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
81! THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/sus8gc.gmk b/mps/code/sus8gc.gmk
deleted file mode 100644
index 637ba64ed46..00000000000
--- a/mps/code/sus8gc.gmk
+++ /dev/null
@@ -1,57 +0,0 @@
1# sus8gc.gmk: BUILD FOR SUNOS/SPARC V8/GCC PLATFORM
2#
3# $Id$
4# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5
6PFM = sus8gc
7
8MPMPF = lockan.c than.c vmsu.c \
9 protsu.c prmcan.c span.c
10MPMS = sssus8.s
11
12LIBS = -lm
13
14include gc.gmk
15
16include comm.gmk
17
18
19# C. COPYRIGHT AND LICENSE
20#
21# Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
22# All rights reserved. This is an open source license. Contact
23# Ravenbrook for commercial licensing options.
24#
25# Redistribution and use in source and binary forms, with or without
26# modification, are permitted provided that the following conditions are
27# met:
28#
29# 1. Redistributions of source code must retain the above copyright
30# notice, this list of conditions and the following disclaimer.
31#
32# 2. Redistributions in binary form must reproduce the above copyright
33# notice, this list of conditions and the following disclaimer in the
34# documentation and/or other materials provided with the distribution.
35#
36# 3. Redistributions in any form must be accompanied by information on how
37# to obtain complete source code for this software and any accompanying
38# software that uses this software. The source code must either be
39# included in the distribution or be available for no more than the cost
40# of distribution plus a nominal fee, and must be freely redistributable
41# under reasonable conditions. For an executable file, complete source
42# code means the source code for all modules it contains. It does not
43# include source code for modules or files that typically accompany the
44# major components of the operating system on which the executable file
45# runs.
46#
47# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
48# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
49# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
50# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
51# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
52# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
53# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
54# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
55# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
57# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/table.c b/mps/code/table.c
index b7ba512d270..e141bf1d8e2 100644
--- a/mps/code/table.c
+++ b/mps/code/table.c
@@ -15,10 +15,6 @@
15#include <assert.h> 15#include <assert.h>
16#include <stdio.h> 16#include <stdio.h>
17#include "mpstd.h" 17#include "mpstd.h"
18#ifdef MPS_OS_SU
19#include "ossu.h"
20#endif
21
22 18
23typedef unsigned long ulong; 19typedef unsigned long ulong;
24 20
diff --git a/mps/code/testlib.h b/mps/code/testlib.h
index 69a268dc056..3d187080fc2 100644
--- a/mps/code/testlib.h
+++ b/mps/code/testlib.h
@@ -18,9 +18,6 @@
18#ifdef MPS_OS_W3 18#ifdef MPS_OS_W3
19#include "mpswin.h" 19#include "mpswin.h"
20#endif 20#endif
21#ifdef MPS_OS_SU
22#include "ossu.h"
23#endif
24#ifdef MPS_OS_XC 21#ifdef MPS_OS_XC
25#include "osxc.h" 22#include "osxc.h"
26#endif 23#endif
diff --git a/mps/code/vmi5.c b/mps/code/vmi5.c
deleted file mode 100644
index 081174a0fc5..00000000000
--- a/mps/code/vmi5.c
+++ /dev/null
@@ -1,318 +0,0 @@
1/* vmi5.c: VIRTUAL MEMORY MAPPING FOR IRIX 5 (AND 6)
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 *
6 * Design: <design/vm/>
7 *
8 * This is the implementation of the virtual memory mapping interface
9 * (vm.h) for IRIX 5.x.
10 *
11 * mmap(2) is used to reserve address space by creating a mapping to
12 * /dev/zero with page access none. mmap(2) is used to map pages
13 * onto store by creating a copy-on-write mapping to /dev/zero.
14 *
15 * .assume.not-last: The implementation of VMCreate assumes that
16 * mmap() will not choose a region which contains the last page
17 * in the address space, so that the limit of the mapped area
18 * is representable.
19 *
20 * .assume.mmap.err: EAGAIN is the only error we really expect to get
21 * from mmap when committing and ENOMEM when reserving or committing (we
22 * have actually observed ENOMEM when committing). The others are
23 * either caused by invalid params or features we don't use. See
24 * mmap(2) for details.
25 *
26 * TRANSGRESSIONS
27 *
28 * .fildes.name: VMStruct has one fields whose name violates our naming
29 * conventions. It's called zero_fd to emphasize that it's a file
30 * descriptor and this fact is not reflected in the type.
31 */
32
33#include "mpm.h"
34
35#if !defined(MPS_OS_I5) && !defined(MPS_OS_IA)
36#error "vmi5.c is IRIX-specific, but MPS_OS_I5 or MPS_OS_IA is not set"
37#endif
38
39#define _POSIX_SOURCE
40#define _POSIX_C_SOURCE 199309L
41
42#include <sys/types.h>
43#include <sys/mman.h>
44#include <sys/stat.h>
45#include <fcntl.h>
46#include <errno.h>
47#include <unistd.h>
48
49/* No constant for the mmap error return on IRIX 5, so define one. */
50#if !defined(MAP_FAILED) && defined(MPS_OS_I5)
51#define MAP_FAILED ((void *)-1)
52#endif
53
54SRCID(vmi5, "$Id$");
55
56
57/* VMStruct -- virtual memory structure */
58
59#define VMSig ((Sig)0x519B3999) /* SIGnature VM */
60
61/* The name zero_fd is a transgression, see .fildes.name. */
62typedef struct VMStruct {
63 Sig sig; /* <design/sig/> */
64 int zero_fd; /* fildes for mmap */
65 Align align; /* page size */
66 Addr base, limit; /* boundaries of reserved space */
67 Size reserved; /* total reserved address space */
68 Size mapped; /* total mapped memory */
69} VMStruct;
70
71
72Align VMAlign(VM vm)
73{
74 AVERT(VM, vm);
75 return vm->align;
76}
77
78
79Bool VMCheck(VM vm)
80{
81 CHECKS(VM, vm);
82 CHECKL(vm->zero_fd >= 0);
83 CHECKL(vm->base != 0);
84 CHECKL(vm->limit != 0);
85 CHECKL(vm->base < vm->limit);
86 CHECKL(vm->mapped <= vm->reserved);
87 CHECKL(SizeIsP2(vm->align));
88 CHECKL(AddrIsAligned(vm->base, vm->align));
89 CHECKL(AddrIsAligned(vm->limit, vm->align));
90 return TRUE;
91}
92
93
94Res VMCreate(VM *vmReturn, Size size)
95{
96 void *addr;
97 Align align;
98 int zero_fd;
99 VM vm;
100 Res res;
101
102 AVER(vmReturn != NULL);
103
104 align = (Align)sysconf(_SC_PAGESIZE);
105 AVER(SizeIsP2(align));
106 size = SizeAlignUp(size, align);
107 if((size == 0) || (size > (Size)(size_t)-1))
108 return ResRESOURCE;
109
110 zero_fd = open("/dev/zero", O_RDONLY);
111 if(zero_fd == -1)
112 return ResFAIL;
113
114 /* Map in a page to store the descriptor on. */
115 addr = mmap((void *)0, (size_t)SizeAlignUp(sizeof(VMStruct), align),
116 PROT_READ | PROT_WRITE, MAP_PRIVATE,
117 zero_fd, (off_t)0);
118 if(addr == MAP_FAILED) {
119 AVER(errno == ENOMEM || errno == EAGAIN); /* .assume.mmap.err */
120 res = (errno == ENOMEM || errno == EAGAIN) ? ResMEMORY : ResFAIL;
121 goto failVMMap;
122 }
123 vm = (VM)addr;
124
125 vm->zero_fd = zero_fd;
126 vm->align = align;
127
128 /* .map.reserve: MAP_AUTORESRV is necessary to avoid reserving swap. */
129 addr = mmap((void *)0, (size_t)size, PROT_NONE, MAP_SHARED | MAP_AUTORESRV,
130 zero_fd, (off_t)0);
131 if(addr == MAP_FAILED) {
132 AVER(errno == ENOMEM); /* .assume.mmap.err */
133 res = (errno == ENOMEM) ? ResRESOURCE : ResFAIL;
134 goto failReserve;
135 }
136
137 vm->base = (Addr)addr;
138 vm->limit = AddrAdd(vm->base, size);
139 vm->reserved = size;
140 vm->mapped = (Size)0;
141
142 vm->sig = VMSig;
143
144 AVERT(VM, vm);
145
146 EVENT_PAA(VMCreate, vm, vm->base, vm->limit);
147
148 *vmReturn = vm;
149 return ResOK;
150
151failReserve:
152 (void)munmap((void *)vm, (size_t)SizeAlignUp(sizeof(VMStruct), align));
153failVMMap:
154 (void)close(zero_fd);
155 return res;
156}
157
158
159void VMDestroy(VM vm)
160{
161 int r;
162 int zero_fd;
163
164 AVERT(VM, vm);
165 AVER(vm->mapped == (Size)0);
166
167 /* This appears to be pretty pointless, since the descriptor */
168 /* page is about to vanish completely. However, munmap might fail */
169 /* for some reason, and this would ensure that it was still */
170 /* discovered if sigs were being checked. */
171 vm->sig = SigInvalid;
172
173 zero_fd = vm->zero_fd;
174 r = munmap((void *)vm->base, (size_t)AddrOffset(vm->base, vm->limit));
175 AVER(r == 0);
176 r = munmap((void *)vm, (size_t)SizeAlignUp(sizeof(VMStruct), vm->align));
177 AVER(r == 0);
178 r = close(zero_fd);
179 AVER(r == 0);
180
181 EVENT_P(VMDestroy, vm);
182}
183
184
185Addr VMBase(VM vm)
186{
187 AVERT(VM, vm);
188 return vm->base;
189}
190
191Addr VMLimit(VM vm)
192{
193 AVERT(VM, vm);
194 return vm->limit;
195}
196
197
198Size VMReserved(VM vm)
199{
200 AVERT(VM, vm);
201 return vm->reserved;
202}
203
204Size VMMapped(VM vm)
205{
206 AVERT(VM, vm);
207 return vm->mapped;
208}
209
210
211Res VMMap(VM vm, Addr base, Addr limit)
212{
213 Size size;
214 void *addr;
215
216 AVERT(VM, vm);
217 AVER(base < limit);
218 AVER(base >= vm->base);
219
220 AVER(limit <= vm->limit);
221 AVER(AddrIsAligned(base, vm->align));
222 AVER(AddrIsAligned(limit, vm->align));
223
224 /* Map /dev/zero onto the area with a copy-on-write policy. This */
225 /* effectively populates the area with zeroed memory. */
226 size = AddrOffset(base, limit);
227 /* Check it won't lose any bits. */
228 AVER(size <= (Size)(size_t)-1);
229 addr = mmap((void *)base, (size_t)size,
230 PROT_READ | PROT_WRITE | PROT_EXEC,
231 MAP_PRIVATE | MAP_FIXED,
232 vm->zero_fd, (off_t)0);
233 if(addr == MAP_FAILED) {
234 AVER(errno == ENOMEM || errno == EAGAIN); /* .assume.mmap.err */
235 return ResMEMORY;
236 }
237 AVER(addr == (void *)base);
238
239 vm->mapped += size;
240
241 EVENT_PAA(VMMap, vm, base, limit);
242 return ResOK;
243}
244
245
246void VMUnmap(VM vm, Addr base, Addr limit)
247{
248 Size size;
249 void *addr;
250
251 AVERT(VM, vm);
252 AVER(base < limit);
253 AVER(base >= vm->base);
254 AVER(limit <= vm->limit);
255 AVER(AddrIsAligned(base, vm->align));
256 AVER(AddrIsAligned(limit, vm->align));
257
258 /* .unmap.reserve: Map /dev/zero onto the area, allowing no access. */
259 /* This effectively depopulates the area from memory, but keeps */
260 /* it "busy" as far as the OS is concerned, so that it will not */
261 /* be re-used by other calls to mmap which do not specify */
262 /* MAP_FIXED. See also .map.reserve. */
263 /* The OS doesn't merge this mapping with any neighbours, but it */
264 /* can keep track of at least 16K mappings, so it's good enough. */
265 size = AddrOffset(base, limit);
266 /* Check it won't lose any bits. */
267 AVER(size <= (Size)(size_t)-1);
268 addr = mmap((void *)base, (size_t)size,
269 PROT_NONE, MAP_SHARED | MAP_FIXED | MAP_AUTORESRV,
270 vm->zero_fd, (off_t)AddrOffset(vm->base, base));
271 AVER(addr == (void *)base);
272
273 vm->mapped -= size;
274
275 EVENT_PAA(VMUnmap, vm, base, limit);
276}
277
278
279/* C. COPYRIGHT AND LICENSE
280 *
281 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
282 * All rights reserved. This is an open source license. Contact
283 * Ravenbrook for commercial licensing options.
284 *
285 * Redistribution and use in source and binary forms, with or without
286 * modification, are permitted provided that the following conditions are
287 * met:
288 *
289 * 1. Redistributions of source code must retain the above copyright
290 * notice, this list of conditions and the following disclaimer.
291 *
292 * 2. Redistributions in binary form must reproduce the above copyright
293 * notice, this list of conditions and the following disclaimer in the
294 * documentation and/or other materials provided with the distribution.
295 *
296 * 3. Redistributions in any form must be accompanied by information on how
297 * to obtain complete source code for this software and any accompanying
298 * software that uses this software. The source code must either be
299 * included in the distribution or be available for no more than the cost
300 * of distribution plus a nominal fee, and must be freely redistributable
301 * under reasonable conditions. For an executable file, complete source
302 * code means the source code for all modules it contains. It does not
303 * include source code for modules or files that typically accompany the
304 * major components of the operating system on which the executable file
305 * runs.
306 *
307 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
308 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
309 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
310 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
311 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
312 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
313 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
314 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
315 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
316 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
317 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
318 */
diff --git a/mps/code/vmo1.c b/mps/code/vmo1.c
deleted file mode 100644
index 6aee73ede16..00000000000
--- a/mps/code/vmo1.c
+++ /dev/null
@@ -1,341 +0,0 @@
1/* vmo1.c: VIRTUAL MEMORY MAPPING FOR DIGITAL UNIX
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 *
6 * .design: <design/vm/>, <design/vmo1/>
7 *
8 * .status: A bit hacky, but probably working.
9 *
10 * .assume.mmap.err: ENOMEM is the only error we really expect to
11 * get from mmap. The others are either caused by invalid params
12 * or features we don't use. See mmap(2) for details.
13 *
14 * .assume.off_t: We assume that the Size type (defined by the MM) fits
15 * in the off_t type (define by the system (POSIX?)). In fact we test
16 * the more stringent requirement that they are the same size. This
17 * assumption is made in VMUnmap.
18 */
19
20#include "mpm.h"
21
22#ifndef MPS_OS_O1
23#error "vmo1.c is DEC UNIX / OSF1 specific, but MPS_OS_O1 is not set"
24#endif
25
26/* open sesame magic, see standards(5) */
27#define _POSIX_C_SOURCE 199309L
28#define _XOPEN_SOURCE_EXTENDED 1
29
30/* for open(2) */
31#include <sys/stat.h>
32#include <sys/types.h>
33#include <fcntl.h>
34
35/* for mmap(2),munmap(2) */
36#include <sys/mman.h>
37
38/* for errno(2) */
39#include <errno.h>
40
41/* for getpagesize(2),close(2) */
42#include <unistd.h>
43
44SRCID(vmo1, "$Id$");
45
46
47/* Fix unprototyped system calls
48 *
49 * For some bizarre reason DEC go out of their way to not prototype
50 * these calls when using gcc. See /usr/include/standards.h and
51 * /usr/include/unistd.h for the very gory details.
52 */
53#ifdef MPS_BUILD_GC
54extern int close(int);
55extern int getpagesize(void);
56#endif
57
58
59/* VMStruct -- virtual memory structure */
60
61#define VMSig ((Sig)0x519B3999) /* SIGnature VM */
62
63typedef struct VMStruct {
64 Sig sig; /* <design/sig/> */
65 Align align; /* page size */
66 Addr base, limit; /* boundaries of reserved space */
67 Size reserved; /* total reserved address space */
68 Size mapped; /* total mapped memory */
69 int none_fd; /* fildes for reserved memory */
70} VMStruct;
71
72
73/* VMAlign -- return the page size */
74
75Align VMAlign(VM vm)
76{
77 AVERT(VM, vm);
78
79 return vm->align;
80}
81
82
83/* VMCheck -- check a VM structure */
84
85Bool VMCheck(VM vm)
86{
87 CHECKS(VM, vm);
88 CHECKL(vm->none_fd >= 0);
89 CHECKL(vm->base != 0);
90 CHECKL(vm->limit != 0);
91 CHECKL(vm->base < vm->limit);
92 CHECKL(vm->mapped <= vm->reserved);
93 CHECKL(SizeIsP2(vm->align));
94 CHECKL(AddrIsAligned(vm->base, vm->align));
95 CHECKL(AddrIsAligned(vm->limit, vm->align));
96 return TRUE;
97}
98
99
100/* VMCreate -- reserve some virtual address space, and create a VM structure */
101
102Res VMCreate(VM *vmReturn, Size size)
103{
104 void *addr;
105 Align align;
106 int none_fd;
107 VM vm;
108 Res res;
109
110 AVER(vmReturn != NULL);
111
112 align = (Align)getpagesize();
113 AVER(SizeIsP2(align));
114 size = SizeAlignUp(size, align);
115 if ((size == 0) || (size > (Size)(size_t)-1))
116 return ResRESOURCE;
117
118 none_fd = open("/etc/passwd", O_RDONLY);
119 if (none_fd == -1) {
120 return ResFAIL;
121 }
122
123 /* Map in a page to store the descriptor on. */
124 addr = mmap(0, (size_t)SizeAlignUp(sizeof(VMStruct), align),
125 PROT_READ | PROT_WRITE,
126 MAP_ANONYMOUS | MAP_PRIVATE | MAP_VARIABLE,
127 -1, 0);
128 if (addr == (void *)-1) {
129 int e = errno;
130 AVER(e == ENOMEM); /* .assume.mmap.err */
131 res = (e == ENOMEM) ? ResMEMORY : ResFAIL;
132 goto failVMMap;
133 }
134 vm = (VM)addr;
135
136 vm->none_fd = none_fd;
137 vm->align = align;
138
139 /* See .assume.not-last. */
140 addr = mmap(0, (size_t)size,
141 PROT_NONE, MAP_FILE | MAP_SHARED | MAP_VARIABLE,
142 none_fd, 0);
143 if (addr == (void *)-1) {
144 int e = errno;
145 AVER(e == ENOMEM); /* .assume.mmap.err */
146 res = (e == ENOMEM) ? ResRESOURCE : ResFAIL;
147 goto failReserve;
148 }
149
150 vm->base = (Addr)addr;
151 vm->limit = AddrAdd(vm->base, size);
152 vm->reserved = size;
153 vm->mapped = (Size)0;
154
155 vm->sig = VMSig;
156 AVERT(VM, vm);
157 EVENT_PAA(VMCreate, vm, vm->base, vm->limit);
158 *vmReturn = vm;
159 return ResOK;
160
161failReserve:
162 (void)munmap((void *)vm, (size_t)SizeAlignUp(sizeof(VMStruct), align));
163failVMMap:
164 (void)close(none_fd); /* see .close.fail */
165 return res;
166}
167
168
169/* VMDestroy -- destroy the VM structure */
170
171void VMDestroy(VM vm)
172{
173 int r;
174 int none_fd;
175
176 AVERT(VM, vm);
177 AVER(vm->mapped == (Size)0);
178
179 /* This appears to be pretty pointless, since the space descriptor */
180 /* page is about to vanish completely. However, munmap might fail */
181 /* for some reason, and this would ensure that it was still */
182 /* discovered if sigs were being checked. */
183 vm->sig = SigInvalid;
184
185 none_fd = vm->none_fd;
186 r = munmap((void *)vm->base, (size_t)AddrOffset(vm->base, vm->limit));
187 AVER(r == 0);
188 r = munmap((void *)vm, (size_t)SizeAlignUp(sizeof(VMStruct), vm->align));
189 AVER(r == 0);
190 /* .close.fail: We ignore failure from close() as there's very */
191 /* little we can do anyway. */
192 (void)close(none_fd);
193
194 EVENT_P(VMDestroy, vm);
195}
196
197
198/* VMBase -- return the base address of the memory reserved */
199
200Addr VMBase(VM vm)
201{
202 AVERT(VM, vm);
203
204 return vm->base;
205}
206
207
208/* VMLimit -- return the limit address of the memory reserved */
209
210Addr VMLimit(VM vm)
211{
212 AVERT(VM, vm);
213
214 return vm->limit;
215}
216
217
218/* VMReserved -- return the amount of address space reserved */
219
220Size VMReserved(VM vm)
221{
222 AVERT(VM, vm);
223
224 return vm->reserved;
225}
226
227
228/* VMMapped -- return the amount of memory actually mapped */
229
230Size VMMapped(VM vm)
231{
232 AVERT(VM, vm);
233
234 return vm->mapped;
235}
236
237
238/* VMMap -- map the given range of memory */
239
240Res VMMap(VM vm, Addr base, Addr limit)
241{
242 Size size;
243
244 AVERT(VM, vm);
245 AVER(sizeof(void *) == sizeof(Addr));
246 AVER(base < limit);
247 AVER(base >= vm->base);
248 AVER(limit <= vm->limit);
249 AVER(AddrIsAligned(base, vm->align));
250 AVER(AddrIsAligned(limit, vm->align));
251
252 size = AddrOffset(base, limit);
253
254 if (mmap((void *)base, (size_t)size,
255 PROT_READ | PROT_WRITE | PROT_EXEC,
256 MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED,
257 -1, 0)
258 == (void *)-1) {
259 AVER(errno == ENOMEM); /* .assume.mmap.err */
260 return ResMEMORY;
261 }
262
263 vm->mapped += size;
264
265 EVENT_PAA(VMMap, vm, base, limit);
266 return ResOK;
267}
268
269
270/* VMUnmap -- unmap the given range of memory
271 *
272 * See <design/vmo1/#fun.unmap>.
273 */
274
275void VMUnmap(VM vm, Addr base, Addr limit)
276{
277 Size size;
278 void *addr;
279
280 AVERT(VM, vm);
281 AVER(base < limit);
282 AVER(base >= vm->base);
283 AVER(limit <= vm->limit);
284 AVER(AddrIsAligned(base, vm->align));
285 AVER(AddrIsAligned(limit, vm->align));
286 AVER(sizeof(off_t) == sizeof(Size)); /* .assume.off_t */
287
288 size = AddrOffset(base, limit);
289
290 /* see <design/vmo1/#fun.unmap.offset> */
291 addr = mmap((void *)base, (size_t)size,
292 PROT_NONE, MAP_FILE | MAP_SHARED | MAP_FIXED,
293 vm->none_fd, (off_t)AddrOffset(vm->base, base));
294 AVER(addr == (void *)base);
295
296 vm->mapped -= size;
297
298 EVENT_PAA(VMUnmap, vm, base, limit);
299}
300
301
302/* C. COPYRIGHT AND LICENSE
303 *
304 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
305 * All rights reserved. This is an open source license. Contact
306 * Ravenbrook for commercial licensing options.
307 *
308 * Redistribution and use in source and binary forms, with or without
309 * modification, are permitted provided that the following conditions are
310 * met:
311 *
312 * 1. Redistributions of source code must retain the above copyright
313 * notice, this list of conditions and the following disclaimer.
314 *
315 * 2. Redistributions in binary form must reproduce the above copyright
316 * notice, this list of conditions and the following disclaimer in the
317 * documentation and/or other materials provided with the distribution.
318 *
319 * 3. Redistributions in any form must be accompanied by information on how
320 * to obtain complete source code for this software and any accompanying
321 * software that uses this software. The source code must either be
322 * included in the distribution or be available for no more than the cost
323 * of distribution plus a nominal fee, and must be freely redistributable
324 * under reasonable conditions. For an executable file, complete source
325 * code means the source code for all modules it contains. It does not
326 * include source code for modules or files that typically accompany the
327 * major components of the operating system on which the executable file
328 * runs.
329 *
330 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
331 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
332 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
333 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
334 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
335 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
336 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
337 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
338 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
339 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
340 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
341 */
diff --git a/mps/code/vmsu.c b/mps/code/vmsu.c
deleted file mode 100644
index 0838ff0f6cf..00000000000
--- a/mps/code/vmsu.c
+++ /dev/null
@@ -1,356 +0,0 @@
1/* vmsu.c: VIRTUAL MEMORY MAPPING FOR SUNOS 4
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 *
6 * .design: See <design/vm/> for general design.
7 *
8 * mmap(2) is used to reserve address space by creating a mapping to
9 * /etc/passwd with page access none. mmap(2) is used to map pages
10 * onto store by creating a copy-on-write mapping to /dev/zero.
11 *
12 * Experiments have shown that attempting to reserve address space
13 * by mapping /dev/zero results in swap being reserved. This
14 * appears to be a bug, so we work round it by using /etc/passwd,
15 * the only file we can think of which is pretty much guaranteed
16 * to be around.
17 *
18 * .assume.not-last: The implementation of VMCreate assumes that
19 * mmap() will not choose a region which contains the last page
20 * in the address space, so that the limit of the mapped area
21 * is representable.
22 *
23 * .assume.size: The maximum size of the reserved address space is
24 * limited by the range of "int" (because doc of munmap(2) says so).
25 * This will probably be half of the address space.
26 *
27 * .assume.mmap.err: ENOMEM is the only error we really expect to
28 * get from mmap. The others are either caused by invalid params
29 * or features we don't use. See mmap(2) for details.
30 *
31 * TRANSGRESSIONS
32 *
33 * .fildes.name: VMStruct has two fields whose names violate our
34 * naming conventions. They are called none_fd and zero_fd to
35 * emphasize that they are file descriptors and this fact is not
36 * reflected in their type.
37 */
38
39#include "mpm.h"
40
41#ifndef MPS_OS_SU
42#error "vmsu.c is SunOS 4 specific, but MPS_OS_SU is not set"
43#endif
44
45#include <sys/types.h>
46#include <sys/mman.h>
47#include <fcntl.h>
48#include <errno.h>
49#include <sys/errno.h>
50#include <limits.h>
51
52SRCID(vmsu, "$Id$");
53
54
55/* Fix up unprototyped system calls. */
56
57extern int close(int fd);
58extern int munmap(caddr_t addr, int len);
59extern int getpagesize(void);
60
61
62/* VMStruct -- virtual memory structure */
63
64#define VMSig ((Sig)0x519B3999) /* SIGnature VM */
65
66/* The names of zero_fd and none_fd are transgressions, see .fildes.name */
67typedef struct VMStruct {
68 Sig sig; /* <design/sig/> */
69 int zero_fd; /* fildes for mmap, see <code/vmso.c> and <code/vmsu.c> */
70 int none_fd; /* fildes for mmap, see <code/vmso.c> and <code/vmsu.c> */
71 Align align; /* page size */
72 Addr base, limit; /* boundaries of reserved space */
73 Size reserved; /* total reserved address space */
74 Size mapped; /* total mapped memory */
75} VMStruct;
76
77
78/* VMAlign -- return the page size */
79
80Align VMAlign(VM vm)
81{
82 AVERT(VM, vm);
83 return vm->align;
84}
85
86
87/* VMCheck -- check a VM structure */
88
89Bool VMCheck(VM vm)
90{
91 CHECKS(VM, vm);
92 CHECKL(vm->zero_fd >= 0);
93 CHECKL(vm->none_fd >= 0);
94 CHECKL(vm->zero_fd != vm->none_fd);
95 CHECKL(vm->base != 0);
96 CHECKL(vm->limit != 0);
97 CHECKL(vm->base < vm->limit);
98 CHECKL(vm->mapped <= vm->reserved);
99 CHECKL(SizeIsP2(vm->align));
100 CHECKL(AddrIsAligned(vm->base, vm->align));
101 CHECKL(AddrIsAligned(vm->limit, vm->align));
102 return TRUE;
103}
104
105
106/* VMCreate -- reserve some virtual address space, and create a VM structure */
107
108Res VMCreate(VM *vmReturn, Size size)
109{
110 caddr_t addr;
111 Align align;
112 int zero_fd;
113 int none_fd;
114 VM vm;
115 Res res;
116
117 AVER(vmReturn != NULL);
118
119 align = (Align)getpagesize();
120 AVER(SizeIsP2(align));
121 size = SizeAlignUp(size, align);
122 if ((size == 0) || (size > (Size)INT_MAX)) /* see .assume.size */
123 return ResRESOURCE;
124
125 zero_fd = open("/dev/zero", O_RDONLY);
126 if (zero_fd == -1)
127 return ResFAIL;
128 none_fd = open("/etc/passwd", O_RDONLY);
129 if (none_fd == -1) {
130 res = ResFAIL;
131 goto failNoneOpen;
132 }
133
134 /* Map in a page to store the descriptor on. */
135 addr = mmap((caddr_t)0, SizeAlignUp(sizeof(VMStruct), align),
136 PROT_READ | PROT_WRITE, MAP_PRIVATE,
137 zero_fd, (off_t)0);
138 if (addr == (caddr_t)-1) {
139 int e = errno;
140 AVER(e == ENOMEM); /* .assume.mmap.err */
141 res = (e == ENOMEM) ? ResMEMORY : ResFAIL;
142 goto failVMMap;
143 }
144 vm = (VM)addr;
145
146 vm->zero_fd = zero_fd;
147 vm->none_fd = none_fd;
148 vm->align = align;
149
150 /* .map.reserve: See .assume.not-last. */
151 addr = mmap((caddr_t)0, size, PROT_NONE, MAP_SHARED, none_fd,
152 (off_t)0);
153 if (addr == (caddr_t)-1) {
154 int e = errno;
155 AVER(e == ENOMEM); /* .assume.mmap.err */
156 res = (e == ENOMEM) ? ResRESOURCE : ResFAIL;
157 goto failReserve;
158 }
159
160 vm->base = (Addr)addr;
161 vm->limit = AddrAdd(vm->base, size);
162 vm->reserved = size;
163 vm->mapped = (Size)0;
164
165 vm->sig = VMSig;
166
167 AVERT(VM, vm);
168
169 EVENT_PAA(VMCreate, vm, vm->base, vm->limit);
170
171 *vmReturn = vm;
172 return ResOK;
173
174failReserve:
175 (void)munmap((caddr_t)vm, (size_t)SizeAlignUp(sizeof(VMStruct), align));
176failVMMap:
177 (void)close(none_fd); /* see .close.fail */
178failNoneOpen:
179 (void)close(zero_fd);
180 return res;
181}
182
183
184/* VMDestroy -- destroy the VM structure and release the address space */
185
186void VMDestroy(VM vm)
187{
188 int r;
189 int zero_fd, none_fd;
190
191 AVERT(VM, vm);
192 AVER(vm->mapped == (Size)0);
193
194 /* This appears to be pretty pointless, since the space descriptor */
195 /* page is about to vanish completely. However, munmap might fail */
196 /* for some reason, and this would ensure that it was still */
197 /* discovered if sigs were being checked. */
198 vm->sig = SigInvalid;
199
200 zero_fd = vm->zero_fd; none_fd = vm->none_fd;
201 r = munmap((caddr_t)vm->base, (int)AddrOffset(vm->base, vm->limit));
202 AVER(r == 0);
203 r = munmap((caddr_t)vm,
204 (int)SizeAlignUp(sizeof(VMStruct), vm->align));
205 AVER(r == 0);
206 /* .close.fail: We ignore failure from close() as there's very */
207 /* little we can do anyway. */
208 (void)close(zero_fd);
209 (void)close(none_fd);
210
211 EVENT_P(VMDestroy, vm);
212}
213
214
215/* VMBase, VMLimit -- return the base & limit of the memory reserved */
216
217Addr VMBase(VM vm)
218{
219 AVERT(VM, vm);
220 return vm->base;
221}
222
223Addr VMLimit(VM vm)
224{
225 AVERT(VM, vm);
226 return vm->limit;
227}
228
229
230/* VMReserved -- return the amount of the memory reserved */
231
232Size VMReserved(VM vm)
233{
234 AVERT(VM, vm);
235 return vm->reserved;
236}
237
238
239/* VMMapped -- return the amount of the memory committed */
240
241Size VMMapped(VM vm)
242{
243 AVERT(VM, vm);
244 return vm->mapped;
245}
246
247
248/* VMMap -- commit memory between base & limit */
249
250Res VMMap(VM vm, Addr base, Addr limit)
251{
252 Size size;
253
254 AVERT(VM, vm);
255 AVER(sizeof(int) == sizeof(Addr));
256 AVER(base < limit);
257 AVER(base >= vm->base);
258 AVER(limit <= vm->limit);
259 AVER(AddrOffset(base, limit) <= INT_MAX);
260 AVER(AddrIsAligned(base, vm->align));
261 AVER(AddrIsAligned(limit, vm->align));
262
263 /* Map /dev/zero onto the area with a copy-on-write policy. This */
264 /* effectively populates the area with zeroed memory. */
265
266 size = AddrOffset(base, limit);
267
268 if (mmap((caddr_t)base, (int)size,
269 PROT_READ | PROT_WRITE | PROT_EXEC,
270 MAP_PRIVATE | MAP_FIXED,
271 vm->zero_fd, (off_t)0)
272 == (caddr_t)-1) {
273 AVER(errno == ENOMEM); /* .assume.mmap.err */
274 return ResMEMORY;
275 }
276
277 vm->mapped += size;
278
279 EVENT_PAA(VMMap, vm, base, limit);
280 return ResOK;
281}
282
283
284/* VMUnmap -- decommit memory between base & limit */
285
286void VMUnmap(VM vm, Addr base, Addr limit)
287{
288 Size size;
289 caddr_t addr;
290
291 AVERT(VM, vm);
292 AVER(sizeof(int) == sizeof(Addr));
293 AVER(base < limit);
294 AVER(base >= vm->base);
295 AVER(limit <= vm->limit);
296 AVER(AddrIsAligned(base, vm->align));
297 AVER(AddrIsAligned(limit, vm->align));
298
299 /* Map /etc/passwd onto the area, allowing no access. This */
300 /* effectively depopulates the area from memory, but keeps */
301 /* it "busy" as far as the OS is concerned, so that it will not */
302 /* be re-used by other calls to mmap which do not specify */
303 /* MAP_FIXED. The offset is specified to mmap so that */
304 /* the OS merges this mapping with .map.reserve. */
305 size = AddrOffset(base, limit);
306 addr = mmap((caddr_t)base, (int)size,
307 PROT_NONE, MAP_SHARED | MAP_FIXED,
308 vm->none_fd, (off_t)AddrOffset(vm->base, base));
309 AVER(addr == (caddr_t)base);
310
311 vm->mapped -= size;
312
313 EVENT_PAA(VMUnmap, vm, base, limit);
314}
315
316
317/* C. COPYRIGHT AND LICENSE
318 *
319 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
320 * All rights reserved. This is an open source license. Contact
321 * Ravenbrook for commercial licensing options.
322 *
323 * Redistribution and use in source and binary forms, with or without
324 * modification, are permitted provided that the following conditions are
325 * met:
326 *
327 * 1. Redistributions of source code must retain the above copyright
328 * notice, this list of conditions and the following disclaimer.
329 *
330 * 2. Redistributions in binary form must reproduce the above copyright
331 * notice, this list of conditions and the following disclaimer in the
332 * documentation and/or other materials provided with the distribution.
333 *
334 * 3. Redistributions in any form must be accompanied by information on how
335 * to obtain complete source code for this software and any accompanying
336 * software that uses this software. The source code must either be
337 * included in the distribution or be available for no more than the cost
338 * of distribution plus a nominal fee, and must be freely redistributable
339 * under reasonable conditions. For an executable file, complete source
340 * code means the source code for all modules it contains. It does not
341 * include source code for modules or files that typically accompany the
342 * major components of the operating system on which the executable file
343 * runs.
344 *
345 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
346 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
347 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
348 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
349 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
350 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
351 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
352 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
353 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
354 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
355 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
356 */