From owner-freebsd-amd64@FreeBSD.ORG Sat May 15 16:19:56 2004 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 60AD516A4CE for ; Sat, 15 May 2004 16:19:56 -0700 (PDT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4AE4E43D41 for ; Sat, 15 May 2004 16:19:55 -0700 (PDT) (envelope-from marcov@stack.nl) Received: from toad.stack.nl (zen.stack.nl [IPv6:2001:610:1108:5010::130]) by mailhost.stack.nl (Postfix) with ESMTP id 630701F00A for ; Sun, 16 May 2004 01:19:54 +0200 (CEST) Received: by toad.stack.nl (Postfix, from userid 816) id 4594F93; Sun, 16 May 2004 01:19:54 +0200 (CEST) To: freebsd-amd64@freebsd.org Date: Sun, 16 May 2004 01:19:54 +0200 (CEST) X-Mailer: ELM [version 2.4ME+ PL88 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: <20040515231954.4594F93@toad.stack.nl> From: marcov@stack.nl (Marco van de Voort) Subject: ABI question, porting ports to amd64 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2004 23:19:56 -0000 I read the ABI info on x86-64.org, and objdumped some linux and freebsd code, and I ran into a linux<->freebsd difference something I can't figure out: There is a mov %rcx,%r10 instruction before each syscall on the testbox I use (which is plain 5.2.1 afaik). The linux code doesn't have this mov afaik. Moreover, it seems to serve no purpose. I tried to figure out why this is done, but have failed. Can somebody shed some light on this? P.s. this is for amd64 version of the fpc-devel port, a Delphi compiler, which has the possibillity of doing syscalls besides linking to libc. Example: sys_select: 0000000000400264 <__sys_select>: 400264: 48 c7 c0 5d 00 00 00 mov $0x5d,%rax 40026b: 49 89 ca mov %rcx,%r10 <---- this mov 40026e: 0f 05 syscall 400270: 72 01 jb 400273 <__sys_select+0xf> 400272: c3 retq 400273: e9 00 00 00 00 jmpq 400278 <.cerror> 0000000000400278 <.cerror>: 400278: 50 push %rax 400279: e8 0e 03 00 00 callq 40058c <__error_unthreaded> 40027e: 59 pop %rcx 40027f: 48 89 08 mov %rcx,(%rax) 400282: 48 c7 c0 ff ff ff ff mov $0xffffffffffffffff,%rax 400289: 48 c7 c2 ff ff ff ff mov $0xffffffffffffffff,%rdx 400290: c3 retq calling code: 40023a: 48 8d 4c 24 10 lea 0x10(%rsp,1),%rcx 40023f: 48 8d 94 24 90 00 00 lea 0x90(%rsp,1),%rdx 400246: 00 400247: 48 8d b4 24 10 01 00 lea 0x110(%rsp,1),%rsi 40024e: 00 40024f: bf 05 00 00 00 mov $0x5,%edi 400254: e8 0b 00 00 00 callq 400264 <__sys_select>