diff options
| author | David Jones | 2007-03-09 14:07:49 +0000 |
|---|---|---|
| committer | David Jones | 2007-03-09 14:07:49 +0000 |
| commit | e6db2eb286bf3fa897e8d17302d33ab2c03930a3 (patch) | |
| tree | 7cff71c062ba7aa802c820b4d03134a7d209888c | |
| parent | a8888685eaa4380e75773fb29104cf14add19ef9 (diff) | |
| download | emacs-e6db2eb286bf3fa897e8d17302d33ab2c03930a3.tar.gz emacs-e6db2eb286bf3fa897e8d17302d33ab2c03930a3.zip | |
Mps: using protix on linux. linux spotted a bug / historical blemish.
Copied from Perforce
Change: 161908
ServerID: perforce.ravenbrook.com
| -rw-r--r-- | mps/code/lii4gc.gmk | 2 | ||||
| -rw-r--r-- | mps/code/protix.c | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/mps/code/lii4gc.gmk b/mps/code/lii4gc.gmk index 74845348759..06bba6afcc1 100644 --- a/mps/code/lii4gc.gmk +++ b/mps/code/lii4gc.gmk | |||
| @@ -11,7 +11,7 @@ THREADLIB = -lpthread | |||
| 11 | PFMDEFS = -D_REENTRANT | 11 | PFMDEFS = -D_REENTRANT |
| 12 | 12 | ||
| 13 | MPMPF = ${THREADSRC} vmli.c \ | 13 | MPMPF = ${THREADSRC} vmli.c \ |
| 14 | protli.c protlii3.c proti3.c prmci3li.c ssixi3.c span.c | 14 | protix.c protlii3.c proti3.c prmci3li.c ssixi3.c span.c |
| 15 | SWPF = than.c vmli.c protsw.c prmcan.c ssan.c | 15 | SWPF = than.c vmli.c protsw.c prmcan.c ssan.c |
| 16 | 16 | ||
| 17 | LIBS = -lm ${THREADLIB} | 17 | LIBS = -lm ${THREADLIB} |
diff --git a/mps/code/protix.c b/mps/code/protix.c index 48c432a0a28..89b1482e9e8 100644 --- a/mps/code/protix.c +++ b/mps/code/protix.c | |||
| @@ -4,13 +4,23 @@ | |||
| 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), and FreeBSD. | 7 | * Darwin (OS X), OSF/1 (DIGITAL UNIX), FreeBSD, and Linux. |
| 8 | * | 8 | * |
| 9 | * May not actually work on OSF/1 due to lack of available machines. | 9 | * May not actually work on OSF/1 due to lack of available machines. |
| 10 | * | 10 | * |
| 11 | * This file does not contain a signal handler. That's in protsgix.c | 11 | * 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 | 12 | * (for FreeBSD and Darwin on Intel); in protxcpp.c (for Darwin on |
| 13 | * PowerPC). | 13 | * PowerPC). |
| 14 | * | ||
| 15 | * ASSUMPTIONS | ||
| 16 | * | ||
| 17 | * .assume.mprotect.base: We assume that the first argument to mprotect can | ||
| 18 | * be safely passed as a void *. Single UNIX Specification Version 2 | ||
| 19 | * (aka X/OPEN XSH5) says that the parameter is a void *. Some | ||
| 20 | * Unix-likes may declare this parameter as a caddr_t. FreeBSD used to | ||
| 21 | * do this (on the now very obsolete FreeBSD 2.2.x series). The | ||
| 22 | * Darwin man page documents it as caddr_t but it appears to be | ||
| 23 | * implemented correctly as void *. caddr_t is usually char *. | ||
| 14 | */ | 24 | */ |
| 15 | 25 | ||
| 16 | 26 | ||
| @@ -20,8 +30,8 @@ | |||
| 20 | 30 | ||
| 21 | #include "mpm.h" | 31 | #include "mpm.h" |
| 22 | 32 | ||
| 23 | #if !defined(MPS_OS_O1) && !defined(MPS_OS_FR) && !defined(MPS_OS_XC) | 33 | #if !defined(MPS_OS_LI) && !defined(MPS_OS_FR) && !defined(MPS_OS_XC) && !defined(MPS_OS_O1) |
| 24 | #error "protix.c is Unix-specific, currently for MPS_OS_O1 FR or XC" | 34 | #error "protix.c is Unix-specific, currently for MPS_OS_LI FR XC O1" |
| 25 | #endif | 35 | #endif |
| 26 | #ifndef PROTECTION | 36 | #ifndef PROTECTION |
| 27 | #error "protix.c implements protection, but PROTECTION is not set" | 37 | #error "protix.c implements protection, but PROTECTION is not set" |
| @@ -69,7 +79,8 @@ void ProtSet(Addr base, Addr limit, AccessSet mode) | |||
| 69 | flags = PROT_NONE; | 79 | flags = PROT_NONE; |
| 70 | } | 80 | } |
| 71 | 81 | ||
| 72 | if(mprotect((caddr_t)base, (size_t)AddrOffset(base, limit), flags) != 0) | 82 | /* .assume.mprotect.base */ |
| 83 | if(mprotect((void *)base, (size_t)AddrOffset(base, limit), flags) != 0) | ||
| 73 | NOTREACHED; | 84 | NOTREACHED; |
| 74 | } | 85 | } |
| 75 | 86 | ||