From: Daniel Stodden Subject: Re: Using SYSCALL/SYSRET with a minios kernel Date: Mon, 25 Feb 2008 01:01:54 +0100 Message-ID: <1203897714.9103.6.camel@thinkpad.localdomain> References: <87k5kuym6k.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <87k5kuym6k.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 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. >=20 > Going by the manuals (and linux sources) I first have to setup the > STAR and LSTAR registers to define the segment and instruction pointer > to be used for SYSCALL: >=20 > /*=20 > * LSTAR and STAR live in a bit strange symbiosis. > * They both write to the same internal register. STAR allows t= o set > * CS/DS but only a 32bit target. LSTAR sets the 64bit rip. > */=20 > wrmsrl(MSR_STAR, ((uint64_t)__USER_CS)<<48 | ((uint64_t)__KER= NEL_CS)<<32);=20 > wrmsrl(MSR_LSTAR, system_call);=20 >=20 >=20 > But all that does is give a message on the xen console: >=20 > (XEN) traps.c:1467:d137 Domain attempted WRMSR 00000000c0000081 from e0= 23e010:00000000 to e033e033:00000000. > (XEN) traps.c:1467:d137 Domain attempted WRMSR 00000000c0000082 from ff= ff8300:001e0800 to 00000000:001054c0. 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 presently remains entirely unused in mini-os. But as far as I could tell immediately from the source, syscall/sysret appears to be supported by the general callback mechanism the same way sysenter/sysleave presently is. 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