[an error occurred while processing this directive] Node:_go32 vs __dpmi, Next:, Previous:Hardware interrupts, Up:Low-level

18.10 Should I use _go32_XXX or __dpmi_YYY functions?

Q: In v1.x I was used to the _go32_... functions, but now comes v2 which also has __dpmi_... functions. Are there any differences between these two varieties?

Q: Do I need to convert my old v1.x code to use the new __dpmi_... functions?

A: These two groups of functions have different functionality, so don't just substitute the new ones for the older ones, because it usually won't work! The new __dpmi_... functions are just bare-bones wrappers of the DPMI API calls36 (see DPMI Specification), generally unsuitable for use with handlers written in C, whereas the old _go32_... functions are intelligent helper routines which only make sense if your interrupt handlers are C functions. They save all the registers on the stack (to be restored before return to caller), and set up DS, SS, and ES registers as GCC assumes in the code it produces for a C program. If these assumptions are wrong, the C functions called by an interrupt handler will crash miserably.

The problem with the _go32_... functions is that they don't lock all the code and data that your handlers use, so they can crash on memory-tight machines and thus aren't suitable for production-quality code. But they are certainly useful in the initial stages of writing and debugging code that hooks hardware interrupts, and for migrating existing v1.x code to v2. Some of the old names were just #defined to the new names where the functionality is identical.

The bottom line is that it shouldn't be necessary to convert your code for it to work at least as well as it did in v1.x; but if you want it to be more stable, you should rewrite your handlers in assembly and use the new __dpmi_... functions. See How to install a hardware interrupt handler.


[an error occurred while processing this directive]