LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Win32/Process.cpp

Go to the documentation of this file.
00001 //===- Win32/Process.cpp - Win32 Process Implementation ------- -*- C++ -*-===//
00002 // 
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by Jeff Cohen and is distributed under the 
00006 // University of Illinois Open Source License. See LICENSE.TXT for details.
00007 // 
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file provides the Win32 specific implementation of the Process class.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "Win32.h"
00015 
00016 //===----------------------------------------------------------------------===//
00017 //=== WARNING: Implementation here must contain only Win32 specific code 
00018 //===          and must not be UNIX code
00019 //===----------------------------------------------------------------------===//
00020 
00021 namespace llvm {
00022 using namespace sys;
00023 
00024 // This function retrieves the page size using GetSystemInfo and is present
00025 // solely so it can be called once in Process::GetPageSize to initialize the
00026 // static variable PageSize.
00027 inline unsigned GetPageSizeOnce() {
00028   // NOTE: A 32-bit application running under WOW64 is supposed to use
00029   // GetNativeSystemInfo.  However, this interface is not present prior
00030   // to Windows XP so to use it requires dynamic linking.  It is not clear
00031   // how this affects the reported page size, if at all.  One could argue
00032   // that LLVM ought to run as 64-bits on a 64-bit system, anyway.
00033   SYSTEM_INFO info;
00034   GetSystemInfo(&info);
00035   return static_cast<unsigned>(info.dwPageSize);
00036 }
00037 
00038 unsigned 
00039 Process::GetPageSize() {
00040   static const unsigned PageSize = GetPageSizeOnce();
00041   return PageSize;
00042 }
00043 
00044 }
00045 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab