From owner-freebsd-ia32@FreeBSD.ORG Mon Nov 5 19:03:39 2007 Return-Path: Delivered-To: freebsd-ia32@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E136D16A419 for ; Mon, 5 Nov 2007 19:03:39 +0000 (UTC) (envelope-from randyhyde@earthlink.net) Received: from elasmtp-junco.atl.sa.earthlink.net (elasmtp-junco.atl.sa.earthlink.net [209.86.89.63]) by mx1.freebsd.org (Postfix) with ESMTP id 9BD2913C481 for ; Mon, 5 Nov 2007 19:03:39 +0000 (UTC) (envelope-from randyhyde@earthlink.net) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=eLoNy5IIoRrFSwivQ03UsE27E9VYc6OAcUayoD+N2vEZIuSxAyrmt4flO/nWURKe; h=Received:Message-ID:From:To:Subject:Date:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Priority:X-MSMail-Priority:X-Mailer:X-MimeOLE:X-ELNK-Trace:X-Originating-IP; Received: from [66.215.252.78] (helo=pentiv) by elasmtp-junco.atl.sa.earthlink.net with asmtp (Exim 4.34) id 1Ip5qJ-0001xl-JB for freebsd-ia32@freebsd.org; Mon, 05 Nov 2007 12:34:31 -0500 Message-ID: <00bb01c81fd2$18e408d0$6302a8c0@pentiv> From: "Randall Hyde" To: Date: Mon, 5 Nov 2007 09:34:19 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896 X-ELNK-Trace: eba5e0c9192a36dcd6dd28457998182d7e972de0d01da940083d9bd915da8f3f9d9549436bbc3eef350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 66.215.252.78 Subject: Low-level API calls X-BeenThere: freebsd-ia32@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD on the IA-32 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Nov 2007 19:03:40 -0000 Hi All, For the past couple of weeks I've been busy porting HLA (the High Level Assembler) to FreeBSD. Actually, the assembler itself was more or less ported a year ago, for the past couple of weeks I've been doing the *real* work which was porting the HLA standard library to FreeBSD. That work is almost complete and the library is currently passing all the unit tests, but... I have a few questions about (native) API calls under FreeBSD. In particular, I've yet to find any documentation that explains how to call API functions (like lseek, pread, etc.) that have 64-bit arguments such as off_t arguments. I did find the following cryptic message in the man page for __syscall: "The __syscall() form should be used when one or more of the arguments is a 64-bit argument to ensure that argument alignment is correct." However, nowhere have I been able to find out what "argument alignment" should be. By just sticking in arbitrary PUSH instructions, I've been able to get lseek to function for me, but I've never been able to so the same with pread (btw, I got lseek working by making a __syscall). What I'd really like to learn here is how I have to set up the stack to make calls to functions that have 64-bit parameters. Three quick comments to save you some time: 1) Don't bother pointing me at the "FreeBSD Assembly HOWTO". It should be pretty obvious that I've looked at that a *long* time ago and the basic information it provides does not come close to addressing this issue. 2) Please don't suggest that I should go in and read FreeBSD source code to figure this kind of stuff out. I have no desire to do this and I don't believe that application/library developers should have to grok the inner workings of the OS in order to do simple things like make OS API calls. 3) Please don't suggest that I call the C standard library to do this work. *I'm* writing the library code for my own compiler and my calling sequences and run-time environment are not particularly compatible with GNU's. So making glib calls is out of the question. Thanks, Randy Hyde