www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/05/16:01:18

From: Roman Suzi <nuser AT rsuzi DOT pgu DOT karelia DOT ru>
Newsgroups: comp.os.msdos.djgpp
Subject: General Protection Fault Interception vs. Stack checks
Date: Mon, 03 Nov 97 17:39:53 +0300
Distribution: world
Organization: unknown
Message-ID: <ADv8UNq4WL@rsuzi.pgu.karelia.ru>
Sender: news-service AT sampo DOT karelia DOT ru
Reply-To: nuser AT rsuzi DOT pgu DOT karelia DOT ru
Lines: 48
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi!

It is now clear how to check free stack space:

Eli Zaretskii wrote:
>Here's one version of `_stackavail' function:
>
>static __inline__ int _stackavail(void)
>{
>  extern unsigned __djgpp_stack_limit;
>  unsigned sp;
>  __asm__ __volatile__ ("movl %%esp,%k0\n" : "=r" (sp) : );
>  return (int)(sp - __djgpp_stack_limit);
>}

Thank you! Its better than nothing.

Meanwhile I contacted a person who reported similar problem
(about mmap() )
as me and have not found solution to it yet.

As he stated, sometimes, stack-availability checks are inacceptable due to
their inefficiency and are trusted to the hardware.

HOWEVER:
My posting about Fighting Gen.Prot.Faults
was addressing the question is there any mechanism
in DJGPP to intercept GPEs, caused by stack overflow ?

It seems, there is not any...
Possibly, existing DPMIs are not permitting to
intercept GPF of stack frame.

I think, this GPF interception question could be important to people,
writing interpreters and stack-greedy real-time applications.
So, if someone can enlighten us on the topic,
you are welcome!


Roman.


--
 --               *                            --
--  Roman A. Suzi * Petrozavodsk Karelia Russia --
 --    http://sampo.karelia.ru/~rnd            --


- Raw text -


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