home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,748 of 4,675   
   Alex McDonald to Robert Wessel   
   Two stacks (was Manners everyone!)   
   03 Jan 19 20:28:22   
   
   From: alex@nospicedham.rivadpm.com   
      
   [retitled]   
      
   On 03-Jan-19 15:38, Robert Wessel wrote:   
      
   > On Thu, 3 Jan 2019 15:18:27 +0000, Alex McDonald   
   >  wrote:   
   >   
   >> On 03-Jan-19 10:31, Terje Mathisen wrote:   
   >>   
   >>>   
   >>> Personally I rather like passing a few parameters in registers,   
   >>> particularly to leaf functions, but for recursion using the stack is   
   >>> pretty much always at least as good.   
   >>   
   >> One thing I haven't seen discussed here is using two stacks. (It might   
   >> have been, and I've missed it, so apologies in that case. And yes, this   
   >> is very Forth-ish.)   
   >>   
   >> The first stack is for CALL/RET and PUSH/POP (or MOV) pairs for temp   
   >> storage, and is based on xSP; the second stack is the classic   
   >> parameter/locals frame, and can be based off just about any register   
   >> (xBP for instance).   
   >>   
   >> C-type languages use this technique, except the single physical stack   
   >> has the two stacks (call/ret on xSP and frame on xBP) interwoven.   
   >> Separating them out can make for some interesting efficiencies, like   
   >> tail-call elimination, and some significant simplifications.   
   >   
   >   
   > That was the common implementation on IPF, where the register save   
   > stack was separate (and since all calls left return addresses in a   
   > register, that was where return addresses went).  It also prevents   
   > some types of stack-smashing attacks.   
   >   
      
   What is IPF? Apart from stuff about an IPF file format for Atari I can't   
   get any appropriate Google hits.   
      
   --   
   Alex   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca