[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE
From: |
Emilio G. Cota |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE |
Date: |
Tue, 6 Jun 2017 17:38:08 -0400 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Tue, Jun 06, 2017 at 22:28:23 +0200, Geert Martin Ijewski wrote:
> On a fully patched Windows 10 with an i5-4690 this code works for me (TM):
Thanks!
Can you please test this?
Emilio
---
#include "qemu/osdep.h"
#include <windows.h>
static unsigned int linesize_win(PROCESSOR_CACHE_TYPE type)
{
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buf;
DWORD size = 0;
unsigned int ret = 0;
BOOL success;
size_t n;
size_t i;
success = GetLogicalProcessorInformation(0, &size);
if (success || GetLastError() != ERROR_INSUFFICIENT_BUF) {
return 0;
}
buf = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)g_malloc0(size);
if (!GetLogicalProcessorInformation(buf, &size)) {
goto out;
}
n = size / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
for (i = 0; i < n; i++) {
if (buf[i].Relationship == RelationCache &&
buf[i].Cache.Level == 1 &&
(buf[i].Cache.Type == CacheUnified ||
buf[i].Cache.Type == type)) {
ret = buf[i].Cache.LineSize;
break;
}
}
out:
g_free(buf);
return ret;
}
linesize_win(CacheInstruction);
linesize_win(CacheData);
- [Qemu-devel] [PATCH v2 0/3] tcg: allocate TB structs preceding translated code, Emilio G. Cota, 2017/06/05
- [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE, Emilio G. Cota, 2017/06/05
- Re: [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE, Pranith Kumar, 2017/06/06
- Re: [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE, Richard Henderson, 2017/06/06
- Re: [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE, Emilio G. Cota, 2017/06/06
- Re: [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE, Richard Henderson, 2017/06/06
- Re: [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE, Geert Martin Ijewski, 2017/06/06
- Re: [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE,
Emilio G. Cota <=
- Re: [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE, Geert Martin Ijewski, 2017/06/06
[Qemu-devel] [PATCH v2 2/3] tests: use QEMU_CACHELINE_SIZE instead of hard-coding it, Emilio G. Cota, 2017/06/05
[Qemu-devel] [PATCH v2 3/3] tcg: allocate TB structs before the corresponding translated code, Emilio G. Cota, 2017/06/05