Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

PC/TCP in protected mode

HarkonnenHarkonnen Novosibirsk, RussiaPosts: 0Member

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; begin asm pushf call dword ptr [oldtimer] cli end; if mutex = 0 then begin mutex := 1; asm sti end; result := vpmPasTcpClose(conn); asm cli end; mutex := 0; end; end;

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?

Tagged:
Sign In or Register to comment.