From owner-freebsd-stable@FreeBSD.ORG Tue Jan 17 02:52:20 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC9E91065670 for ; Tue, 17 Jan 2012 02:52:20 +0000 (UTC) (envelope-from lattera@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 745028FC14 for ; Tue, 17 Jan 2012 02:52:20 +0000 (UTC) Received: by obcwo16 with SMTP id wo16so2444525obc.13 for ; Mon, 16 Jan 2012 18:52:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=BqOYD7DFlt/Ef0+tZ8uYZ3aAer8iEtSPYOb/EJJUlp0=; b=i00dbp6V8UiID+PdfCT+uCIBpgKLzSbzta7V9C0fiXGXhUTTtdXlNGAPJueUYTq6w7 EEDf+g2pEfTD1fqvgs7aGkzr8PjOniPSmC02x7uiU2diLBOTRO06+G8IDqZ5ugdO8ItS Lcbc2CbyCFKGde2fPUVsdrwzmM6bgOLw4o8BQ= MIME-Version: 1.0 Received: by 10.182.48.41 with SMTP id i9mr5395777obn.17.1326768739868; Mon, 16 Jan 2012 18:52:19 -0800 (PST) Received: by 10.182.33.233 with HTTP; Mon, 16 Jan 2012 18:52:19 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Jan 2012 19:52:19 -0700 Message-ID: From: Shawn Webb To: freebsd-stable@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: Certain Registers in amd64 Unavailable to Developers X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2012 02:52:20 -0000 Nevermind. It's rdi and rsi that I should use. Sorry for the wasted bandwidth. ;) Thanks, Shawn On Mon, Jan 16, 2012 at 7:41 PM, Shawn Webb wrote: > Hey stable@, > > First off, I'm not too sure if this is the right mailing list (maybe > freebsd-hackers@?). Sorry if it is. This is just the mailing list I > subscribe to, so I thought I'd start here. > > Anyways, I'm looking at the regs struct (machine/reg.h) on FreeBSD > 9-stable amd64. It appears that struct doesn't contain registers such > as edi and esi. However, FreeBSD amd64's syscall calling convention > mandates their use. I'm using ptrace to get and set the registers. > Anyone know how to grab those registers? > > Sample code that shows using edi, esi on amd64 and calls the exit syscall= : > > [shawn@fbsd-sec ~/tmp]$ uname -a > FreeBSD fbsd-sec 9.0-PRERELEASE FreeBSD 9.0-PRERELEASE #1: Thu Dec 15 > 06:17:41 MST 2011 =A0 =A0 shawn@fbsd-sec:/usr/obj/usr/src/sys/SEC =A0amd6= 4 > [shawn@fbsd-sec ~/tmp]$ gdb ./test > GNU gdb 6.1.1 [FreeBSD] > Copyright 2004 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and you = are > welcome to change it and/or distribute copies of it under certain conditi= ons. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. =A0Type "show warranty" for deta= ils. > This GDB was configured as "amd64-marcel-freebsd"...(no debugging > symbols found)... > (gdb) disass _start > Dump of assembler code for function _start: > 0x0000000000400080 <_start+0>: =A0mov =A0 =A0$0x1,%edi > 0x0000000000400085 <_start+5>: =A0mov =A0 =A0$0x5,%esi > 0x000000000040008a <_start+10>: syscall > End of assembler dump. > (gdb) run > Starting program: /usr/home/shawn/tmp/test > > Program exited with code 05. > (gdb) exit > Undefined command: "exit". =A0Try "help". > (gdb) [shawn@fbsd-sec ~/tmp]$ file test > test: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), > statically linked, not stripped > > Thanks, > > Shawn