ia64/xen-unstable

view xen/include/asm-x86/div64.h @ 15812:86a154e1ef5d

[HVM] Shadow: don't shadow the p2m table.
For HVM vcpus with paging disabled, we used to shadow the p2m table,
and skip the p2m lookup to go from gfn to mfn. Instead, we now
provide a simple pagetable that gives a one-to-one mapping of 4GB, and
shadow that, making the translations from gfn to mfn via the p2m.
This removes the paging-disabled special-case code from the shadow
fault handler, and allows us to expand the p2m interface, since all HVM
translations now go through the same p2m lookups.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Aug 31 11:06:22 2007 +0100 (2007-08-31)
parents 561f71aa056d
children 5ccf8bbf8628
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 __upper = __high % (__base); \
37 __high = __high / (__base); \
38 } \
39 asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (__base), "0" (__low), "1" (__upper)); \
40 asm("":"=A" (n):"a" (__low),"d" (__high)); \
41 __mod; \
42 })
44 #endif
46 #endif