From owner-freebsd-amd64@FreeBSD.ORG Wed Jan 9 05:19:36 2008 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0661916A418 for ; Wed, 9 Jan 2008 05:19:36 +0000 (UTC) (envelope-from conrads@cox.net) Received: from eastrmmtai106.cox.net (eastrmmtai106.cox.net [68.230.240.13]) by mx1.freebsd.org (Postfix) with ESMTP id 73B8413C442 for ; Wed, 9 Jan 2008 05:19:35 +0000 (UTC) (envelope-from conrads@cox.net) Received: from eastrmimpo01.cox.net ([68.1.16.119]) by eastrmmtao101.cox.net (InterMail vM.7.08.02.01 201-2186-121-102-20070209) with ESMTP id <20080109051256.YRIA129.eastrmmtao101.cox.net@eastrmimpo01.cox.net>; Wed, 9 Jan 2008 00:12:56 -0500 Received: from serene.no-ip.org ([72.200.38.131]) by eastrmimpo01.cox.net with bizsmtp id atBt1Y0072pmqFc0000000; Wed, 09 Jan 2008 00:11:56 -0500 Received: from serene.no-ip.org (conrads@localhost [127.0.0.1]) by serene.no-ip.org (8.14.2/8.14.2) with ESMTP id m095Cphn008475; Tue, 8 Jan 2008 23:12:52 -0600 (CST) (envelope-from conrads@cox.net) Date: Tue, 8 Jan 2008 23:12:51 -0600 From: "Conrad J. Sabatier" To: Lyle Miller Message-ID: <20080108231251.5669bd18@serene.no-ip.org> In-Reply-To: <477EB268.2090403@bellsouth.net> References: <20080104210751.GA18913@dragon.NUXI.org> <477EB268.2090403@bellsouth.net> X-Mailer: Claws Mail 3.0.2 (GTK+ 2.12.3; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-amd64 Subject: Re: how do i write assembly code in amd64 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jan 2008 05:19:36 -0000 On Fri, 04 Jan 2008 17:25:44 -0500 Lyle Miller wrote: > David O'Brien wrote: > > On Sat, Dec 22, 2007 at 08:29:46PM -0800, Nate Eldredge wrote: > > > >> On Sun, 23 Dec 2007, zhang feng wrote: > >> > >>> i write asm32 code in linux.when i run the code in freebsd amd64, > >>> it cannt run. someone give me a help for coding asm64 in freebsd. > >>> > >> amd64 has a whole different instruction set than 32-bit x86, > >> > > > > Not true at all. 97% of the instructions are the same. What is > > different is the operand size and the C calling ABI. > > > > For the most part, code can be port by simple s/%e/%r/. > > > > > > look at some of the freebsd www documentation - handbooks and > articles: freebsd developers handbook? > freebsd architecture handbook? Precisely. See file:///usr/share/doc/en/books/developers-handbook/book.html#X86 (if you have the doc dist installed locally, or its counterpart on the FreeBSD website). This explains the differences in calling conventions between Linux and FreeBSD at the assembly coding level. > look at the under developers -> platforms -> amd64 project from > www.freebsd.org. > > look at some of the freebsd asm coding in the source tree: > cd /usr/src/sys > find . -name '*.[s|S]' -print | grep amd64 -- Conrad J. Sabatier "Procrastinate now; don't put it off." -- Ellen Degeneres