From owner-freebsd-arch@FreeBSD.ORG Sun Apr 3 18:25:06 2011 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A647A106566B; Sun, 3 Apr 2011 18:25:06 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 4C1468FC14; Sun, 3 Apr 2011 18:25:05 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 5677245CA0; Sun, 3 Apr 2011 20:06:49 +0200 (CEST) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 45D3645C8A; Sun, 3 Apr 2011 20:06:44 +0200 (CEST) Date: Sun, 3 Apr 2011 20:06:36 +0200 From: Pawel Jakub Dawidek To: Andriy Gapon Message-ID: <20110403180636.GF1849@garage.freebsd.pl> References: <4D95E162.40605@FreeBSD.org> <4D95ECDE.1020504@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="27ZtN5FSuKKSZcBU" Content-Disposition: inline In-Reply-To: <4D95ECDE.1020504@FreeBSD.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: FreeBSD Hackers , Andrew Duane , FreeBSD Arch Subject: Re: looking for error codes 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: Sun, 03 Apr 2011 18:25:06 -0000 --27ZtN5FSuKKSZcBU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 01, 2011 at 06:18:54PM +0300, Andriy Gapon wrote: > on 01/04/2011 18:04 Andrew Duane said the following: > > AFAIK, FreeBSD does not really detect read-only media. This was somethi= ng I had to add as a small project here at work, and was considering cleani= ng up to try to get into CURRENT. If there's a real need for it, I could sp= eed that up. > >=20 >=20 > Yes, that's exactly the problem that I am looking at. > So if you have anything to share it will be greatly appreciated at least = by me. > But I think many more people could benefit from it (e.g. those having SD/= SDHC/etc > cards). Once you detect read-only media, I suggest to implement the support by adding new DISKFLAG_READONLY to disk(9) API and simply deny write access in g_disk_access() when DISKFLAG_READONLY is set. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --27ZtN5FSuKKSZcBU Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk2YtywACgkQForvXbEpPzSpQgCgyEDLFfXaU7g3MN7rug61d+k1 D+cAn0J9QZZxe24Qk2vi+GucC6KLIrkW =pJXb -----END PGP SIGNATURE----- --27ZtN5FSuKKSZcBU-- From owner-freebsd-arch@FreeBSD.ORG Mon Apr 4 03:35:23 2011 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04A981065670; Mon, 4 Apr 2011 03:35:23 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id AFE658FC1B; Mon, 4 Apr 2011 03:35:22 +0000 (UTC) Received: from [10.0.0.63] (63.imp.bsdimp.com [10.0.0.63]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p343UAtQ068716 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Sun, 3 Apr 2011 21:30:13 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <20110403180636.GF1849@garage.freebsd.pl> Date: Sun, 3 Apr 2011 21:30:10 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <15B9A193-6298-459C-A2E3-E049C1E186FB@bsdimp.com> References: <4D95E162.40605@FreeBSD.org> <4D95ECDE.1020504@FreeBSD.org> <20110403180636.GF1849@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1082) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Sun, 03 Apr 2011 21:30:13 -0600 (MDT) Cc: FreeBSD Hackers , Andriy Gapon , FreeBSD Arch Subject: Re: looking for error codes 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: Mon, 04 Apr 2011 03:35:23 -0000 On Apr 3, 2011, at 12:06 PM, Pawel Jakub Dawidek wrote: > On Fri, Apr 01, 2011 at 06:18:54PM +0300, Andriy Gapon wrote: >> on 01/04/2011 18:04 Andrew Duane said the following: >>> AFAIK, FreeBSD does not really detect read-only media. This was = something I had to add as a small project here at work, and was = considering cleaning up to try to get into CURRENT. If there's a real = need for it, I could speed that up. >>>=20 >>=20 >> Yes, that's exactly the problem that I am looking at. >> So if you have anything to share it will be greatly appreciated at = least by me. >> But I think many more people could benefit from it (e.g. those having = SD/SDHC/etc >> cards). >=20 > Once you detect read-only media, I suggest to implement the support by > adding new DISKFLAG_READONLY to disk(9) API and simply deny write = access > in g_disk_access() when DISKFLAG_READONLY is set. And if I pop out the SD card and flip the switch, what then? Warner From owner-freebsd-arch@FreeBSD.ORG Tue Apr 5 13:19:39 2011 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07886106564A; Tue, 5 Apr 2011 13:19:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id AECB68FC17; Tue, 5 Apr 2011 13:19:37 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id QAA04405; Tue, 05 Apr 2011 16:19:35 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <4D9B16E7.2070208@FreeBSD.org> Date: Tue, 05 Apr 2011 16:19:35 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110309 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: FreeBSD Arch , FreeBSD Hackers References: <4D95E162.40605@FreeBSD.org> In-Reply-To: <4D95E162.40605@FreeBSD.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-scsi@FreeBSD.org Subject: Re: looking for error codes 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, 05 Apr 2011 13:19:39 -0000 on 01/04/2011 17:29 Andriy Gapon said the following: > > I am looking for error codes that would unambiguously signal that a disk drive has > readonly or write-protected media and that disk drive has no media at the moment. > I foresee these error codes being used mostly between disk peripheral drivers and > filesystem drivers. > > I will appreciate your suggestions. > > P.S. > I see that Linux uses EROFS and ENOMEDIUM for these purposes. > I am not sure about EROFS in this role. > And we don't have ENOMEDIUM (nor EMEDIUMTYPE). Thanks for all the error code suggestions so far :-) It seems that ENODEV could be a good choice for signaling readonly or write-protected media on write access: 19 ENODEV Operation not supported by device. An attempt was made to apply an inappropriate function to a device, for example, trying to read a write-only device such as a printer. BTW, SCSI code currently maps that condition to EACCES, but I don't think that that is the best choice - the error could be also produced by "permissions-related" checks. E.g. from intro(2): 13 EACCES Permission denied. An attempt was made to access a file in a way forbidden by its file access permissions. As for the ENOMEDIUM, I don't think that adding a distinct error code here would provide any new useful abilities. So, ENXIO should still be a good option. -- Andriy Gapon From owner-freebsd-arch@FreeBSD.ORG Tue Apr 5 22:10:48 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D80EE106566C; Tue, 5 Apr 2011 22:10:48 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [IPv6:2001:470:a803::1]) by mx1.freebsd.org (Postfix) with ESMTP id 81A588FC08; Tue, 5 Apr 2011 22:10:48 +0000 (UTC) Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 88A85A82696; Wed, 6 Apr 2011 06:10:47 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by mail.geekcn.org (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with LMTP id TJLx7jG4pLEU; Wed, 6 Apr 2011 06:10:41 +0800 (CST) Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id 58D04A8267F; Wed, 6 Apr 2011 06:10:40 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:subject:x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=FPoo8ejpj4+HR6xQNL/0RFTSuf/FL7q2aiAHkJxD4TFQNbhv3aaPbZj3sv7pCPE3y qjQm/zeW2m7nqRqic8Gpw== Message-ID: <4D9B935D.4010705@delphij.net> Date: Tue, 05 Apr 2011 15:10:37 -0700 From: Xin LI Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110317 Thunderbird/3.1.9 ThunderBrowse/3.3.5 MIME-Version: 1.0 To: freebsd-arch@freebsd.org, freebsd-amd64@freebsd.org X-Enigmail-Version: 1.1.2 OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Where to find amd64 ABI information for FreeBSD? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2011 22:10:48 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi, Is there a place to find ABI information for GCC on FreeBSD? Specifically, I'm looking for which registers has to be preserved across function call? (Or do we follow System V Application Binary Interface AMD64 Architecture Processor Supplement Draft Version 0.99.5?) Thanks in advance! Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iQEcBAEBCAAGBQJNm5NdAAoJEATO+BI/yjfBIJ0IAIoUzVnFHqp0ZABglvYJped+ kILAINifF2zxdcZqinfGBVTPG2H9vm5CsIsaU58XyUELdYynSHpVb4nwIrrVzxk9 +Mw6fTY7B+AT6mHPsj2b4MoFrwi6d8mvkgovyiF1SZm/jbi2vpm7eOi6VZ2sCU1u /N1/6YyjK+pdqLWLtNlS+5QR8wC0WZC+cmDQ7pEkO5Vb2AebVJxZVEtG+/SDw9xG kkGs2vR+N+Gl9OfIwnoSHJ/izLS7lOoCfBGyl/rlXsLXQbe8ijq5e2K1RF0P3alO zu9LlHz1ExOTbl4NNUnDw+1Wyd15Lt+Uiq3h/mVPO/b5eTyNkjTwdtqDeofAwnA= =Mwee -----END PGP SIGNATURE----- From owner-freebsd-arch@FreeBSD.ORG Tue Apr 5 22:49:32 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 903841065672; Tue, 5 Apr 2011 22:49:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 0D4DE8FC20; Tue, 5 Apr 2011 22:49:31 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p35MnDAo098014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 6 Apr 2011 01:49:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p35MnD1W083367; Wed, 6 Apr 2011 01:49:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p35MnD9L083366; Wed, 6 Apr 2011 01:49:13 +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: Wed, 6 Apr 2011 01:49:13 +0300 From: Kostik Belousov To: d@delphij.net Message-ID: <20110405224913.GF78089@deviant.kiev.zoral.com.ua> References: <4D9B935D.4010705@delphij.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DBycx+zjj0qtx+9x" Content-Disposition: inline In-Reply-To: <4D9B935D.4010705@delphij.net> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-amd64@freebsd.org, freebsd-arch@freebsd.org Subject: Re: Where to find amd64 ABI information for FreeBSD? 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, 05 Apr 2011 22:49:32 -0000 --DBycx+zjj0qtx+9x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 05, 2011 at 03:10:37PM -0700, Xin LI wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 >=20 > Hi, >=20 > Is there a place to find ABI information for GCC on FreeBSD? > Specifically, I'm looking for which registers has to be preserved > across function call? (Or do we follow System V Application Binary > Interface AMD64 Architecture Processor Supplement Draft Version 0.99.5?) The parts of the mentioned document that depend on compiler and toolchain, are fully valid for FreeBSD. Our non-compliance is mostly in the specified bits of the kernel/usermode interface. --DBycx+zjj0qtx+9x Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk2bnGgACgkQC3+MBN1Mb4j+5wCg7z2hu6nZfFLcaLezwJrIogdI 1EkAoJl7zTrKXEKpVcG6uwe1sxuUmPxx =Byes -----END PGP SIGNATURE----- --DBycx+zjj0qtx+9x-- From owner-freebsd-arch@FreeBSD.ORG Wed Apr 6 11:38:12 2011 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25DDB106566C for ; Wed, 6 Apr 2011 11:38:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 9D3A88FC1A for ; Wed, 6 Apr 2011 11:38:11 +0000 (UTC) Received: from c122-106-155-58.carlnfd1.nsw.optusnet.com.au (c122-106-155-58.carlnfd1.nsw.optusnet.com.au [122.106.155.58]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p36Bbm1D014971 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 6 Apr 2011 21:37:49 +1000 Date: Wed, 6 Apr 2011 21:37:48 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kostik Belousov In-Reply-To: <20110405224913.GF78089@deviant.kiev.zoral.com.ua> Message-ID: <20110406212659.W1522@besplex.bde.org> References: <4D9B935D.4010705@delphij.net> <20110405224913.GF78089@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: d@delphij.net, freebsd-amd64@FreeBSD.org, freebsd-arch@FreeBSD.org Subject: Re: Where to find amd64 ABI information for FreeBSD? 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: Wed, 06 Apr 2011 11:38:12 -0000 On Wed, 6 Apr 2011, Kostik Belousov wrote: > On Tue, Apr 05, 2011 at 03:10:37PM -0700, Xin LI wrote: >> Is there a place to find ABI information for GCC on FreeBSD? >> Specifically, I'm looking for which registers has to be preserved >> across function call? (Or do we follow System V Application Binary I've always looked at the source code (mainly i386.h and i386.md). I don't know of any better way for i386. >> Interface AMD64 Architecture Processor Supplement Draft Version 0.99.5?) > > The parts of the mentioned document that depend on compiler and > toolchain, are fully valid for FreeBSD. Our non-compliance is mostly > in the specified bits of the kernel/usermode interface. Is it still a de-facto standard only at 0.99.x? I only have 0.95 from 2005. I guess little has changed. Bruce From owner-freebsd-arch@FreeBSD.ORG Sat Apr 9 22:37:10 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6F56106564A for ; Sat, 9 Apr 2011 22:37:10 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 960D38FC14 for ; Sat, 9 Apr 2011 22:37:10 +0000 (UTC) Received: by vxc34 with SMTP id 34so4279250vxc.13 for ; Sat, 09 Apr 2011 15:37:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.176.34 with SMTP id cf2mr1854874vdc.81.1302388629592; Sat, 09 Apr 2011 15:37:09 -0700 (PDT) Received: by 10.52.159.2 with HTTP; Sat, 9 Apr 2011 15:37:09 -0700 (PDT) In-Reply-To: <20110405224913.GF78089@deviant.kiev.zoral.com.ua> References: <4D9B935D.4010705@delphij.net> <20110405224913.GF78089@deviant.kiev.zoral.com.ua> Date: Sat, 9 Apr 2011 15:37:09 -0700 Message-ID: From: Peter Wemm To: Kostik Belousov Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: d@delphij.net, freebsd-amd64@freebsd.org, freebsd-arch@freebsd.org Subject: Re: Where to find amd64 ABI information for FreeBSD? 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: Sat, 09 Apr 2011 22:37:10 -0000 On Tue, Apr 5, 2011 at 3:49 PM, Kostik Belousov wrote= : > On Tue, Apr 05, 2011 at 03:10:37PM -0700, Xin LI wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA256 >> >> Hi, >> >> Is there a place to find ABI information for GCC on FreeBSD? >> =A0Specifically, I'm looking for which registers has to be preserved >> across function call? =A0(Or do we follow System V Application Binary >> Interface AMD64 Architecture Processor Supplement Draft Version 0.99.5?) > > The parts of the mentioned document that depend on compiler and > toolchain, are fully valid for FreeBSD. Our non-compliance is mostly > in the specified bits of the kernel/usermode interface. > There is also an accidental deviation with register usage in the way we start up applications. But as far as calling conventions go for preserved/scratch registers, we are compliant. Of note our i386 syscall abi is not consistent with i386 calling conventions. In particular, i386 syscalls save/restore ALL registers except for those used in return values. eg: %eax is changed, and %edx is changed for SOME syscalls that have a 64 bit or dual return (and preserved otherwise). Unlike i386, our amd64 syscalls do not preserve registers that are designated as scratch in the abi. There is an inconsistency between the syscall instruction and the ABI, but that is "repaired" in the libc syscall wrappers. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell