aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Jones2007-03-09 14:13:53 +0000
committerDavid Jones2007-03-09 14:13:53 +0000
commitceb7dc8aae2cb45e232182ee7525b40e6bd2dced (patch)
treeeccead4c49bff91076dcf837274e728c4eda37e9
parente6db2eb286bf3fa897e8d17302d33ab2c03930a3 (diff)
downloademacs-ceb7dc8aae2cb45e232182ee7525b40e6bd2dced.tar.gz
emacs-ceb7dc8aae2cb45e232182ee7525b40e6bd2dced.zip
Mps: removing protli.c
Copied from Perforce Change: 161909 ServerID: perforce.ravenbrook.com
-rw-r--r--mps/code/lii3eg.gmk2
-rw-r--r--mps/code/protli.c131
2 files changed, 1 insertions, 132 deletions
diff --git a/mps/code/lii3eg.gmk b/mps/code/lii3eg.gmk
index 2a42bac661e..753051a7fbd 100644
--- a/mps/code/lii3eg.gmk
+++ b/mps/code/lii3eg.gmk
@@ -13,7 +13,7 @@ THREADLIB = -lpthread
13PFMDEFS = -D_REENTRANT 13PFMDEFS = -D_REENTRANT
14 14
15MPMPF = ${THREADSRC} vmli.c \ 15MPMPF = ${THREADSRC} vmli.c \
16 protli.c protlii3.c proti3.c prmci3li.c ssixi3.c span.c 16 protix.c protlii3.c proti3.c prmci3li.c ssixi3.c span.c
17SWPF = than.c vmli.c protsw.c prmcan.c ssan.c 17SWPF = than.c vmli.c protsw.c prmcan.c ssan.c
18 18
19LIBS = -lm ${THREADLIB} 19LIBS = -lm ${THREADLIB}
diff --git a/mps/code/protli.c b/mps/code/protli.c
deleted file mode 100644
index 438299bc7c1..00000000000
--- a/mps/code/protli.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/* protli.c: PROTECTION FOR LINUX
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 */
6
7#include "mpm.h"
8
9#ifndef MPS_OS_LI
10#error "protli.c is Linux specific, but MPS_OS_LI is not set"
11#endif
12#ifndef PROTECTION
13#error "protli.c implements protection, but PROTECTION is not set"
14#endif
15
16#include <limits.h>
17#include <stddef.h>
18#include <stdlib.h>
19#include <sys/mman.h>
20
21SRCID(protli, "$Id$");
22
23
24/* ProtSet -- set protection
25 *
26 * This is just a thin veneer on top of mprotect(2).
27 */
28
29void ProtSet(Addr base, Addr limit, AccessSet mode)
30{
31 int flags;
32 int res;
33
34 AVER(sizeof(int) == sizeof(Addr)); /* should be redundant; will fail on Alpha */
35 AVER(base < limit);
36 AVER(base != 0);
37 AVER(AddrOffset(base, limit) <= INT_MAX); /* should be redundant */
38
39#if 0
40 /* .flags.trouble: This less strict version of flags (which allows write
41 * access unless explicitly told not to) caused mmqa test 37 to fail.
42 * This might be a bug in MPS, so for now we go with the stricter
43 * version that matches the Win32 implementation. */
44 flags = 0;
45 if((mode & AccessREAD) == 0)
46 flags |= PROT_READ | PROT_EXEC;
47 if((mode & AccessWRITE) == 0)
48 flags |= PROT_WRITE;
49#endif
50 flags = PROT_READ | PROT_WRITE | PROT_EXEC;
51 if((mode & AccessWRITE) != 0)
52 flags = PROT_READ | PROT_EXEC;
53 if((mode & AccessREAD) != 0)
54 flags = 0;
55
56 res = mprotect((void *)base, (size_t)AddrOffset(base, limit), flags);
57 AVER(res == 0);
58}
59
60
61/* ProtSync -- synchronize protection settings with hardware
62 *
63 * This does nothing under Linux.
64 */
65
66void ProtSync(Arena arena)
67{
68 NOOP;
69}
70
71
72
73/* ProtTramp -- protection trampoline
74 *
75 * The protection trampoline is trivial under Linux, as there is nothing
76 * that needs to be done in the dynamic context of the mutator in order
77 * to catch faults. (Contrast this with Win32 Structured Exception
78 * Handling.)
79 */
80
81void ProtTramp(void **resultReturn, void *(*f)(void *, size_t),
82 void *p, size_t s)
83{
84 AVER(resultReturn != NULL);
85 AVER(FUNCHECK(f));
86 /* Can't check p and s as they are interpreted by the client */
87
88 *resultReturn = (*f)(p, s);
89}
90
91
92/* C. COPYRIGHT AND LICENSE
93 *
94 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
95 * All rights reserved. This is an open source license. Contact
96 * Ravenbrook for commercial licensing options.
97 *
98 * Redistribution and use in source and binary forms, with or without
99 * modification, are permitted provided that the following conditions are
100 * met:
101 *
102 * 1. Redistributions of source code must retain the above copyright
103 * notice, this list of conditions and the following disclaimer.
104 *
105 * 2. Redistributions in binary form must reproduce the above copyright
106 * notice, this list of conditions and the following disclaimer in the
107 * documentation and/or other materials provided with the distribution.
108 *
109 * 3. Redistributions in any form must be accompanied by information on how
110 * to obtain complete source code for this software and any accompanying
111 * software that uses this software. The source code must either be
112 * included in the distribution or be available for no more than the cost
113 * of distribution plus a nominal fee, and must be freely redistributable
114 * under reasonable conditions. For an executable file, complete source
115 * code means the source code for all modules it contains. It does not
116 * include source code for modules or files that typically accompany the
117 * major components of the operating system on which the executable file
118 * runs.
119 *
120 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
121 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
122 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
123 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
124 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
125 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
126 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
127 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
128 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
129 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
130 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
131 */