From 429910b2ba67611d8df60d1a9da9641bdb5f82b4 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sat, 5 Sep 2009 18:39:21 +0300 Subject: Add OS/2-specific code to physmem.h. Also move DJGPP-specific code near the code meant for other DOS-like systems. --- src/common/physmem.h | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/common/physmem.h b/src/common/physmem.h index 74ea39e3..6ca6eafe 100644 --- a/src/common/physmem.h +++ b/src/common/physmem.h @@ -22,6 +22,13 @@ # endif # include +#elif defined(__OS2__) +# define INCL_DOSMISC +# include + +#elif defined(__DJGPP__) +# include + #elif defined(HAVE_PHYSMEM_SYSCONF) # include @@ -35,9 +42,6 @@ #elif defined(HAVE_PHYSMEM_SYSINFO) # include - -#elif defined(__DJGPP__) -# include #endif @@ -79,6 +83,20 @@ physmem(void) ret = meminfo.dwTotalPhys; } +#elif defined(__OS2__) + unsigned long mem; + if (DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, + &mem, sizeof(mem)) == 0) + ret = mem; + +#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; + #elif defined(HAVE_PHYSMEM_SYSCONF) const long pagesize = sysconf(_SC_PAGESIZE); const long pages = sysconf(_SC_PHYS_PAGES); @@ -118,14 +136,6 @@ physmem(void) struct sysinfo si; if (sysinfo(&si) == 0) ret = (uint64_t)(si.totalram) * si.mem_unit; - -#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; -- cgit v1.2.3