blob: 5a4b4f0dbbb71345668a1ae786677eadd95ef852 [file] [log] [blame]
Reid Spencer437b0792004-09-15 05:47:40 +00001//===- Win32/Process.cpp - Win32 Process Implementation ------- -*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Jeff Cohen and is distributed under the
6// University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file provides the Win32 specific implementation of the Process class.
11//
12//===----------------------------------------------------------------------===//
13
14#include "Win32.h"
Reid Spencer437b0792004-09-15 05:47:40 +000015
16//===----------------------------------------------------------------------===//
17//=== WARNING: Implementation here must contain only Win32 specific code
18//=== and must not be UNIX code
19//===----------------------------------------------------------------------===//
20
21namespace llvm {
22using namespace sys;
23
24// This function retrieves the page size using GetSystemInfo and is present
25// solely so it can be called once in Process::GetPageSize to initialize the
26// static variable PageSize.
27inline unsigned GetPageSizeOnce() {
28 // NOTE: A 32-bit application running under WOW64 is supposed to use
29 // GetNativeSystemInfo. However, this interface is not present prior
30 // to Windows XP so to use it requires dynamic linking. It is not clear
31 // how this affects the reported page size, if at all. One could argue
32 // that LLVM ought to run as 64-bits on a 64-bit system, anyway.
33 SYSTEM_INFO info;
34 GetSystemInfo(&info);
35 return static_cast<unsigned>(info.dwPageSize);
36}
37
38unsigned
39Process::GetPageSize() {
40 static const unsigned PageSize = GetPageSizeOnce();
41 return PageSize;
42}
43
44}
45// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab