ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

common_ppc.c
Go to the documentation of this file.
00001 /*
00002  * (C) Copyright IBM Corporation 2004
00003  * All Rights Reserved.
00004  *
00005  * Permission is hereby granted, free of charge, to any person obtaining a
00006  * copy of this software and associated documentation files (the "Software"),
00007  * to deal in the Software without restriction, including without limitation
00008  * on the rights to use, copy, modify, merge, publish, distribute, sub
00009  * license, and/or sell copies of the Software, and to permit persons to whom
00010  * the Software is furnished to do so, subject to the following conditions:
00011  *
00012  * The above copyright notice and this permission notice (including the next
00013  * paragraph) shall be included in all copies or substantial portions of the
00014  * Software.
00015  *
00016  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
00019  * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
00020  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
00021  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
00022  * USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00033 #include <stdio.h>
00034 #include <unistd.h>
00035 #include <sys/types.h>
00036 
00037 #ifdef USE_PPC_ASM
00038 #include <elf.h>
00039 #endif
00040 
00041 #include "common_ppc_features.h"
00042 
00043 
00044 unsigned long _mesa_ppc_cpu_features = 0;
00045 
00056 void _mesa_init_all_ppc_transform_asm( void )
00057 {
00058 #ifdef USE_PPC_ASM
00059    const pid_t  my_pid = getpid();
00060    char file_name[32];
00061    FILE * f;
00062 #ifdef __powerpc64__
00063    Elf64_auxv_t  v;
00064 #else
00065    Elf32_auxv_t  v;
00066 #endif
00067 
00068    sprintf( file_name, "/proc/%u/auxv", (unsigned) my_pid );
00069    f = fopen( file_name, "rb" );
00070    if ( f != NULL ) {
00071       while( 1 ) {
00072      ssize_t elem = fread( & v, sizeof( v ), 1, f );
00073 
00074      if ( elem < 1 ) {
00075         break;
00076      }
00077 
00078      if ( v.a_type == AT_HWCAP ) {
00079         _mesa_ppc_cpu_features = v.a_un.a_val;
00080         break;
00081      }
00082       }
00083 
00084       fclose( f );
00085    }
00086    
00087 # ifndef USE_VMX_ASM
00088    _mesa_ppc_cpu_features &= ~PPC_FEATURES_HAS_ALTIVEC;
00089 # endif
00090 #endif
00091 }

Generated on Fri May 25 2012 04:18:44 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.