From a112c5a479e6618c8e8b9e185beefe3ae34c449d Mon Sep 17 00:00:00 2001
From: "Griffin, Matt J (PG/R - Computer Science)" <matt.griffin@surrey.ac.uk>
Date: Sat, 8 Apr 2023 13:54:27 +0100
Subject: [PATCH] attempt to force ex 2 and ex 13 to inline, fix typos

---
 BCB/Paul Kocher/Example 1/ex01_optimal.c |  10 +++++-----
 BCB/Paul Kocher/Example 13/ex13.c        |   2 +-
 BCB/Paul Kocher/Example 2/ex02.c         |   2 +-
 BCB/Paul Kocher/Example 7/ex07.c         |   2 +-
 BCB/Paul Kocher/Example 7/msvc/ex07.bir  | Bin 178848 -> 178848 bytes
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/BCB/Paul Kocher/Example 1/ex01_optimal.c b/BCB/Paul Kocher/Example 1/ex01_optimal.c
index 7374888..0719a27 100644
--- a/BCB/Paul Kocher/Example 1/ex01_optimal.c	
+++ b/BCB/Paul Kocher/Example 1/ex01_optimal.c	
@@ -2,9 +2,9 @@
 
 __declspec(dllexport)
 void optimal_solution_v01(size_t x) {
-     if (x < array1_size) {
-        uint8_t v = array1[x] * 512;
-        _mm_lfence();
-        temp &= array2[v];
-     }
+   if (x < array1_size) {
+      uint8_t v = array1[x] * 512;
+      _mm_lfence();
+      temp &= array2[v];
+   }
 }
diff --git a/BCB/Paul Kocher/Example 13/ex13.c b/BCB/Paul Kocher/Example 13/ex13.c
index 09b9270..c4973bc 100644
--- a/BCB/Paul Kocher/Example 13/ex13.c	
+++ b/BCB/Paul Kocher/Example 13/ex13.c	
@@ -1,6 +1,6 @@
 #include "../ex_main.h"
 
-__inline int is_x_safe(size_t x) { if (x < array1_size) return 1; return 0; }
+__forceinline int is_x_safe(size_t x) { if (x < array1_size) return 1; return 0; }
 
 __declspec(dllexport)
 void victim_function_v13(size_t x) {
diff --git a/BCB/Paul Kocher/Example 2/ex02.c b/BCB/Paul Kocher/Example 2/ex02.c
index e74e750..ee29426 100644
--- a/BCB/Paul Kocher/Example 2/ex02.c	
+++ b/BCB/Paul Kocher/Example 2/ex02.c	
@@ -1,6 +1,6 @@
 #include "../ex_main.h"
 
-void leakByteLocalFunction_v02(uint8_t k) {
+__forceinline void leakByteLocalFunction_v02(uint8_t k) {
      temp &= array2[(k)* 512];
 }
 
diff --git a/BCB/Paul Kocher/Example 7/ex07.c b/BCB/Paul Kocher/Example 7/ex07.c
index fc83413..6662f50 100644
--- a/BCB/Paul Kocher/Example 7/ex07.c	
+++ b/BCB/Paul Kocher/Example 7/ex07.c	
@@ -1,7 +1,7 @@
 #include "../ex_main.h"
 
 __declspec(dllexport)
-void optimal_sol_v07(size_t x) {
+void victim_function_v07(size_t x) {
     static size_t last_x = 0;
     if (x == last_x)
         temp &= array2[array1[x] * 512];
diff --git a/BCB/Paul Kocher/Example 7/msvc/ex07.bir b/BCB/Paul Kocher/Example 7/msvc/ex07.bir
index b470857bf61229768d09cf66cefa0faa12db6e99..d96e0ccb0a0f990d62e97da9c84aeffb3d2fcc37 100644
GIT binary patch
delta 127
zcmZ4Rm21IQt_^z3wq*>N49N^7Kr)vho*|8)lpznw&j+$J81TwZKG-Wi{lXk3mdSn0
WY_fQjHg9BZ-^k3keIql|`)vSPvm#9Z

delta 127
zcmZ4Rm21IQt_^z3w)qSN3?&Si47m)63^@$(48;ujV7iRKfWe$W1IWW8Klxy<{PYWR
cm{=zFF|*0yRoc9fxqTxu<MxfrOz*b=024zX_W%F@

-- 
GitLab