src/cpuinfo/SDL_cpuinfo.c
changeset 11338 fed4345ff3f2
parent 11308 43e03b947942
child 11700 57a894f4028f
     1.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Mon Aug 21 11:25:04 2017 -0700
     1.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Mon Aug 21 13:00:40 2017 -0700
     1.3 @@ -27,6 +27,13 @@
     1.4  #if defined(__WIN32__)
     1.5  #include "../core/windows/SDL_windows.h"
     1.6  #endif
     1.7 +#if defined(__OS2__)
     1.8 +#define INCL_DOS
     1.9 +#include <os2.h>
    1.10 +#ifndef QSV_NUMPROCESSORS
    1.11 +#define QSV_NUMPROCESSORS 26
    1.12 +#endif
    1.13 +#endif
    1.14  
    1.15  /* CPU feature detection for SDL */
    1.16  
    1.17 @@ -418,6 +425,12 @@
    1.18              SDL_CPUCount = info.dwNumberOfProcessors;
    1.19          }
    1.20  #endif
    1.21 +#ifdef __OS2__
    1.22 +        if (SDL_CPUCount <= 0) {
    1.23 +            DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS,
    1.24 +                            &SDL_CPUCount, sizeof(SDL_CPUCount) );
    1.25 +        }
    1.26 +#endif
    1.27  #endif
    1.28          /* There has to be at least 1, right? :) */
    1.29          if (SDL_CPUCount <= 0) {
    1.30 @@ -719,6 +732,13 @@
    1.31              }
    1.32          }
    1.33  #endif
    1.34 +#ifdef __OS2__
    1.35 +        if (SDL_SystemRAM <= 0) {
    1.36 +            Uint32 sysram = 0;
    1.37 +            DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4);
    1.38 +            SDL_SystemRAM = (int) (sysram / 0x100000U);
    1.39 +        }
    1.40 +#endif
    1.41  #endif
    1.42      }
    1.43      return SDL_SystemRAM;