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