From 68c8cad31c27e9c5bccf1e3852face04794533aa Mon Sep 17 00:00:00 2001
From: Thierno-Souleymane BAH <thiernosouleymane.bah.etu@univ-lille.fr>
Date: Wed, 20 Jan 2021 10:45:17 +0100
Subject: [PATCH] fix(switch_to_ctx function simplfied by deleting some useless
 lines)

---
 try.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/try.c b/try.c
index 254178f..4fa273c 100644
--- a/try.c
+++ b/try.c
@@ -49,30 +49,17 @@ void switch_to_ctx(ctx_t *pctx)
             "\n\t"
             "movl %%ebp, %1"
             : "=r"(current_ctx->esp), "=r"(current_ctx->ebp));
-
-        current_ctx = pctx;
-
-        // Basculer vers pctx
-        asm("movl %0, %%esp"
-            "\n\t"
-            "movl %1, %%ebp "
-            :
-            : "r"(pctx->esp), "r"(pctx->ebp));
     }
-    else
-    {
 
-        current_ctx = pctx;
-        asm("movl %%esp, %0"
-            "\n\t"
-            "movl %%ebp, %1"
-            : "=r"(current_ctx->esp), "=r"(current_ctx->ebp));
-    }
+    current_ctx = pctx;
+    asm("movl %%esp, %0"
+        "\n\t"
+        "movl %%ebp, %1"
+        :
+        : "r"(current_ctx->esp), "r"(current_ctx->ebp));
 
     if (current_ctx->status == CTX_INIT)
-    {
         start_ctx();
-    }
 }
 
 void start_ctx()
-- 
GitLab