Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.msdos.programmer > #1439

Re: Stack overflow: how to monitor stack usage?

From Johann Klammer <klammerj@NOSPAM.a1.net>
Newsgroups comp.os.msdos.programmer
Subject Re: Stack overflow: how to monitor stack usage?
Date 2014-07-25 12:07 +0200
Organization Aioe.org NNTP Server
Message-ID <lqta7u$m48$1@speranza.aioe.org> (permalink)
References <53d15c6d$0$2178$426a34cc@news.free.fr> <lqrp2q$8ij$1@speranza.aioe.org> <53d1f727$0$1977$426a74cc@news.free.fr>

Show all headers | View raw


On 07/25/2014 08:20 AM, Mateusz Viste wrote:
> Hi,
>
> On 07/24/2014 10:08 PM, Johann Klammer wrote:> Are you perhaps calling
> libc routines from inside an interrupt context?
>  > At least the watcom compiler checks the STACK address against some
>  > internal variables. Others possibly do, too. Compact model clib may
>  > expect the stack to be in the same data seg as everything else. This
>  > is not necessarily true for interrupt stacks. clib is not necessarily
>  > reentrant. Especially the parts that call Dos for I/O -> Don't call
>  > clib from int context.
>
> Well, I do use an interrupt handler, but no, I don't use any libc calls
> from within it (not that I am aware of, at least). But truth is that my
> stack overflow troubles begun since I started playing with the PIT
> interrupt.. so it's not impossible is wrong with my code. However, it's
> so simple code that I don't really know what could be wrong there. The
> actual code is hosted here:
>
> http://sourceforge.net/p/dosmid/code/HEAD/tree/timer.c
>
> What I do is that I reprogram the PIT to be much faster than the default
> 18.2hz, and hook my own interrupt handler on the PIT IRQ to increment a
> long counter I use for timing.
>
>  > If it's in application context, just look for array auto vars and
>> replace them by ptrs+malloc.
>
> Yes, that's a theory I'm aware of, and of course I never try to allocate
> too much on the stack.
>
> cheers,
> Mateusz
I see you are calling the previous handler to keep sys timing 
consistent. I believe you are supposed to use chain_intr or sthg 
instead... because of the iret which takes a bit more off the stack than 
just a return address... register image... (It' ll _under_run)

Back to comp.os.msdos.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Stack overflow: how to monitor stack usage? Mateusz Viste <mateusz.viste@localhost> - 2014-07-24 21:20 +0200
  Re: Stack overflow: how to monitor stack usage? Johann Klammer <klammerj@NOSPAM.a1.net> - 2014-07-24 22:08 +0200
    Re: Stack overflow: how to monitor stack usage? Mateusz Viste <mateusz.viste@localhost> - 2014-07-25 08:20 +0200
      Re: Stack overflow: how to monitor stack usage? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-25 04:34 -0400
        Re: Stack overflow: how to monitor stack usage? Mateusz Viste <mateusz.viste@localhost> - 2014-07-25 12:53 +0200
      Re: Stack overflow: how to monitor stack usage? Johann Klammer <klammerj@NOSPAM.a1.net> - 2014-07-25 12:07 +0200
        Re: Stack overflow: how to monitor stack usage? Mateusz Viste <mateusz.viste@localhost> - 2014-07-25 12:48 +0200
          Re: Stack overflow: how to monitor stack usage? Johann Klammer <klammerj@NOSPAM.a1.net> - 2014-07-25 13:18 +0200
            Re: Stack overflow: how to monitor stack usage? Mateusz Viste <mateusz.viste@localhost> - 2014-07-25 14:06 +0200
              Re: Stack overflow: how to monitor stack usage? Johann Klammer <klammerj@NOSPAM.a1.net> - 2014-07-25 14:48 +0200
                Re: Stack overflow: how to monitor stack usage? Mateusz Viste <mateusz.viste@localhost> - 2014-07-25 15:03 +0200
              Re: Stack overflow: how to monitor stack usage? Johann Klammer <klammerj@NOSPAM.a1.net> - 2014-07-25 14:59 +0200
                Re: Stack overflow: how to monitor stack usage? Mateusz Viste <mateusz.viste@localhost> - 2014-07-25 15:08 +0200
  Re: Stack overflow: how to monitor stack usage? Sjouke Burry <burrynulnulfour@ppllaanneett.nnll> - 2014-07-25 00:24 +0200
    Re: Stack overflow: how to monitor stack usage? Mateusz Viste <mateusz.viste@localhost> - 2014-07-25 08:32 +0200
  Re: Stack overflow: how to monitor stack usage? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-25 01:42 -0400
    Re: Stack overflow: how to monitor stack usage? Mateusz Viste <mateusz.viste@localhost> - 2014-07-25 08:45 +0200
  Re: Stack overflow: how to monitor stack usage? Mateusz Viste <mateusz.viste@localhost> - 2014-07-25 21:26 +0200
    Re: Stack overflow: how to monitor stack usage? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-25 16:28 -0400

csiph-web