From de4cfd13f659ed8de8da64a8a467388ca169dc16 Mon Sep 17 00:00:00 2001 From: Pali Date: Sat, 21 Jun 2025 17:21:01 +0200 Subject: [PATCH] libpci: djgpp: Handle Windows NTVDM zero error codes 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/physmem-djgpp.c b/lib/physmem-djgpp.c index 4215069..a3c0733 100644 --- a/lib/physmem-djgpp.c +++ b/lib/physmem-djgpp.c @@ -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; -- 2.39.5