summaryrefslogtreecommitdiff
path: root/attack_code/evict_load/victim.asm
diff options
context:
space:
mode:
Diffstat (limited to 'attack_code/evict_load/victim.asm')
-rw-r--r--attack_code/evict_load/victim.asm22
1 files changed, 22 insertions, 0 deletions
diff --git a/attack_code/evict_load/victim.asm b/attack_code/evict_load/victim.asm
new file mode 100644
index 000000000..bd3effbc3
--- /dev/null
+++ b/attack_code/evict_load/victim.asm
@@ -0,0 +1,22 @@
+; code similar to gcc -O2 -c victim.c, working on gem5
+; it doesn't store rdi to stack as -O0
+
+extern array1
+extern array2
+extern array_size
+
+global victim
+
+victim:
+xor eax, eax
+cmp [rel array_size], rdi
+jbe fret
+lea rax, [rel array1]
+add rax, rdi
+movzx eax, byte [rax]
+shl eax, 6
+cdq
+lea rdx, [rel array2]
+mov eax, [rdx + rax]
+fret:
+rep ret