From: Daniel Stodden Subject: Re: Using SYSCALL/SYSRET with a minios kernel Date: Mon, 25 Feb 2008 12:08:00 +0100 Message-ID: <1203937680.5822.19.camel@thinkpad.localdomain> References: <87k5kuym6k.fsf@web.de> <1203897714.9103.6.camel@thinkpad.localdomain> <87hcfx3ima.fsf@web.de> <1203906381.9103.24.camel@thinkpad.localdomain> <87oda5mjwq.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <87oda5mjwq.fsf@web.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Goswin von Brederlow Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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); > >>=20 > >> __asm__ __volatile__("syscall"); > >>=20 > >> If I understood you right that should set the RIP to syscall_callbac= k > >> and execute from there. > > > > M=C3=83=C2=B6=C3=83=C2=B6p! Only when calling in from virtual user mo= de. Otherwise, you're > > triggering a hypercall service routine, and one might suspect you're > > presently just generating an error condition with that. :) >=20 > 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 structure= d. Many hypercalls fail with messages. But e.g. an invalid hypercall number would silently return -ENOSYS, so it does not appear too unlikely.=20 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. D= oubt 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=3Dy' generates a helpful commen= t on > > the console every now and xen. >=20 > 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?=20 regards, Daniel --=20 Daniel Stodden LRR - Lehrstuhl f=C3=BCr Rechnertechnik und Rechnerorganisation Institut f=C3=BCr Informatik der TU M=C3=BCnchen D-85748 Garc= hing http://www.lrr.in.tum.de/~stodden mailto:stodden@cs.tum.edu PGP Fingerprint: F5A4 1575 4C56 E26A 0B33 3D80 457E 82AE B0D8 735B