* definition of mfn_x() macro..
@ 2008-07-17 17:29 Sandesh
2008-07-17 18:03 ` Gianluca Guida
0 siblings, 1 reply; 2+ messages in thread
From: Sandesh @ 2008-07-17 17:29 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
Hi all,
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 xen
source.
Iam using xen-3.2.0.
Thanks,
Sandesh
Please do not print this email unless it is absolutely necessary.
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: definition of mfn_x() macro..
2008-07-17 17:29 definition of mfn_x() macro Sandesh
@ 2008-07-17 18:03 ` Gianluca Guida
0 siblings, 0 replies; 2+ messages in thread
From: Gianluca Guida @ 2008-07-17 18:03 UTC (permalink / raw)
To: Sandesh; +Cc: xen-devel@lists.xensource.com
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 xen
> source.
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-17 18:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-17 17:29 definition of mfn_x() macro Sandesh
2008-07-17 18:03 ` Gianluca Guida
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.