Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!hub!dougp From: dougp@voodoo.ucsb.edu Newsgroups: comp.sys.amiga Subject: Stack Message-ID: <2105@hub.UUCP> Date: 22 Jul 89 03:49:07 GMT Sender: news@hub.UUCP Organization: UC, Santa Barbara. Physics Computer Services Lines: 20 -Message-Text-Follows- Is there any particular reasor that no microprocessor has limit registors for the stack? What I mean by limit registers is a pair of registors which contains the minimum alowable stack address and the maximum alowable stack address, and cause an exception, trap or interrupt when some code attempts to move the stack pointer out of the range they discribe. Asside from making stack problems much easier to find, this would make it possible to build code which had a dinamicly sized stack. When you got a stack overflow, the exception handler could alocate a new block of memory, move the stack ponter to this new memory and reset the limits. The stack underflow would work similarly, freeing the extra stack space and moving the stack pointer to the previous block. Now this could get a bit messy if you were in a tight loop which was pushing and poping right at the discontinuity of the stack, but this would cirtainly aleviate the problems with programs that sometimes need 200000 bytes of stack when you've only alocated 4000. Douglas Peale