~n-muench/ubuntu/precise/open-vm-tools/open-vm-tools-precise.sid-merge1

« back to all changes in this revision

Viewing changes to lib/misc/hostinfo.c

  • Committer: Bazaar Package Importer
  • Author(s): Nate Muench
  • Date: 2010-09-06 21:06:01 UTC
  • mfrom: (2.4.19 sid)
  • Revision ID: james.westby@ubuntu.com-20100906210601-gxxy30e5roil4srt
Tags: 2010.06.16-268169-3ubuntu1
* Merge from Debian testing (LP: #632101), remaining changes:
  - Recommend open-vm-toolbox in open-vm-tools.
  - Rediffing vsock.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
 *          80000008:00003024000000000000000000000000-
130
130
 *
131
131
 *       The returned eax of args[0] is used to determine the upper bound for
132
 
 *       the following input arguments. And the input args should be in ascending
133
 
 *       order.
 
132
 *       the following input arguments. And the input args should be in
 
133
 *       ascending order.
134
134
 *
135
135
 * Results:
136
136
 *       None. The string will be appended in buf.
155
155
   __GET_CPUID(args[0], &reg);
156
156
   max_arg = reg.eax;
157
157
   if (max_arg < args[0]) {
158
 
      Warning(LGPFX" No CPUID information available. Based = %08X.\n", args[0]);
 
158
      Warning(LGPFX" No CPUID information available. Based = %08X.\n",
 
159
              args[0]);
159
160
      return;
160
161
   }
161
162
   DynBuf_Append(buf, temp,
162
 
      Str_Sprintf(temp, sizeof temp, format, args[0], reg.eax, reg.ebx, reg.ecx, reg.edx));
 
163
                 Str_Sprintf(temp, sizeof temp, format, args[0], reg.eax,
 
164
                             reg.ebx, reg.ecx, reg.edx));
163
165
 
164
166
   for (i = 1; i < args_size && args[i] <= max_arg; i++) {
165
167
      ASSERT(args[i] > args[i - 1]); // Ascending order.
166
168
      __GET_CPUID(args[i], &reg);
167
169
 
168
170
      DynBuf_Append(buf, temp,
169
 
         Str_Sprintf(temp, sizeof temp, format, args[i], reg.eax, reg.ebx, reg.ecx, reg.edx));
 
171
                    Str_Sprintf(temp, sizeof temp, format, args[i], reg.eax,
 
172
                                reg.ebx, reg.ecx, reg.edx));
170
173
   }
171
174
}
172
175
 
186
189
 *       If the extended CPUID is not available, only returns the basic CPUID.
187
190
 *
188
191
 * Results:
189
 
 *       The CPUID string if the processor supports the CPUID instruction and this
190
 
 *       is a processor we recognize. It should never fail, since it would at least
191
 
 *       return leaf 0. Caller needs to free the returned string.
 
192
 *       The CPUID string if the processor supports the CPUID instruction and
 
193
 *       this is a processor we recognize. It should never fail, since it
 
194
 *       would at least return leaf 0. Caller needs to free the returned string.
192
195
 *
193
196
 * Side effect:
194
197
 *       None
546
549
 
547
550
   return FALSE;
548
551
}
 
552
 
 
553
 
 
554
/*
 
555
 *-----------------------------------------------------------------------------
 
556
 *
 
557
 * Hostinfo_SystemTimerUS --
 
558
 *
 
559
 *      Return the time.
 
560
 *         - These timers are documented to never go backwards.
 
561
 *         - These timers may take locks
 
562
 *
 
563
 * NOTES:
 
564
 *      These are the routines to use when performing timing measurements.
 
565
 *
 
566
 *      The value returned is valid (finish-time - start-time) only within a
 
567
 *      single process. Don't send a time measurement obtained with these
 
568
 *      routines to another process and expect a relative time measurement
 
569
 *      to be correct.
 
570
 *
 
571
 *      The actual resolution of these "clocks" are undefined - it varies
 
572
 *      depending on hardware, OSen and OS versions.
 
573
 *
 
574
 * Results:
 
575
 *      The time in microseconds is returned. Zero upon error.
 
576
 *
 
577
 * Side effects:
 
578
 *      None.
 
579
 *
 
580
 *-----------------------------------------------------------------------------
 
581
 */
 
582
 
 
583
VmTimeType 
 
584
Hostinfo_SystemTimerUS(void)
 
585
{
 
586
   return Hostinfo_SystemTimerNS() / 1000;
 
587
}