Mail Archives: djgpp-workers/1998/01/20/16:45:51
> Then should I insert the two instructions
>
> mov %ss,%ax
> mov %ax,%ds
>
> next before this instruction?
> call *%ebx /* call the user function */
No, absolutely not. The SS and ESP must be consistent, but they
point to an area of memory provided by the DPMI provider and
thus have a differnt base value than DS. The only way to make
it completely GCC compatible is to allocate a stack in the
DJGPP image space, lock that memory,
set SS=DS, ESP=pointer to top of stack,
execute routine, restore old SS:ESP (which is what the
assembler wrappers do). This also requires that interrupts
not be enabled, the DPMI provider actually does the right thing
and doesn't reenter - or that you have multiple or reentrant
stack changing code.
If you are going to this much trouble, don't bother with the
user handler as implemented, since just chaining the interrupt
is about the same amount of code.
However, if you document the restriction that SS != DS in this
routine, and thus you can't call many subroutines (fast simple
rule) it will work fine.
- Raw text -