From: Daniel Stodden Subject: Re: Using SYSCALL/SYSRET with a minios kernel Date: Mon, 25 Feb 2008 03:26:21 +0100 Message-ID: <1203906381.9103.24.camel@thinkpad.localdomain> References: <87k5kuym6k.fsf@web.de> <1203897714.9103.6.camel@thinkpad.localdomain> <87hcfx3ima.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <87hcfx3ima.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 02:55 +0100, Goswin von Brederlow wrote: > Daniel Stodden writes: >=20 > > Hi. > > > > On Mon, 2008-02-25 at 00:22 +0100, Goswin von Brederlow wrote:=20 > >> Hi, > >>=20 > >> I'm trying to use the SYSCALL/SYSRET opcodes with a minios kernel > >> without much success. > >... > > The PV interface simply does not support STAR/LSTAR. It's that > > simple. :) I suppose you want to implement system calls? Check the > > HYPERVISOR_set_callbacks() call. The syscall_address parameter presen= tly > > remains entirely unused in mini-os. But as far as I could tell > > immediately from the source, syscall/sysret appears to be supported b= y > > the general callback mechanism the same way sysenter/sysleave present= ly > > is. > > > > regards, > > daniel >=20 > Ok, here is what I did for the callbacks: >=20 > --- x86_64.S --- > ENTRY(syscall_callback) > int $80 > zeroentry do_syscall >=20 > --- 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_callback > and execute from there. M=C3=B6=C3=B6p! Only when calling in from virtual user mode. Otherwise, y= ou're triggering a hypercall service routine, and one might suspect you're presently just generating an error condition with that. :) BTW: I found building Xen with 'debug=3Dy' generates a helpful comment on the console every now and xen. > 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. hth, 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