summaryrefslogtreecommitdiff
path: root/attack_code/evict_load/victim.asm
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2019-04-10 16:00:23 +0800
committerIru Cai <mytbk920423@gmail.com>2019-04-10 16:01:44 +0800
commit612ad09b9825a032742ae2a2de20628bac97154b (patch)
treee4ebce3e6c9c8160e1dd3874547c9b1fec835679 /attack_code/evict_load/victim.asm
parent368bf919c17cab706fdf19294c07600c3f436f8f (diff)
downloadgem5-612ad09b9825a032742ae2a2de20628bac97154b.tar.xz
add evice+reload attack code
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