|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] Question regarding user-mode and debugging terminals
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
|
|
|
|
|