Question

I have to save floating-point registers into the stack.
I tried to use fsave instruction.
I do the following:

fsave (%esp)

But as an argument fsave uses 16 byte aligned address.

I don't have an idea how to make address in %esp be 16 byte aligned.

Was it helpful?

Solution

Using intel style syntax:

    push    ebp             ;save ebp
    mov     ebp,esp         ;save esp in ebp
    and     esp,0fffffff0h  ;round esp down to 16 byte boundary
    sub     esp,128         ;allocate multiple of 16 bytes
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top