|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] Switching to user mode from domU kernel
On Mon, Oct 01, 2007 at 06:24:07AM +0100, Keir Fraser wrote:
> On 30/9/07 21:11, "Trammell Hudson" <hudson@xxxxxxxxxxxxxx> wrote:
>
> > Am I not jumping into user space correctly? Is there something
> > else that my code should do to make the transition?
>
> It sounds like event delivery is masked before the iret, and then you have
> IF set in the RFLAGS value in the iret frame, which causes event delivery to
> be unmasked during iret.
If I disable the domU event channel console and use the
HYPERVISOR_console_io hypercall instead, the user process is run
as expected. It deliberately causes a GPF by executing HLT after
a few instructions so that I know that it began executing user code.
That let's me know that my GDT and LDT are setup correctly and
that the user page tables are installed for at least the code segment.
If I have done any console output via EVTCHNOP_send my user app
never makes progress -- the domU kernel event callback is called
a few million times per second and the registers on the stack indicate
that the app is still on its first instruction (not the HLT).
The console output code is nearly a direct copy of the mini-os code
and uses the xencons_interface in the same way (with the addition
of newline mapping):
struct xencons_interface *intf = xen_console;
XENCONS_RING_IDX cons = intf->out_cons;
XENCONS_RING_IDX prod = intf->out_prod;
mb();
while ((sent < len) && ((prod - cons) < sizeof(intf->out)-1))
{
char c = data[ sent++ ];
if( c == '\n' )
intf->out[MASK_XENCONS_IDX(prod++, intf->out)] = '\r';
intf->out[MASK_XENCONS_IDX(prod++, intf->out)] = c;
}
wmb();
intf->out_prod = prod;
struct evtchn_send send = {
.port = xen_start_info->console.domU.evtchn,
};
HYPERVISOR_event_channel_op( EVTCHNOP_send, &send );
I've masked all events and the pending field in the shared_info
structure is zero. There are no waiting characters in the incoming
xen_console->in_prod array.
So, any ideas as to what I'm missing and why Xen keeps calling
the callback?
Thanks!
-- Trammell
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|