aboutsummaryrefslogtreecommitdiff
path: root/src/common/physmem.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-02-13 17:29:02 +0200
committerLasse Collin <lasse.collin@tukaani.org>2009-02-13 17:29:02 +0200
commit96c46df7deb231ea68a03d8d1da9de4c774e36d8 (patch)
tree6788af6a63bd9bdc77f318b7581b43e859e1a44c /src/common/physmem.h
parentRemove dead directories from .gitignore. (diff)
downloadxz-96c46df7deb231ea68a03d8d1da9de4c774e36d8.tar.xz
Improve support for DOS-like systems.
Here DOS-like means DOS, Windows, and OS/2.
Diffstat (limited to '')
-rw-r--r--src/common/physmem.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/physmem.h b/src/common/physmem.h
index c9d50394..fb17eac5 100644
--- a/src/common/physmem.h
+++ b/src/common/physmem.h
@@ -34,6 +34,10 @@
# include <windows.h>
#endif
+#ifdef __DJGPP__
+# include <dpmi.h>
+#endif
+
/// \brief Get the amount of physical memory in bytes
///
@@ -76,6 +80,14 @@ physmem(void)
meminfo.dwLength = sizeof(meminfo);
if (GlobalMemoryStatusEx(&meminfo))
ret = meminfo.ullTotalPhys;
+
+#elif defined(__DJGPP__)
+ __dpmi_free_mem_info meminfo;
+ if (__dpmi_get_free_memory_information(&meminfo) == 0
+ && meminfo.total_number_of_physical_pages
+ != (unsigned long)(-1))
+ ret = (uint64_t)(meminfo.total_number_of_physical_pages)
+ * 4096;
#endif
return ret;