diff --git a/libraries/platform/src/platform/backend/AndroidPlatform.cpp b/libraries/platform/src/platform/backend/AndroidPlatform.cpp index 49ac5079ee..ee5a7e39b9 100644 --- a/libraries/platform/src/platform/backend/AndroidPlatform.cpp +++ b/libraries/platform/src/platform/backend/AndroidPlatform.cpp @@ -43,6 +43,5 @@ void AndroidInstance::enumerateComputer(){ _computer[keys::computer::OS] = keys::computer::OS_ANDROID; _computer[keys::computer::vendor] = ""; _computer[keys::computer::model] = ""; - } diff --git a/libraries/platform/src/platform/backend/LinuxPlatform.cpp b/libraries/platform/src/platform/backend/LinuxPlatform.cpp index 5c39ac5a4f..356df27e0a 100644 --- a/libraries/platform/src/platform/backend/LinuxPlatform.cpp +++ b/libraries/platform/src/platform/backend/LinuxPlatform.cpp @@ -25,38 +25,6 @@ void LinuxInstance::enumerateCpu() { _cpu.push_back(cpu); } -/* -void LinuxInstance::enumerateCpu() { - json cpu = {}; - - uint32_t cpuInfo[4]={0,0,0,0}; - char CPUBrandString[16]; - char CPUModelString[16]; - char CPUClockString[16]; - uint32_t nExIds; - getLCpuId(cpuInfo, 0x80000000); - nExIds = cpuInfo[0]; - - for (uint32_t i = 0x80000000; i <= nExIds; ++i) { - getLCpuId(cpuInfo, i); - // Interpret CPU brand string - if (i == 0x80000002) { - memcpy(CPUBrandString, cpuInfo, sizeof(cpuInfo)); - } else if (i == 0x80000003) { - memcpy(CPUModelString, cpuInfo, sizeof(cpuInfo)); - } else if (i == 0x80000004) { - memcpy(CPUClockString, cpuInfo, sizeof(cpuInfo)); - } - } - - cpu[keys::cpu::vendor] = CPUBrandString; - cpu[keys::cpu::model] = CPUModelString; - cpu[keys::cpu::clockSpeed] = CPUClockString; - cpu[keys::cpu::numCores] = std::thread::hardware_concurrency(); - - _cpu.push_back(cpu); -} -*/ void LinuxInstance::enumerateGpu() { GPUIdent* ident = GPUIdent::getInstance(); @@ -82,6 +50,5 @@ void LinuxInstance::enumerateComputer(){ _computer[keys::computer::OS] = keys::computer::OS_LINUX; _computer[keys::computer::vendor] = ""; _computer[keys::computer::model] = ""; - //no implememntation at this time } diff --git a/libraries/platform/src/platform/backend/MACOSPlatform.cpp b/libraries/platform/src/platform/backend/MACOSPlatform.cpp index 6859500531..2607c47d5b 100644 --- a/libraries/platform/src/platform/backend/MACOSPlatform.cpp +++ b/libraries/platform/src/platform/backend/MACOSPlatform.cpp @@ -31,52 +31,7 @@ void MACOSInstance::enumerateCpu() { _cpu.push_back(cpu); } -/* -static void getCpuId( uint32_t* p, uint32_t ax ) -{ -#ifdef Q_OS_MAC - __asm __volatile - ( "movl %%ebx, %%esi\n\t" - "cpuid\n\t" - "xchgl %%ebx, %%esi" - : "=a" (p[0]), "=S" (p[1]), - "=c" (p[2]), "=d" (p[3]) - : "0" (ax) - ); -#endif -} - -void MACOSInstance::enumerateCpu() { - json cpu = {}; - uint32_t cpuInfo[4]={0,0,0,0}; - char CPUBrandString[16]; - char CPUModelString[16]; - char CPUClockString[16]; - uint32_t nExIds; - getCpuId(cpuInfo, 0x80000000); - nExIds = cpuInfo[0]; - - for (uint32_t i = 0x80000000; i <= nExIds; ++i) { - getCpuId(cpuInfo, i); - // Interpret CPU brand string - if (i == 0x80000002) { - memcpy(CPUBrandString, cpuInfo, sizeof(cpuInfo)); - } else if (i == 0x80000003) { - memcpy(CPUModelString, cpuInfo, sizeof(cpuInfo)); - } else if (i == 0x80000004) { - memcpy(CPUClockString, cpuInfo, sizeof(cpuInfo)); - } - } - - cpu[keys::cpu::vendor] = CPUBrandString; - cpu[keys::cpu::model] = CPUModelString; - cpu[keys::cpu::clockSpeed] = CPUClockString; - cpu[keys::cpu::numCores] = std::thread::hardware_concurrency(); - - _cpu.push_back(cpu); -} -*/ void MACOSInstance::enumerateGpu() { GPUIdent* ident = GPUIdent::getInstance(); json gpu = {}; diff --git a/libraries/shared/src/CPUIdent.cpp b/libraries/shared/src/CPUIdent.cpp index 2d04b0867c..ea27cfb3da 100644 --- a/libraries/shared/src/CPUIdent.cpp +++ b/libraries/shared/src/CPUIdent.cpp @@ -15,51 +15,57 @@ #ifdef Q_OS_WIN #include <intrin.h> -void getCPUID(int32_t* p, int32_t ax) { - __cpuid(p, ax); +void getCPUID(uint32_t* p, uint32_t eax) { + __cpuid((int*) p, (int) eax); } -void getCPUIDEX(int32_t* p, int32_t ax, int32_t ecx) { - __cpuidex(p, ax, ecx); +void getCPUIDEX(uint32_t* p, uint32_t eax, uint32_t ecx) { + __cpuidex((int*) p, (int) eax, (int) ecx); } #elif defined(Q_OS_MAC) -void getCPUID(int32_t* p, int32_t ax) { - __asm __volatile - ("movl %%ebx, %%esi\n\t" - "cpuid\n\t" - "xchgl %%ebx, %%esi" - : "=a" (p[0]), "=S" (p[1]), - "=c" (p[2]), "=d" (p[3]) - : "0" (ax) +void getCPUID(uint32_t* p, uint32_t eax) { + __asm__ volatile ( + "movl %%ebx, %%esi \n\t" + "cpuid \n\t" + "xchgl %%ebx, %%esi " + : "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3]) + : "0" (eax) ); } -void getCPUIDEX(int32_t* p, int32_t ax, int32_t ecx) { - getCPUID(p, ax); +void getCPUIDEX(uint32_t* p, uint32_t eax, uint32_t ecx) { + getCPUID(p, eax); } #elif defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) -void getCPUID(int32_t* p, int32_t ax) { - __asm __volatile - ("movl %%ebx, %%esi\n\t" - "cpuid\n\t" - "xchgl %%ebx, %%esi" - : "=a" (p[0]), "=S" (p[1]), - "=c" (p[2]), "=d" (p[3]) - : "0" (ax) +void getCPUID(uint32_t* p, uint32_t eax) { + __asm__ volatile ( + "movl %%ebx, %%esi \n\t" + "cpuid \n\t" + "xchgl %%ebx, %%esi " + : "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3]) + : "0" (eax) ); } -void getCPUIDEX(int32_t* p, int32_t ax, int32_t ecx) { - getCPUID(p, ax); +void getCPUIDEX(uint32_t* p, uint32_t eax, uint32_t ecx) { + getCPUID(p, eax); } #else -void getCPUID(int32_t* p, int32_t ax) { +void getCPUID(uint32_t* p, uint32_t eax) { if (p) { - memset(p, 0, 4*4); + p[0] = 0; + p[1] = 0; + p[2] = 0; + p[3] = 0; } } -void getCPUIDEX(int32_t* p, int32_t ax, int32_t ecx) { - getCPUID(p, ax); +void getCPUIDEX(uint32_t* p, uint32_t eax, uint32_t ecx) { + if (p) { + p[0] = 0; + p[1] = 0; + p[2] = 0; + p[3] = 0; + } } #endif @@ -141,7 +147,7 @@ CPUIdent::CPUIdent_Internal::CPUIdent_Internal() extdata_{} { //int cpuInfo[4] = {-1}; - std::array<int, 4> cpui; + std::array<uint32_t, 4> cpui; // Calling __cpuid with 0x0 as the function_id argument // gets the number of the highest valid function ID. diff --git a/libraries/shared/src/CPUIdent.h b/libraries/shared/src/CPUIdent.h index 68653f9287..dbf0c3ea91 100644 --- a/libraries/shared/src/CPUIdent.h +++ b/libraries/shared/src/CPUIdent.h @@ -105,8 +105,8 @@ private: public: CPUIdent_Internal(); - int nIds_; - int nExIds_; + uint32_t nIds_; + uint32_t nExIds_; std::string vendor_; std::string brand_; bool isIntel_; @@ -117,8 +117,8 @@ private: std::bitset<32> f_7_ECX_; std::bitset<32> f_81_ECX_; std::bitset<32> f_81_EDX_; - std::vector<std::array<int, 4>> data_; - std::vector<std::array<int, 4>> extdata_; + std::vector<std::array<uint32_t, 4>> data_; + std::vector<std::array<uint32_t, 4>> extdata_; }; }; diff --git a/scripts/developer/utilities/render/platform.js b/scripts/developer/utilities/render/platform.js index b51c9614ba..9678bf3ff1 100644 --- a/scripts/developer/utilities/render/platform.js +++ b/scripts/developer/utilities/render/platform.js @@ -10,37 +10,9 @@ PlatformInfo.getNumGPUs() PlatformInfo.getGPU(0) // {"driver":"25.21.14.1967","model":"NVIDIA GeForce GTX 1080","vendor":"NVIDIA GeForce GTX 1080","videoMemory":8079} -var Page = Script.require('./luci/Page.js'); +var window = Desktop.createWindow(Script.resolvePath('./platform.qml'), { + title: "Platform", + presentationMode: Desktop.PresentationMode.NATIVE, + size: {x: 350, y: 700} +}); - -function openView() { - var pages = new Pages(); - function fromQml(message) { - if (pages.open(message.method)) { - return; - } - } - - var platformWindow - - function closeLuciWindow() { - if (luciWindow !== undefined) { - activeWindow.fromQml.disconnect(fromQml); - } - luciWindow = {}; - - Controller.mousePressEvent.disconnect(onMousePressEvent); - Controller.mouseReleaseEvent.disconnect(onMouseReleaseEvent); - Controller.mouseMoveEvent.disconnect(onMouseMoveEvent); - pages.clear(); - } - - pages.addPage('Platform', 'Platform', '../platform.qml', 350, 700); - pages.open('Platform'); - - - return pages; -} - - -openView();