added PCI code in anticipation of porting the S3 driver
[dosdemo] / src / dos / cdpmi.h
index 4fc2c30..e8a6950 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"
@@ -19,6 +29,17 @@ struct dpmi_regs {
 } PACKED;
 #pragma pack (pop)
 
+enum {
+       FLAGS_CF        = 0x000001,
+       FLAGS_PF        = 0x000004,
+       FLAGS_ZF        = 0x000040,
+       FLAGS_SF        = 0x000080,
+       FLAGS_IF        = 0x000020,
+       FLAGS_DF        = 0x000040,
+       FLAGS_VM        = 0x020000,
+       FLAGS_ID        = 0x200000,
+};
+
 uint16_t dpmi_alloc(unsigned int par, uint16_t *sel);
 void dpmi_free(uint16_t sel);
 void dpmi_int(int inum, struct dpmi_regs *regs);
@@ -34,7 +55,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 +87,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 +95,7 @@ void dpmi_munmap(void *addr);
                "shr ebx, 16" \
                "int 0x31" \
                parm[ebx] \
-               modify[ax];
+               modify[ax cx ebx];
 #endif /* __WATCOMC__ */
 
 #ifdef __DJGPP__