Index: Source/kwsys/SystemInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemInformation.cxx,v
retrieving revision 1.37
diff -p -u -r1.37 SystemInformation.cxx
--- Source/kwsys/SystemInformation.cxx	15 Dec 2008 22:19:26 -0000	1.37
+++ Source/kwsys/SystemInformation.cxx	10 Feb 2009 21:27:33 -0000
@@ -62,6 +62,10 @@
 # include <sys/pstat.h>
 #endif
 
+#ifdef __HAIKU__
+#include <OS.h>
+#endif
+
 #include <memory.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -242,6 +246,9 @@ protected:
   kwsys_stl::string ParseValueFromKStat(const char* arguments);
   kwsys_stl::string RunProcess(kwsys_stl::vector<const char*> args);
 
+  //For Haiku OS
+  bool QueryHaikuInfo();
+
   // Evaluate the memory information.
   int QueryMemory();
   unsigned long TotalVirtualMemory;
@@ -535,6 +542,8 @@ void SystemInformationImplementation::Ru
   this->ParseSysCtl();
 #elif defined (__SVR4) && defined (__sun)
   this->QuerySolarisInfo();
+#elif defined(__HAIKU__)
+  this->QueryHaikuInfo();
 #else
   this->RetreiveInformationFromCpuInfoFile();
 #endif
@@ -2937,6 +2946,73 @@ bool SystemInformationImplementation::Qu
   return true;
 }
 
+/** Querying for system information from Haiku OS */
+bool SystemInformationImplementation::QueryHaikuInfo()
+{
+#if defined(__HAIKU__)
+
+  system_info info;
+  get_system_info(&info);
+  
+  this->NumberOfPhysicalCPU = info.cpu_count;
+  this->CPUSpeedInMHz = info.cpu_clock_speed;
+
+  // Physical Memory
+  this->TotalPhysicalMemory = info.max_pages * B_PAGE_SIZE;
+  this->AvailablePhysicalMemory = this->TotalPhysicalMemory - (info.used_pages * B_PAGE_SIZE);
+
+  // Swap/Virtual Memory
+  //system_memory_info mem_info;
+  //get_system_info_etc(B_MEMORY_INFO,  &mem_info, sizeof(system_memory_info));
+  //this->TotalVirtualMemory = info.max_swap_space;
+  //this->AvailableVirtualMemory = info.free_swap_space;
+  
+  //get_system_info_etc is currently a private call so just set to 0 until it becomes public
+  this->TotalVirtualMemory = 0;
+  this->AvailableVirtualMemory = 0;
+
+  // Retrieve cpuid_info union for cpu 0
+  cpuid_info cpu_info;
+  get_cpuid(&cpu_info, 0, 0);
+
+  // Chip Vendor
+  strcpy(this->ChipID.Vendor,cpu_info.eax_0.vendor_id);
+  this->FindManufacturer();
+
+  // Retrieve cpuid_info union for cpu 0 this time using a register value of 1
+  get_cpuid(&cpu_info, 1, 0);
+
+  this->NumberOfLogicalCPU = cpu_info.eax_1.logical_cpus;
+
+  // Chip type
+  this->ChipID.Type = cpu_info.eax_1.type;
+
+  // Chip family
+  this->ChipID.Family = cpu_info.eax_1.family; 
+  
+  // Chip Model
+  this->ChipID.Model = cpu_info.eax_1.model;
+
+  // Chip Revision
+  this->ChipID.Revision = cpu_info.eax_1.stepping;
+
+  // Chip Extended Family
+  this->ChipID.ExtendedFamily = cpu_info.eax_1.extended_family;
+
+  // Chip Extended Model
+  this->ChipID.ExtendedModel = cpu_info.eax_1.extended_model;
+
+  // Get ChipID.ProcessorName from other information already gathered
+  this->RetrieveClassicalCPUIdentity();
+
+  // Cache size
+  this->Features.L1CacheSize = 0;
+  this->Features.L2CacheSize = 0;
+
+#endif
+  return true;
+}
+
 /** Query the operating system information */
 bool SystemInformationImplementation::QueryOSInformation()
 {
