direct-io.hg

changeset 7987:17b98e15bf78

Fix __gpfn_to_mfn() to work correctly when not executed
in the queried domain's context.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Nov 23 13:58:44 2005 +0100 (2005-11-23)
parents cd6a8d73f529
children 6cc603ac3f38 fb42478203b9
files xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/xen/include/asm-x86/shadow.h	Wed Nov 23 13:54:40 2005 +0100
     1.2 +++ b/xen/include/asm-x86/shadow.h	Wed Nov 23 13:58:44 2005 +0100
     1.3 @@ -283,21 +283,23 @@ static inline void shadow_mode_disable(s
     1.4  
     1.5  /************************************************************************/
     1.6  
     1.7 -#define __mfn_to_gpfn(_d, mfn)                         \
     1.8 -    ( (shadow_mode_translate(_d))                      \
     1.9 -      ? get_pfn_from_mfn(mfn)                                   \
    1.10 +#define __mfn_to_gpfn(_d, mfn)                  \
    1.11 +    ( (shadow_mode_translate(_d))               \
    1.12 +      ? get_pfn_from_mfn(mfn)                   \
    1.13        : (mfn) )
    1.14  
    1.15 -#define __gpfn_to_mfn(_d, gpfn)                        \
    1.16 -    ({                                                 \
    1.17 -        (shadow_mode_translate(_d))                    \
    1.18 -        ? get_mfn_from_pfn(gpfn)                \
    1.19 -        : (gpfn);                                      \
    1.20 +#define __gpfn_to_mfn(_d, gpfn)                 \
    1.21 +    ({                                          \
    1.22 +        (shadow_mode_translate(_d))             \
    1.23 +        ? (((_d) == current->domain) ?          \
    1.24 +           get_mfn_from_pfn(gpfn) :             \
    1.25 +           gpfn_to_mfn_foreign((_d), (gpfn)))   \
    1.26 +        : (gpfn);                               \
    1.27      })
    1.28  
    1.29 -#define __gpfn_to_mfn_foreign(_d, gpfn)                \
    1.30 -    ( (shadow_mode_translate(_d))                      \
    1.31 -      ? gpfn_to_mfn_foreign(_d, gpfn)                  \
    1.32 +#define __gpfn_to_mfn_foreign(_d, gpfn)         \
    1.33 +    ( (shadow_mode_translate(_d))               \
    1.34 +      ? gpfn_to_mfn_foreign(_d, gpfn)           \
    1.35        : (gpfn) )
    1.36  
    1.37  extern unsigned long gpfn_to_mfn_foreign(