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


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

Re: Stack overflow: how to monitor stack usage?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail
From "Rod Pemberton" <dont_use_email@xnothavet.cqm>
Newsgroups comp.os.msdos.programmer
Subject Re: Stack overflow: how to monitor stack usage?
Date Fri, 25 Jul 2014 04:34:14 -0400
Organization Aioe.org NNTP Server
Lines 50
Message-ID <op.xjjorctg6zenlw@localhost> (permalink)
References <53d15c6d$0$2178$426a34cc@news.free.fr> <lqrp2q$8ij$1@speranza.aioe.org> <53d1f727$0$1977$426a74cc@news.free.fr>
NNTP-Posting-Host CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-1; format=flowed; delsp=yes
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Opera Mail/12.16 (Linux)
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.os.msdos.programmer:1438

Show key headers only | View raw


On Fri, 25 Jul 2014 02:20:23 -0400, Mateusz Viste  
<mateusz.viste@localhost> wrote:

> 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:
>
> [link to timer.c]

 From reading your posted and linked to code, I'm not sure
what is incorrect here or with your XMS call.

Basically, I've not used Turbo C.  I do use OpenWatcom
which is similar in some respects.

If you don't have it, start by grabbing the Turbo C documentation:
http://bitsavers.trailing-edge.com/pdf/borland/turbo_c/

Next, some things I'd check:
1) (in timer.c) try setting the PIT to the default speed
2) (in timer.c) try not calling oldfunc()
3) (in timer.c) try moving "static int callmod = 0;" to just
   below "static void interrupt (*oldfunc)(void);"
4) (in timer.c) try removing all the 'static' keywords,
    after moving callod as in #3
5) (in xms_move) try not calling xmsdrv()
6) (in xms_move) try changing 'far *' to 'huge *'
7) (in xms_move) check if the xmsdrv() pointer is correct
8) (in xms_move) check if xmsdrv() is called and returned from

#1 checks if the code works correctly without a timing change.
  (You'll likely need to comment out the 'callmod%=64' line, etc.)
#2 checks if it's an issue with calling the original interrupt
#3 checks the placement of callmod, intended to be used with #4
#4 'static' shouldn't be needed
#5 checks if it's an issue with calling the xmsdrv() or XMS
#6 checks if it's an issue with segment:offset boundaries
#7 checks if the xmsdrv() function pointer is correct
#8 checks if the xmsdrv() is calling XMS and returning correctly

I don't know what you've done or tested so far, or if any of
these will produce any useful results.  It's just stuff I'd
check first.  You can put 'static' etc back in after you've
located the problem.


Rod Pemberton

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