]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
libpci: djgpp: Handle Windows NTVDM zero error codes
authorPali <pali@pali.im>
Sat, 21 Jun 2025 15:21:01 +0000 (17:21 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 21 Jun 2025 15:33:52 +0000 (17:33 +0200)
Windows NTVDM DPMI host clears the AX register for unsupported DPMI calls.
So handle zero error code as ENOSYS instead of default case EACCES.

lib/physmem-djgpp.c

index 4215069341221f31ad68eda46a492a9da7f219b1..a3c0733fc6bd4db20191609b3cd562673074eb03 100644 (file)
@@ -163,6 +163,7 @@ set_and_get_page_attributes(__dpmi_meminfo *mi, short *attributes)
       free(attributes);
       switch (error)
         {
+        case 0x0000: /* Unsupported function (returned by Windows NTVDM, error number is cleared) */
         case 0x0507: /* Unsupported function (returned by DPMI 0.9 host, error number is same as DPMI function number) */
         case 0x8001: /* Unsupported function (returned by DPMI 1.0 host) */
           errno = ENOSYS;
@@ -196,6 +197,7 @@ set_and_get_page_attributes(__dpmi_meminfo *mi, short *attributes)
       free(attributes);
       switch (error)
         {
+        case 0x0000: /* Unsupported function (returned by Windows NTVDM, error number is cleared) */
         case 0x0506: /* Unsupported function (returned by DPMI 0.9 host, error number is same as DPMI function number) */
         case 0x8001: /* Unsupported function (returned by DPMI 1.0 host) */
           errno = ENOSYS;
@@ -540,6 +542,7 @@ physmem_map(struct physmem *physmem, u64 addr, size_t length, int w)
                         aligned_free(ptr);
                       switch (error)
                         {
+                        case 0x0000: /* Unsupported function (returned by Windows NTVDM, error number is cleared) */
                         case 0x0509: /* Unsupported function (returned by DPMI 0.9 host, error number is same as DPMI function number) */
                         case 0x8001: /* Unsupported function (returned by DPMI 1.0 host) */
                           /*
@@ -583,6 +586,7 @@ physmem_map(struct physmem *physmem, u64 addr, size_t length, int w)
                     aligned_free(ptr);
                   switch (error)
                     {
+                    case 0x0000: /* Unsupported function (returned by Windows NTVDM, error number is cleared) */
                     case 0x0508: /* Unsupported function (returned by DPMI 0.9 host, error number is same as DPMI function number) */
                     case 0x8001: /* Unsupported function (returned by DPMI 1.0 host) */
                       errno = ENOSYS;
@@ -909,6 +913,7 @@ retry_via_indirect_change:
             {
               switch (__dpmi_error)
                 {
+                case 0x0000: /* Unsupported function (returned by Windows NTVDM, error number is cleared) */
                 case 0x0801: /* Unsupported function (returned by DPMI 0.9 host, error number is same as DPMI function number) */
                 case 0x8001: /* Unsupported function (returned by DPMI 1.0 host) */
                   errno = ENOSYS;