From owner-freebsd-hackers@FreeBSD.ORG Wed May 12 04:29:13 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 20BFF16A4CE for ; Wed, 12 May 2004 04:29:13 -0700 (PDT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id D034243D1F for ; Wed, 12 May 2004 04:29:12 -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 3BC331F00B for ; Wed, 12 May 2004 13:29:12 +0200 (CEST) Received: by toad.stack.nl (Postfix, from userid 816) id 2559392; Wed, 12 May 2004 13:29:12 +0200 (CEST) To: freebsd-hackers@freebsd.org Date: Wed, 12 May 2004 13:29:12 +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: <20040512112912.2559392@toad.stack.nl> From: marcov@stack.nl (Marco van de Voort) Subject: x86-64 syscall ABI conventions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2004 11:29:13 -0000 To start with the FPC port for x86-64, I've objdumped an empty C prg on an x86-64, and read the abi document on x86-64.org, but don't understand the move rcx,r10 before each syscall. Why is this done? What is exactly saved? If it is a save, where is it restored from r10? E.g. 0000000000402094 <__sys_sigaction>: 402094: 48 c7 c0 a0 01 00 00 mov $0x1a0,%rax 40209b: 49 89 ca mov %rcx,%r10 <- This one 40209e: 0f 05 syscall 4020a0: 72 01 jb 4020a3 <__sys_sigaction+0xf> 4020a2: c3 retq I did notice that the x86-64 linux abi mentions rcx as being destroyed by the kernel.