WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Xen-aware kernel module

To: "Steven Y. Ko" <sko@xxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Xen-aware kernel module
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Wed, 21 Nov 2007 07:54:13 +0000
Delivery-date: Tue, 20 Nov 2007 23:49:08 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <5fa100fd0711201630y668d0846ufd5a6de2e065a17e@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcgsE7TW83m/pZgGEdydcAAWy6hiGQ==
Thread-topic: [Xen-devel] Xen-aware kernel module
User-agent: Microsoft-Entourage/11.3.6.070618
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" <sko@xxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>