00001 #ifndef _arch_h_included_ 00002 #define _arch_h_included_ 00003 00004 /*! 00005 * @file arch.h 00006 * 00007 * @brief Global project definitions for name, version, copyright, 00008 * license, global configuration, and architectural features. 00009 * 00010 * Derive specific architectural definitions from configuration 00011 * parameters set up in @link config/config.h config.h@endlink and 00012 * present them for normative use by the compiler. Also global 00013 * constant strings for several purposes. 00014 * 00015 * Define critical symbols as tested below. 00016 * This is done by the @link ./config.sh config.sh@endlink script. 00017 * 00018 * <b>DO NOT FORGET</b> to use the GCC options found 00019 * in @b ../config/confopts.gcc on the GCC command 00020 * line! This can be done as, 00021 * @verbatim 00022 00023 $ gcc `cat ../config/config_opts_always.gcc` \ 00024 `cat ../config/config_opts_usually.gcc` \ 00025 -otheropts -c filename.c ... 00026 00027 $ gcc `cat ../config/config_opts_always.gccld` \ 00028 ... *.o -o targetbinary 00029 00030 @endverbatim 00031 * 00032 * @todo There needs to be a Java equivalent written for the 00033 * macros @link ##ARCH_COPYRIGHT_TEXT_APACHE 00034 ARCH_COPYRIGHT_TEXT_APACHE@endlink, @link 00035 #ARCH_LICENSE_TEXT_APACHE ARCH_LICENSE_TEXT_APACHE@endlink, 00036 * and @link #ARCH_COPYRIGHT_APACHE ARCH_COPYRIGHT_APACHE()@endlink 00037 * 00038 * @section Control 00039 * 00040 * \$URL: https://svn.apache.org/harmony/project/arch.h $ \$Id: arch.h 0 09/28/2005 dlydick $ 00041 * 00042 * Copyright 2005 The Apache Software Foundation 00043 * or its licensors, as applicable. 00044 * 00045 * Licensed under the Apache License, Version 2.0 ("the License"); 00046 * you may not use this file except in compliance with the License. 00047 * You may obtain a copy of the License at 00048 * 00049 * http://www.apache.org/licenses/LICENSE-2.0 00050 * 00051 * Unless required by applicable law or agreed to in writing, 00052 * software distributed under the License is distributed on an 00053 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 00054 * either express or implied. 00055 * 00056 * See the License for the specific language governing permissions 00057 * and limitations under the License. 00058 * 00059 * @version \$LastChangedRevision: 0 $ 00060 * 00061 * @date \$LastChangedDate: 09/28/2005 $ 00062 * 00063 * @author \$LastChangedBy: dlydick $ 00064 * Original code contributed by Daniel Lydick on 09/28/2005. 00065 * 00066 * @section Reference 00067 * 00068 */ 00069 00070 00071 /*! 00072 * @def ARCH_COPYRIGHT_TEXT_APACHE 00073 * 00074 * @brief Copyright declaration string for the Apache Software 00075 * Foundation for all files in program. 00076 * 00077 */ 00078 00079 #define ARCH_COPYRIGHT_TEXT_APACHE \ 00080 "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." 00081 00082 00083 /*! 00084 * @def ARCH_LICENSE_TEXT_APACHE 00085 * 00086 * @brief License declaration string for the Apache Software 00087 * Foundation for all files in program. 00088 * 00089 */ 00090 00091 #define ARCH_LICENSE_TEXT_APACHE \ 00092 "Licensed under the Apache License, Version 2.0 (\"the License\");\n\ 00093 you may not use this file except in compliance with the License.\n\ 00094 You may obtain a copy of the License at\n\ 00095 \n\ 00096 http://www.apache.org/licenses/LICENSE-2.0\n\ 00097 \n\ 00098 Unless required by applicable law or agreed to in writing,\n\ 00099 software distributed under the License is distributed on an\n\ 00100 \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n\ 00101 either express or implied.\n\ 00102 \n\ 00103 See the License for the specific language governing permissions\n\ 00104 and limitations under the License." 00105 00106 00107 /*! 00108 * @def ARCH_COPYRIGHT_APACHE() 00109 * 00110 * @brief Copyright declaration macro for the Apache Software Foundation 00111 * for all files in program. 00112 * 00113 * This macro declares the copyright by the Apache Software Foundation 00114 * for all source files. 00115 * 00116 * Declare a static string containing SVN info plus copyright and 00117 * declare a static function that references the string, plus a 00118 * local that recursively calls the function. This function is 00119 * used to satisfy the compiler that the static string is being 00120 * referenced without also generating a similar message about the 00121 * static function not being referenced. 00122 * 00123 * @param filetoken Any string that, when concatenated with an 00124 * underscore (_) and the @p @b exttoken parameter, 00125 * forms a globally unique combination. This 00126 * is typically the file name itself without 00127 * the file extension name, unquoted. 00128 * 00129 * @param exttoken Any string that, when the @p @b filetoken 00130 * parameter and an underscore (_) are concatenated 00131 * before it, forms a globally unique combination. 00132 * This is typically the file extension name itself 00133 * without the file name, unquoted. 00134 * 00135 * @param svnidstring Source code management token representing 00136 * as much information about the file as is 00137 * desired to insert into the static copyright 00138 * string for each source file and header file. 00139 * For RCS and CVS systems, this would typically 00140 * be the <b>@$<code>Header:</code> @$</b> token, 00141 * in double quotes. As currently managed in 00142 * the Apache SVN repository, it contains the string 00143 * "<b>@$<code>URL:</code> @$ @$<code>Id:</code> @$</b>" 00144 * 00145 * 00146 * @returns @link #rvoid rvoid@endlink 00147 * 00148 * 00149 * @internal The @c @b svnidstring parameter contains highly mangled 00150 * source code control keyword strings. They are mangled so 00151 * as to hide them from version control substitution, yet 00152 * display in the compiled documentation correctly. 00153 * 00154 * @internal The initial ASCII \\0 (NUL) character is inserted to 00155 * guarantee that the string itself will @e never be 00156 * appended to some previous text-type data, thus not 00157 * being the beginning of a string for search purposes 00158 * in the output (binary) form of the file invoking the macro. 00159 * Refer to @link ./getsvndata.sh getsvndata.sh@endlink 00160 * for more information. 00161 * 00162 */ 00163 00164 #define ARCH_COPYRIGHT_APACHE(filetoken, exttoken, svnidstring) \ 00165 static char *filetoken##_##exttoken##_copyright = "\0" svnidstring \ 00166 " " ARCH_COPYRIGHT_TEXT_APACHE; \ 00167 \ 00168 static void filetoken##_##exttoken##_dummy(void) { \ 00169 char *p = filetoken##_##exttoken##_copyright; \ 00170 filetoken##_##exttoken##_copyright = p; \ 00171 filetoken##_##exttoken##_dummy(); } 00172 00173 /*! 00174 * @brief Static copyright string for @e this source file. 00175 * 00176 */ 00177 ARCH_COPYRIGHT_APACHE(arch, h, "$URL: https://svn.apache.org/harmony/project/arch.h $ $Id: arch.h 0 09/28/2005 dlydick $"); 00178 00179 #include "config.h" 00180 00181 /*! 00182 * Definition of platform architectures, 00183 * including machine hardware type and 00184 * operating system type. 00185 * 00186 * These symbols control various compilation 00187 * constructs such as integer word width and 00188 * endianness. 00189 * 00190 * One of these deals with real machine architecture, 00191 * the other with operating system. It is up to YOU 00192 * to make sure that both are valid and work together. 00193 * For example, CONFIG_SPARC32 works with CONFIG_SOLARIS32 00194 * and CONFIG_LINUX32, but not with CONFIG_WINDOWS64. 00195 * 00196 * One of these MUST be defined on the compile 00197 * line: 00198 * 00199 * CONFIG_SPARC32 Sun Sparc architecture, 32-bit word 00200 * CONFIG_SPARC64 Sun Sparc architecture, 64-bit word 00201 * 00202 * CONFIG_INTEL32 Intel x86 architecture, 32-bit word 00203 * CONFIG_INTEL64 Intel x86 architecture, 64-bit word 00204 * 00205 * 00206 * ... others as available ... 00207 * 00208 * 00209 * One of these MUST be defined on the compile 00210 * line: 00211 * 00212 * CONFIG_SOLARIS32 Sun Solaris, 32-bit word 00213 * CONFIG_SOLARIS64 Sun Solaris, 64-bit word 00214 * 00215 * CONFIG_LINUX32 Linux operating system, 32-bit word 00216 * CONFIG_LINUX64 Linux operating system, 64-bit word 00217 * 00218 * CONFIG_WINDOWS32 Microsoft Windows operating system, 32-bit word 00219 * CONFIG_WINDOWS64 Microsoft Windows operating system, 64-bit word 00220 * 00221 * 00222 * ... others as available ... 00223 * 00224 * 00225 */ 00226 00227 /*! 00228 * @internal Demand that EXACTLY ONE hardware architecture be defined 00229 */ 00230 00231 #ifdef CONFIG_SPARC32 00232 #define _ARCH_DEFINED_ 00233 #endif 00234 00235 #ifdef CONFIG_SPARC64 00236 #ifdef _ARCH_DEFINED_ 00237 #error "Multiple machine architectures defined" 00238 #else 00239 #define _ARCH_DEFINED_ 00240 #endif 00241 #endif 00242 00243 #ifdef CONFIG_INTEL32 00244 #ifdef _ARCH_DEFINED_ 00245 #error "Multiple machine architectures defined" 00246 #else 00247 #define _ARCH_DEFINED_ 00248 #endif 00249 #endif 00250 00251 #ifdef CONFIG_INTEL64 00252 #ifdef _ARCH_DEFINED_ 00253 #error "Multiple machine architectures defined" 00254 #else 00255 #define _ARCH_DEFINED_ 00256 #endif 00257 #endif 00258 00259 /*! 00260 * @internal Check that that EXACTLY ONE architecture has been defined 00261 */ 00262 #ifndef _ARCH_DEFINED_ 00263 #error "Need to explicitly define a machine architecture" 00264 #endif 00265 00266 00267 /* Demand that EXACTLY ONE software architecture be defined */ 00268 #undef _ARCH_DEFINED_ 00269 00270 #ifdef CONFIG_SOLARIS32 00271 #define _ARCH_DEFINED_ 00272 #endif 00273 00274 #ifdef CONFIG_SOLARIS64 00275 #ifdef _ARCH_DEFINED_ 00276 #error "Multiple OS architectures defined" 00277 #else 00278 #define _ARCH_DEFINED_ 00279 #endif 00280 #endif 00281 00282 #ifdef CONFIG_LINUX32 00283 #ifdef _ARCH_DEFINED_ 00284 #error "Multiple OS architectures defined" 00285 #else 00286 #define _ARCH_DEFINED_ 00287 #endif 00288 #endif 00289 00290 #ifdef CONFIG_LINUX64 00291 #ifdef _ARCH_DEFINED_ 00292 #error "Multiple OS architectures defined" 00293 #else 00294 #define _ARCH_DEFINED_ 00295 #endif 00296 #endif 00297 00298 #ifdef CONFIG_WINDOWS32 00299 #ifdef _ARCH_DEFINED_ 00300 #error "Multiple OS architectures defined" 00301 #else 00302 #define _ARCH_DEFINED_ 00303 #endif 00304 #endif 00305 00306 #ifdef CONFIG_WINDOWS64 00307 #ifdef _ARCH_DEFINED_ 00308 #error "Multiple OS architectures defined" 00309 #else 00310 #define _ARCH_DEFINED_ 00311 #endif 00312 #endif 00313 00314 /*! 00315 * @internal Check that that EXACTLY ONE architecture has been defined 00316 */ 00317 #ifdef _ARCH_DEFINED_ 00318 /*! 00319 * @internal Make available, especially to 00320 * @link jvm/src/jvmcfg.h jvmcfg.h@endlink 00321 * 00322 */ 00323 #define _VALID_ARCH_DEFINED_ 00324 #else 00325 #error "Need to explicitly define an OS architecture" 00326 #endif 00327 #undef _ARCH_DEFINED_ 00328 00329 /*! 00330 * @def ARCH_ODD4_ADDRESS_SIGSEGV 00331 * @brief Check architectural hardware error oddities related to 00332 * even/odd byte addressing. 00333 * 00334 * The behavioral oddities to be flagged for a specific architecture 00335 * include: 00336 * 00337 * <ul> 00338 * <li> 00339 * @b ARCH_ODD2_ADDRESS_SIGSEGV ... When a 2-byte access causes 00340 * @b SIGSEGV on a read or write 00341 * operation. 00342 * </li> 00343 * 00344 * <li> 00345 * @b ARCH_ODD4_ADDRESS_SIGSEGV ... When a 4-byte access causes 00346 * SIGSEGV on a read or write 00347 * operation. This will also mean 00348 * that a 2-byte access will also 00349 * cause @b SIGSEGV. 00350 * </li> 00351 * 00352 * <li> 00353 * @b xyz ... Your favorite bug is defined here... 00354 * </li> 00355 * </ul> 00356 * 00357 */ 00358 00359 #ifdef CONFIG_SOLARIS32 00360 #define ARCH_ODD4_ADDRESS_SIGSEGV 00361 #endif 00362 00363 /*! 00364 * @def ARCH_ODD2_ADDRESS_SIGSEGV 00365 * @brief See @link 00366 * #ARCH_ODD4_ADDRESS_SIGSEGV ARCH_ODD4_ADDRESS_SIGSEGV@endlink. 00367 */ 00368 /* rm this if/endif when there is an architecture that needs only ODD2*/ 00369 #if 0 00370 #ifdef CONFIG_SOLARIS32 00371 #define ARCH_ODD2_ADDRESS_SIGSEGV 00372 #endif 00373 #endif 00374 00375 /* 00376 * ... Define other issues here ... 00377 */ 00378 00379 00380 00381 /*********** End of unique definitions. Start derived definitions ****/ 00382 00383 00384 /* Endianness of real machine word */ 00385 00386 #ifdef CONFIG_INTEL 00387 /*! 00388 * @def ARCH_LITTLE_ENDIAN 00389 * @brief Defined only for little endian architectures, in opposition 00390 * to @link #ARCH_BIG_ENDIAN ARCH_BIG_ENDIAN@endlink. 00391 * 00392 * Used by swapping functions in 00393 * @link jvm/src/bytegames.c bytegames.c@endlink and 00394 * derived macros in @link jvm/src/cfmacros.h cfmacros.h@endlink. 00395 */ 00396 #define ARCH_LITTLE_ENDIAN 00397 #else 00398 /*! 00399 * @def ARCH_BIG_ENDIAN 00400 * @brief Defined only for big endian architectures, in opposition 00401 * to @link #ARCH_LITTLE_ENDIAN ARCH_LITTLE_ENDIAN@endlink. 00402 * 00403 * Used by swapping functions in 00404 * @link jvm/src/bytegames.c bytegames.c@endlink and 00405 * derived macros in @link jvm/src/cfmacros.h cfmacros.h@endlink. 00406 */ 00407 #define ARCH_BIG_ENDIAN 00408 #endif 00409 00410 /*! 00411 * @brief Define more general case of odd-address @b SIGSEGV. 00412 * 00413 * If either ARCH_ODD4_ADDRESS_SIGSEGV or ARCH_ODD2_ADDRESS_SIGSEGV 00414 * are defined, then this symbol is also defined as a union of the 00415 * definitions. 00416 */ 00417 #ifdef ARCH_ODD4_ADDRESS_SIGSEGV 00418 #define ARCH_ODD_ADDRESS_SIGSEGV 00419 #else 00420 #ifdef ARCH_ODD2_ADDRESS_SIGSEGV 00421 #define ARCH_ODD_ADDRESS_SIGSEGV 00422 #endif 00423 #endif 00424 00425 #endif /* _arch_h_included_ */ 00426 00427 /* EOF */ 00428