From owner-freebsd-hackers Sun Oct 28 9:21:37 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by hub.freebsd.org (Postfix) with ESMTP id A3E8D37B401 for ; Sun, 28 Oct 2001 09:21:34 -0800 (PST) Received: (qmail 11733 invoked from network); 28 Oct 2001 17:21:34 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([64.81.54.73]) (envelope-sender ) by mail6.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 28 Oct 2001 17:21:34 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <003901c15f3c$5bdef760$1200a8c0@gsicomp.on.ca> Date: Sun, 28 Oct 2001 09:21:33 -0700 (PST) From: John Baldwin To: Matthew Emmerton Subject: RE: Simple x86 assembler question Cc: hackers@freebsd.org Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 27-Oct-01 Matthew Emmerton wrote: > Hi all, > > This weekend I decided to do some assembly hacking on some object-only code > that I've lost the C source for. Since I haven't coded assembler for at > least 8 years, and I threw my x86 assembly manuals out when I moved 6 months > ago, there are a few things that are stumping me. > > In particular, am I interpreting these instructions correctly? > > 0x80839fb : movzbl (%edx,%eax,1),%eax > > > Takes %eax + %edx, obtains the byte value in memory at that address, > zero-extends and places into %eax > > 0x80839ff : movzwl 0xe90(%ebx,%eax,2),%edx > > Takes %eax + %ebx + 0xe90, obtains the word value in memory at that address, > zero-extends and places in %edx. Almost. The '2' there is a multiplier on (I think) %eax, so it uses 'ebx + 2 * eax + 0xe90' for the memory address. Either that or 'eax + 2 * ebx + 0xe90'. Check the gas info page for the AT&T syntax to figure out exactly which. (Or use nasm's diassembler which turns out Intel format asm.) (ports/devel/nasm, ndisasm) -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message