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] Question regarding user-mode and debugging terminals

To: The Evil Geek <theevilgeek@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Question regarding user-mode and debugging terminals
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Fri, 05 Oct 2007 07:27:04 +0100
Delivery-date: Thu, 04 Oct 2007 23:22:48 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <411903.89270.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
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: AcgHGL6x/VsCcnMLEdybkAAWy6hiGQ==
Thread-topic: [Xen-devel] Question regarding user-mode and debugging terminals
User-agent: Microsoft-Entourage/11.3.6.070618
On 5/10/07 02:09, "The Evil Geek" <theevilgeek@xxxxxxxxx> wrote:

> The code that has been commented out is our attempt to
> alter the segment registers and switch to ring 3.
> However, this seems to be very wrong. We are
> struggling to find examples as to how this switch to
> userland might be achieved while running with xen
> (and, in fact, in general). Does anyone have any
> advice that might help us implement this switch to
> userland? Additionally, will returning from a trap
> into the kernel from userland automatically switch
> back to userland or is additional effort needed?

Your problem does not look to be specific to running on Xen. Your approach
to switching to user space is a bit broken -- you cannot generally run
kernel code in ring 3, since the page-table protection for kernel mappings
is set to disallow ring-3 (user) accesses, since _PAGE_USER is clear in the
PTEs. So you are probably taking a page fault immediately after the iret
that is switching you to ring 3.

An approach that works is to set up a dummy trap frame so it looks like
user-space trapped to you. Then take your normal exit path from your OS.
This raises the question of what to set %esp and %eip to when initially
loading an application -- that is generally a question for your loader, and
will be discovered by looking at e.g., Elf metadata.

 -- Keir



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

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