~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to arch/x86/include/asm/pvclock.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
/* some helper functions for xen and kvm pv clock sources */
8
8
cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src);
 
9
void pvclock_set_flags(u8 flags);
9
10
unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src);
10
11
void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
11
12
                            struct pvclock_vcpu_time_info *vcpu,
12
13
                            struct timespec *ts);
 
14
void pvclock_resume(void);
 
15
 
 
16
/*
 
17
 * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
 
18
 * yielding a 64-bit result.
 
19
 */
 
20
static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
 
21
{
 
22
        u64 product;
 
23
#ifdef __i386__
 
24
        u32 tmp1, tmp2;
 
25
#endif
 
26
 
 
27
        if (shift < 0)
 
28
                delta >>= -shift;
 
29
        else
 
30
                delta <<= shift;
 
31
 
 
32
#ifdef __i386__
 
33
        __asm__ (
 
34
                "mul  %5       ; "
 
35
                "mov  %4,%%eax ; "
 
36
                "mov  %%edx,%4 ; "
 
37
                "mul  %5       ; "
 
38
                "xor  %5,%5    ; "
 
39
                "add  %4,%%eax ; "
 
40
                "adc  %5,%%edx ; "
 
41
                : "=A" (product), "=r" (tmp1), "=r" (tmp2)
 
42
                : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
 
43
#elif defined(__x86_64__)
 
44
        __asm__ (
 
45
                "mul %%rdx ; shrd $32,%%rdx,%%rax"
 
46
                : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
 
47
#else
 
48
#error implement me!
 
49
#endif
 
50
 
 
51
        return product;
 
52
}
13
53
 
14
54
#endif /* _ASM_X86_PVCLOCK_H */