[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] definition of mfn_x() macro..
Hi, Sandesh wrote: can you please tell me where the definition of mfn_x is?? I see it is being used at many places but not able to find its definition in xensource. It's a type safety feature for debug compilation. As you can see in xen/include/asm-x86/mm.h: /* With this defined, we do some ugly things to force the compiler to * give us type safety between mfns and gfns and other integers. * TYPE_SAFE(int foo) defines a foo_t, and _foo() and foo_x() functions * that translate beween int and foo_t. * * It does have some performance cost because the types now have * a different storage attribute, so may not want it on all the time. */ #ifndef NDEBUG #define TYPE_SAFETY 1 #endif #ifdef TYPE_SAFETY #define TYPE_SAFE(_type,_name) \ typedef struct { _type _name; } _name##_t; \ static inline _name##_t _##_name(_type n) { return (_name##_t) { n }; } \ static inline _type _name##_x(_name##_t n) { return n._name; } #else #define TYPE_SAFE(_type,_name) \ typedef _type _name##_t; \ static inline _name##_t _##_name(_type n) { return n; } \ static inline _type _name##_x(_name##_t n) { return n; } #endif TYPE_SAFE(unsigned long,mfn); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |