Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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

Rich.

-- 
Richard Jones
Red Hat