www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/18/22:14:12

To: djgpp AT delorie DOT com
Subject: Re: Custom Stack?
Message-ID: <19970218.190800.2143.0.chambersb@juno.com>
References: <19970217 DOT 193154 DOT 4951 DOT 0 DOT chambersb AT juno DOT com>
<5ecodg$f6j$1 AT troll DOT powertech DOT no>
From: chambersb AT juno DOT com (Benjamin D Chambers)
Date: Tue, 18 Feb 1997 22:05:45 EST

On Mon, 17 Feb 1997 03:01:54 GMT ovek AT arcticnet DOT no (Ove Kaaven) writes:
>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.
That was what the +40 was for - each integer is 4 bytes, 10 of them is
40.  However, that does not solve the problem.

...Chambers

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019