From 7b5013604d4ea4c865aff053b87a54d6cd970700 Mon Sep 17 00:00:00 2001 From: Robin Nehls Date: Sat, 21 May 2011 16:43:44 +0200 Subject: modified memmeasure funcions to actually do something in memory this sould show the cache who is the boss. hail to the king baby --- inlineasm.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/inlineasm.h b/inlineasm.h index fc048ca..2779314 100644 --- a/inlineasm.h +++ b/inlineasm.h @@ -9,8 +9,10 @@ static uint32_t optmemmeasure(char* memory, uint32_t offset) "rdtsc ;" "mov %%eax, %%ebp ;" - "cmpb $0x23, (%%ebx) ;" - "cmpb $0x42, (%%ebx, %%ecx) ;" + "movb (%%ebx), %%al ;" + "xor (%%ebx,%%ecx), %%eax ;" + "movb %%al, (%%ebx) ;" + "movb %%al, (%%ebx,%%ecx) ;" "rdtsc ;" "sub %%ebp, %%eax ;" @@ -45,8 +47,10 @@ static uint64_t memmeasure(char* memory, uint64_t offset) // here be magic dragons and memory access (read segfaults) ahead // TODO: evaluate if more cmp types (like w and l) do make sense - "cmpb $0x23, (%%rbx) ;" - "cmpb $0x42, (%%rbx,%%rcx) ;" + "movb (%%rbx), %%al ;" + "xor (%%rbx,%%rcx), %%rax ;" + "movb %%al, (%%rbx) ;" + "movb %%al, (%%rbx,%%rcx) ;" "rdtsc ;" "shl $32, %%rdx ;" @@ -69,8 +73,10 @@ static uint64_t optmemmeasure(char* memory, uint64_t offset) // here be magic dragons and memory access (read segfaults) ahead // TODO: evaluate if more cmp types (like w and l) do make sense - "cmpb $0x23, (%%rbx) ;" - "cmpb $0x42, (%%rbx,%%rcx) ;" + "movb (%%rbx), %%al ;" + "xor (%%rbx,%%rcx), %%rax ;" + "movb %%al, (%%rbx) ;" + "movb %%al, (%%rbx,%%rcx) ;" "rdtsc ;" "sub %%edi, %%eax ;" -- cgit v1.2.3-1-g7c22