Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


PC/TCP in protected mode

HarkonnenHarkonnen Novosibirsk, RussiaMember Posts: 0

Hello! I am trying to do PC/TCP calls from a timer interrupt handling routine in Borland Pascal 7.0 under MSDOS 6.22. In real mode everything works OK, but in protected mode application hangs together with DOS. Namely, timer interrupt is intercepted in protected mode (using SetIntVec). The interrupt handling routine calls the previous handler (using pushf/call dword ptr) and then tries to call the PC/TCP close connection function (using the "simulate real mode interrupt" DPMI service):

procedure TimerInt; interrupt;
call dword ptr [oldtimer]
if mutex = 0 then begin
mutex := 1;
result := vpmPasTcpClose(conn);
mutex := 0;

As you can see. some measures have been done against calling PC/TCP close reentrantly. If I comment out the PC/TCP call, everything works OK, so it seems to me that the problem is in calling PC/TCP. I failed to fix this:
1) It does not matter whether I intercept int $08 or int $1c - everything is the same.
2) Locking code segments using {$C FIXED PERMANENT} directive does not help.
3) Switching to a specially allocated new stack after calling the previous handler (and restoring the original stack pointer after PC/TCP call) does not help.
4) Using "call real mode procedure with an IRET frame" DPMI function instead of "simulate real mode interrupt" does not help.
5) Providing a real mode stack for the PC/TCP call (by allocating a real mode memory block and placing its address in the DPMI real mode registers structure) does not help.
In any case DOS hangs.
As I noted above, in real mode everything is OK (of course, in real mode I am using int $61 directly instead of DPMI). Calling the same close connection function in protected mode from the main code (not from the interrupt handler) does work.
What may I be doing wrong? Is there anything else that I don't take into account? Is it anything in PC/TCP that prevents calling it from an interrupt handler? If so, what to do?

Sign In or Register to comment.