From owner-freebsd-doc@FreeBSD.ORG Mon Sep 8 17:09:10 2014 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2A39FDB5 for ; Mon, 8 Sep 2014 17:09:10 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 026061BD9 for ; Mon, 8 Sep 2014 17:09:10 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D71FBB965; Mon, 8 Sep 2014 13:09:08 -0400 (EDT) From: John Baldwin To: freebsd-doc@freebsd.org Subject: Re: Syscall x86 convention in Devlopers' Handbook Date: Mon, 08 Sep 2014 11:44:27 -0400 Message-ID: <1928479.9KfryLvuNc@ralph.baldwin.cx> User-Agent: KMail/4.10.5 (FreeBSD/10.0-STABLE; KDE/4.10.5; amd64; ; ) In-Reply-To: <396A5D5F-AED3-4D79-8CD4-356A7FECCF9F@icloud.com> References: <396A5D5F-AED3-4D79-8CD4-356A7FECCF9F@icloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 08 Sep 2014 13:09:08 -0400 (EDT) X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Sep 2014 17:09:10 -0000 On Saturday, September 06, 2014 02:40:33 PM Seo Townsend wrote: > Hey guys, this is my first time in this mailing list so I=E2=80=99m n= ot fully aware > of all the procedures=E2=80=A6 >=20 > I was looking through the developer handbook and noticed that the > Developer=E2=80=99s Handbook section on Assembly for x86 doesn=E2=80=99= t make any mention > of the change in the syscall calling convention from i386 to x86-64 a= nd I > can=E2=80=99t seem to find this documented anywhere. The documentati= on does > mention =E2=80=9CFreeBSD kernel uses the C calling convention=E2=80=9D= (11.3.1) but doesn=E2=80=99t > point out that the C calling convention changed from i386 to x86-64; = and > the architecture listed for 11 is generically (x86 Assembly Language > Programming). Arguably, the "C calling convention" on x86-64 is to pass by register s= ince=20 that is what C uses on x86-64, so I'm not sure the statement is wrong. > Thoughts? Some ideas I had are: > (1). Change =E2=80=9Cx86 Assembly Language Programming=E2=80=9D to =E2= =80=9Ci386 Assembly=E2=80=9D - This > would clear up the disambiguity of the 32bit architecture and 64bit > architecture. I think this is probably a fine thing to do. > (2). Add a footnote to (11.3.1) with =E2=80=9CIf you are using > x86-64, please note that the calling convention for both C and syscal= l > changed from pushing arguments on the stack to using a list of ordere= d > registered as outlined in the System V AMD64 ABI specification=E2=80=9D= I don't really think this is the proper place to document the well-know= n=20 x86-64 calling conventions. :) If you are programming 64-bit assembly = you=20 should already know those. > (3). I would not mind eventually adding a section for =E2=80=9Cx86-64= assembly=E2=80=9D for > (11.3.2) if I could get someone to help mentor me. I suspect it would be more useful to just replace the current 32-bit ex= ample with only a 64-bit example and not try to keep both. --=20 John Baldwin