From: "Steven Y. Ko" Subject: Re: Xen-aware kernel module Date: Wed, 21 Nov 2007 16:03:00 -0600 Message-ID: <5fa100fd0711211403l4820d2fdv3e947ebb9090caef@mail.gmail.com> References: <5fa100fd0711201630y668d0846ufd5a6de2e065a17e@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: 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: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Thank you all for the great tips! - Steve On Nov 21, 2007 1:54 AM, Keir Fraser wrote: > Since this code will be x86-specific anyway, you can use inline asm: > > unsigned long ring; > asm ( "push %cs; pop %0; and $3,%0" : "=r" (ring) ); > > Or perhaps just look at the KERNEL_CS macro. > > -- Keir > > > On 21/11/07 00:30, "Steven Y. Ko" wrote: > > > Hello, > > > > (I'm not sure if this is an appropriate place to ask this question. I > > apologize, if it's not) > > > > I'm trying to write a kernel module, that's sort of Xen-aware (or > > virtualisation-aware). I say "sort of", because what I actually need > > is checking the ring. Specifically, in my kernel module, I want to > > check which ring the code is running on (ring0, ring1, or even ring > > 3!), and behave differently. Does Xen provide any interface to do it? > > or is there any way to do it in a kernel module? Thanks for any help. > > > > Regards, > > Steve > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > >