cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/17/12:21:12

Date: Sun, 17 Oct 1999 14:44:19 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Alex Mendes da Costa <alexmdc AT virtualis DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Hooking Interrupts
In-Reply-To: <3808656A.F523EB85@virtualis.com>
Message-ID: <Pine.SUN.3.91.991017144358.25053g-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sat, 16 Oct 1999, Alex Mendes da Costa wrote:

> This code compiles just fine, and it runs fine until I press a key,
> which I am guessing calls my interrupt, then it stuffs up my computer
> completely.

On what OS?  DOS? Windows?

> I am guessing the problem is in the regions I am trying to lock with
> __dpmi_lock_linear_region, and I have read through loads of docs and FAQ
> but for the life of me I can't figure out why it wont work!

I already replied once to a similar message of yours, with the advice
to try the _go32_xxx helper functions first, and write your handler in
C, not in NASM.  Did you try that?

The _go32_xxx helper functions make it a lot easier by taking care of
many gory details for you.

>   region.handle = 0;

Don't do this!  And zero out the `region' variable before assigning
values to its members (with a call to memset).

>   /* Lock the stack */
>   __dpmi_get_segment_base_address(_my_ss(), &baseaddr);
>   region.handle = 0;
>   region.size = 10;
>   region.address = baseaddr;
>   __dpmi_lock_linear_region(&region);

Don't do this.  You cannot lock the stack like that, the above code is
very dangerous.  If you want the entire stack locked, it is simpler to
lock everything with the _CRT0_FLAG_LOCK_MEMORY bit.

The usual way to solve problems with stack is not to use the normal C
stack inside the interrupt handler.  The handler is called on a locked
stack provided by the DPMI server, so for small amount of push/pop
instructions it should me more than adequate.  Simply don't switch to
the C stack, and you will not need to lock the stack at all.

>   i = 0;
>   do {
>     /* Endless loop? */
>   } while (i == 0);

How do you expect to exit this loop?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019