blob: 6157258210757e8ca024af9fbaf639574b48ab65 [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"
15#include "llvm/System/Process.h"
16
17//===----------------------------------------------------------------------===//
18//=== WARNING: Implementation here must contain only Win32 specific code
19//=== and must not be UNIX code
20//===----------------------------------------------------------------------===//
21
22namespace llvm {
23using namespace sys;
24
25// This function retrieves the page size using GetSystemInfo and is present
26// solely so it can be called once in Process::GetPageSize to initialize the
27// static variable PageSize.
28inline unsigned GetPageSizeOnce() {
29 // NOTE: A 32-bit application running under WOW64 is supposed to use
30 // GetNativeSystemInfo. However, this interface is not present prior
31 // to Windows XP so to use it requires dynamic linking. It is not clear
32 // how this affects the reported page size, if at all. One could argue
33 // that LLVM ought to run as 64-bits on a 64-bit system, anyway.
34 SYSTEM_INFO info;
35 GetSystemInfo(&info);
36 return static_cast<unsigned>(info.dwPageSize);
37}
38
39unsigned
40Process::GetPageSize() {
41 static const unsigned PageSize = GetPageSizeOnce();
42 return PageSize;
43}
44
45}
46// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab