fixed the physical to virtual translation issues with DJGPP, watcom just
[dosdemo] / src / dos / cdpmi.h
index 4fc2c30..71138b6 100644 (file)
@@ -3,7 +3,17 @@
 
 #ifdef __DJGPP__
 #include <dpmi.h>
-#endif
+#include <sys/nearptr.h>
+
+#define virt_to_phys(v)        ((v) + __djgpp_base_address)
+#define phys_to_virt(p)        ((p) - __djgpp_base_address)
+
+#else  /* not djgpp (basically watcom) */
+
+#define virt_to_phys(v)        (v)
+#define phys_to_virt(p)        (p)
+
+#endif /* __DJGPP__ */
 
 #include "inttypes.h"
 #include "util.h"
@@ -34,7 +44,8 @@ void dpmi_munmap(void *addr);
                "xor ax, ax" \
                "alloc_skip_err:" \
                value[ax] \
-               parm[ebx][edi];
+               parm[ebx][edi] \
+               modify[dx];
 
 #pragma aux dpmi_free = \
                "mov ax, 0x101" \
@@ -65,7 +76,7 @@ void dpmi_munmap(void *addr);
                "mov ax, cx" \
                value[eax] \
                parm[ebx][esi] \
-               modify[cx di];
+               modify[bx cx di esi];
 
 #pragma aux dpmi_munmap = \
                "mov ax, 0x801" \
@@ -73,7 +84,7 @@ void dpmi_munmap(void *addr);
                "shr ebx, 16" \
                "int 0x31" \
                parm[ebx] \
-               modify[ax];
+               modify[ax cx ebx];
 #endif /* __WATCOMC__ */
 
 #ifdef __DJGPP__