~ubuntu-branches/ubuntu/karmic/virtualbox-ose/karmic-updates

« back to all changes in this revision

Viewing changes to src/VBox/VMM/VMMAll/TMAllCpu.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-09-14 18:25:07 UTC
  • mfrom: (0.4.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090914182507-c98g07mq16hjmn6d
Tags: 3.0.6-dfsg-1ubuntu1
* Merge from debian unstable (LP: #429697), remaining changes:
  - Enable DKMS support on virtualbox host and guest modules (LP: #267097)
    - Drop virtualbox-ose{-guest,}-modules-* package templates
    - Recommend *-source instead of *-modules packages
    - Replace error messages related to missing/mismatched
      kernel module accordingly
  - Autoload kernel module
    - LOAD_VBOXDRV_MODULE=1 in virtualbox-ose.default
  - Disable update action
    - patches/u01-disable-update-action.dpatch
  - Virtualbox should go in Accessories, not in System tools (LP: #288590)
    - virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add apport hook
    - virtualbox-ose.files/source_virtualbox-ose.py
    - virtualbox-ose.install
  - Add launchpad integration
    - control
    - lpi-bug.xpm
    - patches/u02-lp-integration.dpatch
  - virtualbox, virtualbox-* (names of the upstream proprietary packages)
    conflict with virtualbox-ose (LP: #379878)
* Make debug package depend on normal or guest utils package
* Drop patches/22-pulseaudio-stubs.dpatch (applied upstream)
* Rename Ubuntu specific patches to uXX-*.dpatch
* Fix lintian warnings in maintainer scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
209
209
        }
210
210
        else
211
211
            u64 = ASMReadTSC();
 
212
 
 
213
        /* Never return a value lower than what the guest has already seen. */
 
214
        if (u64 < pVCpu->tm.s.u64TSCLastSeen)
 
215
        {
 
216
            STAM_COUNTER_INC(&pVM->tm.s.StatTSCUnderflow);
 
217
            pVCpu->tm.s.u64TSCLastSeen += 64;   /* @todo choose a good increment here */
 
218
            u64 = pVCpu->tm.s.u64TSCLastSeen;
 
219
        }
212
220
    }
213
221
    else
214
222
        u64 = pVCpu->tm.s.u64TSC;
260
268
     * do all the calcuations for us. Actually, we don't need to
261
269
     * call tmCpuTickPause here since we overwrite u64TSC anyway.
262
270
     */
263
 
    bool        fTSCTicking = pVCpu->tm.s.fTSCTicking;
264
 
    pVCpu->tm.s.fTSCTicking = false;
265
 
    pVCpu->tm.s.u64TSC      = u64Tick;
 
271
    bool        fTSCTicking    = pVCpu->tm.s.fTSCTicking;
 
272
    pVCpu->tm.s.fTSCTicking    = false;
 
273
    pVCpu->tm.s.u64TSC         = u64Tick;
 
274
    pVCpu->tm.s.u64TSCLastSeen = u64Tick;
266
275
    if (fTSCTicking)
267
276
        tmCpuTickResume(pVM, pVCpu);
268
277
    /** @todo Try help synchronizing it better among the virtual CPUs? */
270
279
    return VINF_SUCCESS;
271
280
}
272
281
 
 
282
/**
 
283
 * Sets the last seen CPU timestamp counter.
 
284
 *
 
285
 * @returns VBox status code.
 
286
 * @param   pVCpu               The virtual CPU to operate on.
 
287
 * @param   u64LastSeenTick     The last seen timestamp value.
 
288
 *
 
289
 * @thread  EMT which TSC is to be set.
 
290
 */
 
291
VMMDECL(int) TMCpuTickSetLastSeen(PVMCPU pVCpu, uint64_t u64LastSeenTick)
 
292
{
 
293
    VMCPU_ASSERT_EMT(pVCpu);
 
294
 
 
295
    LogFlow(("TMCpuTickSetLastSeen %RX64\n", u64LastSeenTick));
 
296
    if (pVCpu->tm.s.u64TSCLastSeen < u64LastSeenTick)
 
297
        pVCpu->tm.s.u64TSCLastSeen = u64LastSeenTick;
 
298
    return VINF_SUCCESS;
 
299
}
 
300
 
 
301
/**
 
302
 * Gets the last seen CPU timestamp counter.
 
303
 *
 
304
 * @returns last seen TSC
 
305
 * @param   pVCpu               The virtual CPU to operate on.
 
306
 *
 
307
 * @thread  EMT which TSC is to be set.
 
308
 */
 
309
VMMDECL(uint64_t) TMCpuTickGetLastSeen(PVMCPU pVCpu)
 
310
{
 
311
    VMCPU_ASSERT_EMT(pVCpu);
 
312
 
 
313
    return pVCpu->tm.s.u64TSCLastSeen;
 
314
}
 
315
 
273
316
 
274
317
/**
275
318
 * Get the timestamp frequency.