www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/01/12/02:26:51

To: Dirk Zabel <dzabel AT cs DOT tu-berlin DOT de>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: _go32_dpmi_simulate_int crashes
Date: Thu, 12 Jan 95 08:53:27 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>

> As a first exercise, I have written a trivial program, 
> which shows the mouse cursor, let me play around with
> the mouse keysm, hides the mouse again and finishes.
> Unfortuanetely every third time or so (not deterministic)
> the program crashes ON EXIT. Maybe someone has an idea

One thing you definitely do wrong is that you don't zero-out
certain fields of the _go32_dpmi_registers structure before
calling  _go32_dpmi_simulate_int().  Specifically, you should
set the regs.x.ss, regs.x.sp and regs.x.flags to zero.  If
SS and SP are NOT zero, the DPMI call will use the address
they point to as the stack for the interrupt handler you call.
In your case, these hold random values, which is bound to crash
your machine, although under VCPI I found this to not always
happen immediately.  If they are zero, go32 (or some true DPMI
server) will provide its own default stack.
The flags value is used to set the CPU flags register when
calling the interrupt, so random values there might also wreak
havoc on your machine.

- Raw text -


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