Mail Archives: djgpp/1995/01/12/02:26:51
> 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 -