Back to index

lightning-sunbird  0.9+nobinonly
Functions
mpi_x86_asm.c File Reference
#include "mpi-priv.h"

Go to the source code of this file.

Functions

 __declspec (naked)

Function Documentation

__declspec ( naked  )

Definition at line 67 of file mpi_x86_asm.c.

{
  __asm {
    push   ebp
    mov    ebp,esp
    sub    esp,28
    push   edi
    push   esi
    push   ebx
    mov    ebx,0            ; carry = 0
    mov    ecx,[ebp+12]            ; ecx = a_len
    mov    edi,[ebp+20]
    cmp    ecx,0
    je     L_2                     ; jmp if a_len == 0
    mov    esi,[ebp+8]             ; esi = a
    cld
L_1:
    lodsd                   ; eax = [ds:esi]; esi += 4
    mov    edx,[ebp+16]            ; edx = b
    mul    edx                     ; edx:eax = Phi:Plo = a_i * b

    add    eax,ebx          ; add carry (ebx) to edx:eax
    adc    edx,0
    mov    ebx,edx          ; high half of product becomes next carry

    stosd                   ; [es:edi] = ax; edi += 4;
    dec    ecx                     ; --a_len
    jnz    L_1                     ; jmp if a_len != 0
L_2:
    mov    [edi],ebx        ; *c = carry
    pop    ebx
    pop    esi
    pop    edi
    leave  
    ret    
    nop
  }
}

Here is the call graph for this function: