English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Binding C libraries which use variable arguments (stdarg.h)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-11-01 (20:06)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Binding C libraries which use variable arguments (stdarg.h)
On Sun, Nov 01, 2009 at 03:58:47PM +0100, Adrien wrote:
> Unfortunately I don't know much about asm, I tried to check but failed
> (couldn't find what "leaq" meant).

The 'q' just means it's a Long Mode instruction (ie. x86-64's 64 bit
mode).  The instruction itself is "Load Effective Address" - it means
it does an address calculation as if you were going to load/store
something at that address, but instead puts the address itself (result
of that calculation) in the target register.

If I remember my rusty x86 assembler correctly, then:

  movl 4(%ebx),%eax ; load 4 bytes of data from address %ebx + 4, put in %eax
  lea 4(%ebx),%eax  ; add %ebx + 4 and put that in %eax


Richard Jones
Red Hat