www.delorie.com/djgpp/v2faq/faq146.html | search |
| Previous | Next | Up | Top |
__dpmi_simulate_real_mode_interrupt.
__dpmi_regs
structure before you call that function. Random values in these members can cause your program to
behave erratically. The members in point are .x.ss
, .x.sp
, and .x.flags
. When .x.ss
and .x.sp
are zeroed, the DPMI host will provide
a stack for the interrupt call. This stack is locked and is 4KB-long for any handling done in protected mode (such as real-mode callbacks), and at least 512 bytes in size for interrupts reflected
into real mode. This is usually enough, but sometimes you'll need to use your own, larger stack, e.g., if you expect interrupts to nest, or if your handler needs a lot of stack space(Note:
The DPMI spec indicates that you should not use the default stack if your procedure/interrupt handler uses more that 60 bytes, or 1/8 of the total stack space available by default.).
In these cases you should point .x.ss
and .x.sp
to a larger buffer which is in conventional memory (possibly part of the transfer buffer). If SS:SP isn't zero, it will be used as the address of the stack for the interrupt handler, so if it points to a random location, your program will most certainly crash. A non-zero FLAGS member can also make the processor do all kinds of weird things (e.g., imagine that the single-step or the debug bit is set!).
If you don't have any reason to set SS:SP to a user-defined stack, it's easier to call the __dpmi_int
library function, which zeroes out the stack pointer and the
FLAGS fields for you (and also doesn't force you to type long function names!).
webmaster donations bookstore | delorie software privacy |
Copyright ⌐ 1998 by Eli Zaretskii | Updated Sep 1998 |
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)