Mail Archives: djgpp/1997/02/18/13:45:40
chambersb AT juno DOT com (Benjamin D Chambers) wrote:
>Let's say I want to use my own buffer as a temporary stack (I would, of
>course, switch back to the main stack when I'm done). Would I simply
>load %esp with the location of my buffer, plus the size if the buffer?
>Ie:
>int buf[10];
>int old;
>asm("
> movl %%esp, (%%eax)
> movl %%ebx, %%esp
> addl $40, %%esp
> . .
> movl (%%eax), %%esp
>"
>:: "a" (&old), "b" (buf):"memory");
The stack grows downwards. Try:
:: "a" (&old), "b" (&buf[10]) : "memory" );
The first value pushed should then be at buf[9], the next at buf[8],
etc.
- Raw text -