From owner-freebsd-arch@FreeBSD.ORG Tue Sep 4 04:41:34 2007 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A11B16A419; Tue, 4 Sep 2007 04:41:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id 1624913C48A; Tue, 4 Sep 2007 04:41:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.226] (helo=deviant.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1ISPTP-000Ezm-MC; Tue, 04 Sep 2007 06:53:16 +0300 Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l843r6W2077910; Tue, 4 Sep 2007 06:53:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l843r6bZ077903; Tue, 4 Sep 2007 06:53:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 4 Sep 2007 06:53:06 +0300 From: Kostik Belousov To: Bruce Evans Message-ID: <20070904035306.GB53667@deviant.kiev.zoral.com.ua> References: <20070902173953.GA52566@freebsd.org> <20070903105130.L48985@delplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zx4FCpZtqtKETZ7O" Content-Disposition: inline In-Reply-To: <20070903105130.L48985@delplex.bde.org> User-Agent: Mutt/1.4.2.3i X-Scanner-Signature: efe3bc1504fa577d936f03857ce6b673 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 1428 [September 3 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: arch@freebsd.org, Roman Divacky , i386@freebsd.org Subject: Re: PSL_RF inclusion in PSL_USERCHANGE for i386 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2007 04:41:34 -0000 --zx4FCpZtqtKETZ7O Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 03, 2007 at 11:18:37AM +1000, Bruce Evans wrote: >=20 > On Sun, 2 Sep 2007, Roman Divacky wrote: >=20 > >in i386/i386/machdep.c the set_regs() function sets i386 registers (call= ed > >by ptrace for example). it checks what eflags are being changed and=20 > >compares > >that with a mask of allowed flags to be changed. the mask is defined in= =20 > >psl.h > >like this: > > > >#define PSL_USERCHANGE (PSL_C | PSL_PF | PSL_AF | PSL_Z | PSL_N | PSL_T \ > > | PSL_D | PSL_V | PSL_NT | PSL_AC | PSL_ID) > > > >PSL_RF (Flag to ensure single-step only happens once per instruction.).= =20 > >Can someone > >tell me why this is omitted? I think its because of having in-kernel=20 > >debugger. >=20 > I think it is just because user mode cannot set this flag directly, > except probably in vm86 mode (vm86 support code already has special > cases for it). (Old) docs say that it can be set by popfl and iret, > but popfl doesn't set it for me now and user mode cannot execute iret (?). It can. It would result in exception when the normal privilege checks trigg= ers, but would execute as expected otherwise. For instance, #include .text .globl main .type main, @function main: pushl $12 /* _exit() code */ pushfl pushl %cs pushl $2f iretl 1: movl $SYS_exit, %eax pushl %eax int $0x80 2: pushl $hello call printf popl %eax jmp 1b .size main, . - main hello: .asciz "Hello from iret\n" --zx4FCpZtqtKETZ7O Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFG3NahC3+MBN1Mb4gRArvYAJ463KcW7Ryhk9Q70RpLY1hqKuUFoQCeO9Xw v4RdylW+Gp4TNzhrLNA1Gwo= =0i/3 -----END PGP SIGNATURE----- --zx4FCpZtqtKETZ7O--