diff options
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/config.h | 31 | ||||
| -rw-r--r-- | mps/code/lockli.c | 6 | ||||
| -rw-r--r-- | mps/code/mpsi.c | 1 | ||||
| -rw-r--r-- | mps/code/mpstd.h | 14 | ||||
| -rw-r--r-- | mps/code/prmci3li.c | 9 | ||||
| -rw-r--r-- | mps/code/prmci6li.c | 9 | ||||
| -rw-r--r-- | mps/code/prmcix.h | 7 | ||||
| -rw-r--r-- | mps/code/pthrdext.c | 6 | ||||
| -rw-r--r-- | mps/code/vmix.c | 19 |
9 files changed, 60 insertions, 42 deletions
diff --git a/mps/code/config.h b/mps/code/config.h index 5172f57a9da..fefd57ed266 100644 --- a/mps/code/config.h +++ b/mps/code/config.h | |||
| @@ -330,6 +330,37 @@ | |||
| 330 | #define VMParamSize (sizeof(Word)) | 330 | #define VMParamSize (sizeof(Word)) |
| 331 | 331 | ||
| 332 | 332 | ||
| 333 | /* .feature.li: Linux feature specification | ||
| 334 | * | ||
| 335 | * The MPS needs the following symbols which are not defined if the | ||
| 336 | * -ansi option is given to GCC: | ||
| 337 | * | ||
| 338 | * Source Symbols Header Feature | ||
| 339 | * =========== ========================= ============= ==================== | ||
| 340 | * lockli.c pthread_mutexattr_settype <pthread.h> _XOPEN_SOURCE >= 500 | ||
| 341 | * prmci3li.c REG_EAX etc. <ucontext.h> _GNU_SOURCE | ||
| 342 | * prmci6li.c REG_RAX etc. <ucontext.h> _GNU_SOURCE | ||
| 343 | * prmcix.h stack_t, siginfo_t <signal.h> _XOPEN_SOURCE | ||
| 344 | * pthrdext.c sigaction etc. <signal.h> _XOPEN_SOURCE | ||
| 345 | * vmix.c MAP_ANON <sys/mman.h> _GNU_SOURCE | ||
| 346 | * | ||
| 347 | * Unfortunately it's not possible to localize these feature | ||
| 348 | * specifications around the individual headers: all headers share a | ||
| 349 | * common set of features (via <feature.h>) and so all sources in the | ||
| 350 | * same compilation unit must turn on the same set of features. | ||
| 351 | * | ||
| 352 | * See "Feature Test Macros" in the GCC Manual: | ||
| 353 | * <http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html> | ||
| 354 | */ | ||
| 355 | |||
| 356 | #if defined(MPS_OS_LI) | ||
| 357 | |||
| 358 | #define _XOPEN_SOURCE 500 | ||
| 359 | #define _GNU_SOURCE | ||
| 360 | |||
| 361 | #endif | ||
| 362 | |||
| 363 | |||
| 333 | /* Protection Configuration see <code/prot*.c> | 364 | /* Protection Configuration see <code/prot*.c> |
| 334 | 365 | ||
| 335 | For each architecture/OS that uses protix.c or protsgix.c, we need to | 366 | For each architecture/OS that uses protix.c or protsgix.c, we need to |
diff --git a/mps/code/lockli.c b/mps/code/lockli.c index 8bd03649bbf..06437b5b531 100644 --- a/mps/code/lockli.c +++ b/mps/code/lockli.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* lockli.c: RECURSIVE LOCKS FOR POSIX SYSTEMS | 1 | /* lockli.c: RECURSIVE LOCKS FOR POSIX SYSTEMS |
| 2 | * | 2 | * |
| 3 | * $Id$ | 3 | * $Id$ |
| 4 | * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. | 4 | * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. |
| 5 | * | 5 | * |
| 6 | * .linux: This implementation currently just supports LinuxThreads | 6 | * .linux: This implementation currently just supports LinuxThreads |
| 7 | * (platform MPS_OS_LI), Single Unix i/f. | 7 | * (platform MPS_OS_LI), Single Unix i/f. |
| @@ -26,7 +26,7 @@ | |||
| 26 | #include "lock.h" | 26 | #include "lock.h" |
| 27 | #include "config.h" | 27 | #include "config.h" |
| 28 | 28 | ||
| 29 | #include <pthread.h> | 29 | #include <pthread.h> /* see .feature.li in config.h */ |
| 30 | #include <semaphore.h> | 30 | #include <semaphore.h> |
| 31 | #include <errno.h> | 31 | #include <errno.h> |
| 32 | 32 | ||
| @@ -259,7 +259,7 @@ void LockReleaseGlobal(void) | |||
| 259 | 259 | ||
| 260 | /* C. COPYRIGHT AND LICENSE | 260 | /* C. COPYRIGHT AND LICENSE |
| 261 | * | 261 | * |
| 262 | * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>. | 262 | * Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>. |
| 263 | * All rights reserved. This is an open source license. Contact | 263 | * All rights reserved. This is an open source license. Contact |
| 264 | * Ravenbrook for commercial licensing options. | 264 | * Ravenbrook for commercial licensing options. |
| 265 | * | 265 | * |
diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index 746ba3e712d..e89577f9c67 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c | |||
| @@ -53,7 +53,6 @@ | |||
| 53 | #include "mpsavm.h" | 53 | #include "mpsavm.h" |
| 54 | 54 | ||
| 55 | #include <stdarg.h> | 55 | #include <stdarg.h> |
| 56 | #include <string.h> | ||
| 57 | 56 | ||
| 58 | 57 | ||
| 59 | SRCID(mpsi, "$Id$"); | 58 | SRCID(mpsi, "$Id$"); |
diff --git a/mps/code/mpstd.h b/mps/code/mpstd.h index 8298e98be26..410d7690f3b 100644 --- a/mps/code/mpstd.h +++ b/mps/code/mpstd.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* mpstd.h: RAVENBROOK MEMORY POOL SYSTEM TARGET DETECTION | 1 | /* mpstd.h: RAVENBROOK MEMORY POOL SYSTEM TARGET DETECTION |
| 2 | * | 2 | * |
| 3 | * $Id$ | 3 | * $Id$ |
| 4 | * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. | 4 | * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. |
| 5 | * Portions copyright (C) 2001 Global Graphics Software. | 5 | * Portions copyright (C) 2001 Global Graphics Software. |
| 6 | * | 6 | * |
| 7 | * Detect the target platform using predefined preprocessor symbols | 7 | * Detect the target platform using predefined preprocessor symbols |
| @@ -156,12 +156,6 @@ | |||
| 156 | #define MPS_WORD_SHIFT 5 | 156 | #define MPS_WORD_SHIFT 5 |
| 157 | #define MPS_PF_ALIGN 4 | 157 | #define MPS_PF_ALIGN 4 |
| 158 | 158 | ||
| 159 | #ifndef _REENTRANT /* it's also defined by cc -pthread */ | ||
| 160 | #define _REENTRANT /* defines, e.g., pthread_mutexattr_settype */ | ||
| 161 | #endif | ||
| 162 | #define _XOPEN_SOURCE 500 /* to get POSIX signal handling */ | ||
| 163 | #define _GNU_SOURCE /* to get register numbers for prmci3li.c */ | ||
| 164 | |||
| 165 | 159 | ||
| 166 | /* GCC 4.6.3, gcc -E -dM */ | 160 | /* GCC 4.6.3, gcc -E -dM */ |
| 167 | 161 | ||
| @@ -180,12 +174,6 @@ | |||
| 180 | #define MPS_WORD_SHIFT 6 | 174 | #define MPS_WORD_SHIFT 6 |
| 181 | #define MPS_PF_ALIGN 8 | 175 | #define MPS_PF_ALIGN 8 |
| 182 | 176 | ||
| 183 | #ifndef _REENTRANT /* it's also defined by cc -pthread */ | ||
| 184 | #define _REENTRANT /* defines, e.g., pthread_mutexattr_settype */ | ||
| 185 | #endif | ||
| 186 | #define _XOPEN_SOURCE 500 /* to get POSIX signal handling */ | ||
| 187 | #define _GNU_SOURCE /* to get register numbers for prmci3li.c */ | ||
| 188 | |||
| 189 | 177 | ||
| 190 | /* GCC 2.95.3, gcc -E -dM */ | 178 | /* GCC 2.95.3, gcc -E -dM */ |
| 191 | 179 | ||
diff --git a/mps/code/prmci3li.c b/mps/code/prmci3li.c index 5418a2ccd35..894df50e5f2 100644 --- a/mps/code/prmci3li.c +++ b/mps/code/prmci3li.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* prmci3li.c: PROTECTION MUTATOR CONTEXT INTEL 386 (LINUX) | 1 | /* prmci3li.c: PROTECTION MUTATOR CONTEXT INTEL 386 (LINUX) |
| 2 | * | 2 | * |
| 3 | * $Id$ | 3 | * $Id$ |
| 4 | * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. | 4 | * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. |
| 5 | * | 5 | * |
| 6 | * .purpose: This module implements the part of the protection module | 6 | * .purpose: This module implements the part of the protection module |
| 7 | * that decodes the MutatorFaultContext. | 7 | * that decodes the MutatorFaultContext. |
| @@ -41,8 +41,9 @@ MRef Prmci3AddressHoldingReg(MutatorFaultContext mfc, unsigned int regnum) | |||
| 41 | 41 | ||
| 42 | /* .source.i486 */ | 42 | /* .source.i486 */ |
| 43 | /* .assume.regref */ | 43 | /* .assume.regref */ |
| 44 | /* The REG_EAX etc. symbols are only present if _GNU_SOURCE is defined. | 44 | /* The register numbers (REG_EAX etc.) are defined in <ucontext.h> |
| 45 | Currently this is in lii3gc.gmk in PFMDEFS. */ | 45 | but only if _GNU_SOURCE is defined: see .feature.li in |
| 46 | config.h. */ | ||
| 46 | /* TODO: The current arrangement of the fix operation (taking a Ref *) | 47 | /* TODO: The current arrangement of the fix operation (taking a Ref *) |
| 47 | forces us to pun these registers (actually `int` on LII3GC). We can | 48 | forces us to pun these registers (actually `int` on LII3GC). We can |
| 48 | suppress the warning my casting through `char *` and this might make | 49 | suppress the warning my casting through `char *` and this might make |
| @@ -106,7 +107,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc) | |||
| 106 | 107 | ||
| 107 | /* C. COPYRIGHT AND LICENSE | 108 | /* C. COPYRIGHT AND LICENSE |
| 108 | * | 109 | * |
| 109 | * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>. | 110 | * Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>. |
| 110 | * All rights reserved. This is an open source license. Contact | 111 | * All rights reserved. This is an open source license. Contact |
| 111 | * Ravenbrook for commercial licensing options. | 112 | * Ravenbrook for commercial licensing options. |
| 112 | * | 113 | * |
diff --git a/mps/code/prmci6li.c b/mps/code/prmci6li.c index 48312e55aaa..6bba840928e 100644 --- a/mps/code/prmci6li.c +++ b/mps/code/prmci6li.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* prmci6li.c: PROTECTION MUTATOR CONTEXT x64 (LINUX) | 1 | /* prmci6li.c: PROTECTION MUTATOR CONTEXT x64 (LINUX) |
| 2 | * | 2 | * |
| 3 | * $Id$ | 3 | * $Id$ |
| 4 | * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. | 4 | * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. |
| 5 | * | 5 | * |
| 6 | * .purpose: This module implements the part of the protection module | 6 | * .purpose: This module implements the part of the protection module |
| 7 | * that decodes the MutatorFaultContext. | 7 | * that decodes the MutatorFaultContext. |
| @@ -41,8 +41,9 @@ MRef Prmci6AddressHoldingReg(MutatorFaultContext mfc, unsigned int regnum) | |||
| 41 | gregs = (Word *)&mfc->ucontext->uc_mcontext.gregs; | 41 | gregs = (Word *)&mfc->ucontext->uc_mcontext.gregs; |
| 42 | 42 | ||
| 43 | /* .assume.regref */ | 43 | /* .assume.regref */ |
| 44 | /* The REG_EAX etc. symbols are only present if _GNU_SOURCE is defined. | 44 | /* The register numbers (REG_RAX etc.) are defined in <ucontext.h> |
| 45 | * Currently this is in lii6gc.gmk in PFMDEFS. */ | 45 | but only if _GNU_SOURCE is defined: see .feature.li in |
| 46 | config.h. */ | ||
| 46 | switch (regnum) { | 47 | switch (regnum) { |
| 47 | case 0: return &gregs[REG_RAX]; | 48 | case 0: return &gregs[REG_RAX]; |
| 48 | case 1: return &gregs[REG_RCX]; | 49 | case 1: return &gregs[REG_RCX]; |
| @@ -110,7 +111,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc) | |||
| 110 | 111 | ||
| 111 | /* C. COPYRIGHT AND LICENSE | 112 | /* C. COPYRIGHT AND LICENSE |
| 112 | * | 113 | * |
| 113 | * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>. | 114 | * Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>. |
| 114 | * All rights reserved. This is an open source license. Contact | 115 | * All rights reserved. This is an open source license. Contact |
| 115 | * Ravenbrook for commercial licensing options. | 116 | * Ravenbrook for commercial licensing options. |
| 116 | * | 117 | * |
diff --git a/mps/code/prmcix.h b/mps/code/prmcix.h index a5781118607..684be0d452e 100644 --- a/mps/code/prmcix.h +++ b/mps/code/prmcix.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* prmcix.h: PROTECTION MUTATOR CONTEXT (UNIX) | 1 | /* prmcix.h: PROTECTION MUTATOR CONTEXT (UNIX) |
| 2 | * | 2 | * |
| 3 | * $Id$ | 3 | * $Id$ |
| 4 | * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. | 4 | * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. |
| 5 | * | 5 | * |
| 6 | * .readership: MPS developers. | 6 | * .readership: MPS developers. |
| 7 | */ | 7 | */ |
| @@ -11,7 +11,8 @@ | |||
| 11 | 11 | ||
| 12 | #include "mpm.h" | 12 | #include "mpm.h" |
| 13 | 13 | ||
| 14 | #include <ucontext.h> | 14 | #include <signal.h> /* siginfo_t -- see .feature.li in config.h */ |
| 15 | #include <ucontext.h> /* ucontext_t */ | ||
| 15 | 16 | ||
| 16 | typedef struct MutatorFaultContextStruct { /* Protection fault context data */ | 17 | typedef struct MutatorFaultContextStruct { /* Protection fault context data */ |
| 17 | siginfo_t *info; | 18 | siginfo_t *info; |
| @@ -24,7 +25,7 @@ typedef struct MutatorFaultContextStruct { /* Protection fault context data */ | |||
| 24 | 25 | ||
| 25 | /* C. COPYRIGHT AND LICENSE | 26 | /* C. COPYRIGHT AND LICENSE |
| 26 | * | 27 | * |
| 27 | * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>. | 28 | * Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>. |
| 28 | * All rights reserved. This is an open source license. Contact | 29 | * All rights reserved. This is an open source license. Contact |
| 29 | * Ravenbrook for commercial licensing options. | 30 | * Ravenbrook for commercial licensing options. |
| 30 | * | 31 | * |
diff --git a/mps/code/pthrdext.c b/mps/code/pthrdext.c index 934a0a646a0..8a027edb3b7 100644 --- a/mps/code/pthrdext.c +++ b/mps/code/pthrdext.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* pthreadext.c: POSIX THREAD EXTENSIONS | 1 | /* pthreadext.c: POSIX THREAD EXTENSIONS |
| 2 | * | 2 | * |
| 3 | * $Id$ | 3 | * $Id$ |
| 4 | * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. | 4 | * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. |
| 5 | * | 5 | * |
| 6 | * .purpose: Provides extension to Pthreads. | 6 | * .purpose: Provides extension to Pthreads. |
| 7 | * | 7 | * |
| @@ -17,7 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | #include <pthread.h> | 18 | #include <pthread.h> |
| 19 | #include <sched.h> | 19 | #include <sched.h> |
| 20 | #include <signal.h> | 20 | #include <signal.h> /* see .feature.li in config.h */ |
| 21 | #include <semaphore.h> | 21 | #include <semaphore.h> |
| 22 | #include <errno.h> | 22 | #include <errno.h> |
| 23 | #include <stdio.h> | 23 | #include <stdio.h> |
| @@ -365,7 +365,7 @@ unlock: | |||
| 365 | 365 | ||
| 366 | /* C. COPYRIGHT AND LICENSE | 366 | /* C. COPYRIGHT AND LICENSE |
| 367 | * | 367 | * |
| 368 | * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>. | 368 | * Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>. |
| 369 | * All rights reserved. This is an open source license. Contact | 369 | * All rights reserved. This is an open source license. Contact |
| 370 | * Ravenbrook for commercial licensing options. | 370 | * Ravenbrook for commercial licensing options. |
| 371 | * | 371 | * |
diff --git a/mps/code/vmix.c b/mps/code/vmix.c index 2b7afb514c2..9b06f09b032 100644 --- a/mps/code/vmix.c +++ b/mps/code/vmix.c | |||
| @@ -18,11 +18,11 @@ | |||
| 18 | * (MAP_PRIVATE) mapping with the flag MAP_ANON. | 18 | * (MAP_PRIVATE) mapping with the flag MAP_ANON. |
| 19 | * | 19 | * |
| 20 | * .non-standard: Note that the MAP_ANON flag is non-standard; it is | 20 | * .non-standard: Note that the MAP_ANON flag is non-standard; it is |
| 21 | * available on Darwin and FreeBSD. .non-standard.linux: Linux | 21 | * available on Darwin and FreeBSD. .non-standard.linux: Linux seems |
| 22 | * seems to use MAP_ANONYMOUS instead. Some Linux systems make MAP_ANON | 22 | * to use MAP_ANONYMOUS instead. Some Linux systems make MAP_ANON |
| 23 | * available and deprecate it. .non-standard.sesame: On Linux getting | 23 | * available and deprecate it. .non-standard.sesame: On Linux getting |
| 24 | * a definition of MAP_ANON requires a macro to be defined prior to | 24 | * a definition of MAP_ANON requires a _BSD_SOURCE to be defined prior |
| 25 | * <sys/mman.h>. | 25 | * to <sys/mman.h>; see config.h. |
| 26 | * | 26 | * |
| 27 | * .assume.not-last: The implementation of VMCreate assumes that | 27 | * .assume.not-last: The implementation of VMCreate assumes that |
| 28 | * mmap() will not choose a region which contains the last page | 28 | * mmap() will not choose a region which contains the last page |
| @@ -38,12 +38,11 @@ | |||
| 38 | * seem to be a problem. | 38 | * seem to be a problem. |
| 39 | */ | 39 | */ |
| 40 | 40 | ||
| 41 | /* .non-standard.sesame */ | 41 | #include "mpm.h" |
| 42 | #define _BSD_SOURCE 1 | ||
| 43 | 42 | ||
| 44 | /* for mmap(2), munmap(2) */ | 43 | /* for mmap(2), munmap(2) */ |
| 45 | #include <sys/types.h> | 44 | #include <sys/types.h> |
| 46 | #include <sys/mman.h> | 45 | #include <sys/mman.h> /* see .feature.li in config.h */ |
| 47 | 46 | ||
| 48 | /* for errno(2) */ | 47 | /* for errno(2) */ |
| 49 | #include <errno.h> | 48 | #include <errno.h> |
| @@ -51,8 +50,6 @@ | |||
| 51 | /* for getpagesize(3) */ | 50 | /* for getpagesize(3) */ |
| 52 | #include <unistd.h> | 51 | #include <unistd.h> |
| 53 | 52 | ||
| 54 | #include "mpm.h" | ||
| 55 | |||
| 56 | 53 | ||
| 57 | #if !defined(MPS_OS_FR) && !defined(MPS_OS_XC) && !defined(MPS_OS_LI) | 54 | #if !defined(MPS_OS_FR) && !defined(MPS_OS_XC) && !defined(MPS_OS_LI) |
| 58 | #error "vmix.c is Unix-like specific, currently MPS_OS_FR XC LI" | 55 | #error "vmix.c is Unix-like specific, currently MPS_OS_FR XC LI" |
| @@ -322,7 +319,7 @@ void VMUnmap(VM vm, Addr base, Addr limit) | |||
| 322 | 319 | ||
| 323 | /* C. COPYRIGHT AND LICENSE | 320 | /* C. COPYRIGHT AND LICENSE |
| 324 | * | 321 | * |
| 325 | * Copyright (C) 2001-2007 Ravenbrook Limited <http://www.ravenbrook.com/>. | 322 | * Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>. |
| 326 | * All rights reserved. This is an open source license. Contact | 323 | * All rights reserved. This is an open source license. Contact |
| 327 | * Ravenbrook for commercial licensing options. | 324 | * Ravenbrook for commercial licensing options. |
| 328 | * | 325 | * |