From: "Jan Beulich" Subject: [PATCH] linux/x86: don't hardcode is_running_on_xen() for pv drivers Date: Thu, 07 Feb 2008 09:30:30 +0000 Message-ID: <47AADDC6.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Allowing graceful failure of these modules when inadvertently loaded on native kernels. Almost as usual, written and tested on 2.6.16.54 and made apply to the 2.6.18 tree without further testing. Signed-off-by: Jan Beulich --- a/include/asm-i386/mach-xen/asm/hypervisor.h +++ b/include/asm-i386/mach-xen/asm/hypervisor.h @@ -145,7 +145,12 @@ u64 jiffies_to_st(unsigned long jiffies) #define MULTI_UVMDOMID_INDEX 4 #endif =20 +#ifdef CONFIG_XEN #define is_running_on_xen() 1 +#else +extern char *hypercall_stubs; +#define is_running_on_xen() (!!hypercall_stubs) +#endif =20 static inline int HYPERVISOR_yield(