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/
Home Products Support Community News


Re: [Xen-devel] Using SYSCALL/SYSRET with a minios kernel

To: Goswin von Brederlow <goswin-v-b@xxxxxx>
Subject: Re: [Xen-devel] Using SYSCALL/SYSRET with a minios kernel
From: Daniel Stodden <stodden@xxxxxxxxxx>
Date: Mon, 25 Feb 2008 12:08:00 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 25 Feb 2008 03:08:25 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <87oda5mjwq.fsf@xxxxxx>
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>
Organization: Fakultät für Informatik I10, Technische Universität München
References: <87k5kuym6k.fsf@xxxxxx> <1203897714.9103.6.camel@xxxxxxxxxxxxxxxxxxxx> <87hcfx3ima.fsf@xxxxxx> <1203906381.9103.24.camel@xxxxxxxxxxxxxxxxxxxx> <87oda5mjwq.fsf@xxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Mon, 2008-02-25 at 11:04 +0100, Goswin von Brederlow wrote:

> >> --- kernel.c ---
> >>   HYPERVISOR_set_callbacks((unsigned long)hypervisor_callback,
> >>                       (unsigned long)failsafe_callback,
> >>                       (unsigned long)syscall_callback);
> >> 
> >>   __asm__ __volatile__("syscall");
> >> 
> >> If I understood you right that should set the RIP to syscall_callback
> >> and execute from there.
> >
> > Mööp! Only when calling in from virtual user mode. Otherwise, you're
> > triggering a hypercall service routine, and one might suspect you're
> > presently just generating an error condition with that. :)
> That sounds verry odd. I'm getting no indication of it from xen.

Why odd? That's how e.g. syscall processing in Xen's entry.S is structured.
Many hypercalls fail with messages. But e.g. an invalid hypercall number
would silently return -ENOSYS, so it does not appear too unlikely. 
What do you get instead?

> But ok. How do I test that. Or differently phrased: What is the best
> way to go into user space for the verry first time? Do I really have
> to create a fake stack frame and call HYPERVISOR_iret?

iret is the only method I am aware of, can't think about anything else. Doubt
that a stack switch would be forcibly required.

Does not neccesarily mean much, however, since I did not write the freaky thing.

> > BTW: I found building Xen with 'debug=y' generates a helpful comment on
> > the console every now and xen.
> I did that and added a patch that makes HYPERVISOR_console_io work for
> domU so it shows up in "xm dmesg".

Ah, I see. Good idea.

> >> But still, the syscall opcode does nothing.
> >> In case you wonder. The "int $80" is there to crash the domain and
> >> tell me it reached that point.

Shouldn't that just get you a GPF? 


Daniel Stodden
LRR     -      Lehrstuhl für Rechnertechnik und Rechnerorganisation
Institut für Informatik der TU München             D-85748 Garching
http://www.lrr.in.tum.de/~stodden         mailto:stodden@xxxxxxxxxx
PGP Fingerprint: F5A4 1575 4C56 E26A 0B33  3D80 457E 82AE B0D8 735B

Xen-devel mailing list