All pastes #921427 Raw Edit

asm

public text v1 · immutable
#921427 ·published 2008-02-28 00:41 UTC
rendered paste body
.globl func

whatregs:
    pushl %esi
    call printnum
    pushl %edi
    call printnum
    addl $8, %esp
    ret

func:
    pushl %ebp
    movl %esp, %ebp
    pushl %edi
    pushl %esi

    // movsb -- move a dword
    movl 8(%ebp), %esi
    movl 12(%ebp), %edi

    // printf edi/esi
    call whatregs

    movl 8(%ebp), %eax
    movl $0x1337, %edx
.byte 0xA5

    // edi/esi, no change, right?
    call whatregs

    movl 8(%ebp), %eax
    movsxb (%eax), %edx

    leave
    ret