ia64/xen-unstable

view xen/include/asm-x86/div64.h @ 19848:5839491bbf20

[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.

don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 11:26:05 2009 +0900 (2009-06-29)
parents 5ccf8bbf8628
children
line source
1 #ifndef __I386_DIV64
2 #define __I386_DIV64
4 #include <xen/types.h>
6 #if BITS_PER_LONG == 64
8 #define do_div(n,base) ({ \
9 uint32_t __base = (base); \
10 uint32_t __rem; \
11 __rem = ((uint64_t)(n)) % __base; \
12 (n) = ((uint64_t)(n)) / __base; \
13 __rem; \
14 })
16 #else
18 /*
19 * do_div() is NOT a C function. It wants to return
20 * two values (the quotient and the remainder), but
21 * since that doesn't work very well in C, what it
22 * does is:
23 *
24 * - modifies the 64-bit dividend _in_place_
25 * - returns the 32-bit remainder
26 *
27 * This ends up being the most efficient "calling
28 * convention" on x86.
29 */
30 #define do_div(n,base) ({ \
31 unsigned long __upper, __low, __high, __mod, __base; \
32 __base = (base); \
33 asm ( "" : "=a" (__low), "=d" (__high) : "A" (n) ); \
34 __upper = __high; \
35 if ( __high ) \
36 { \
37 __upper = __high % (__base); \
38 __high = __high / (__base); \
39 } \
40 asm ( "divl %2" \
41 : "=a" (__low), "=d" (__mod) \
42 : "rm" (__base), "0" (__low), "1" (__upper) ); \
43 asm ( "" : "=A" (n) : "a" (__low), "d" (__high) ); \
44 __mod; \
45 })
47 #endif
49 #endif