From f86c4ec15be6d0b51d20c5458dd745e78f9c6f7c Mon Sep 17 00:00:00 2001 From: yuvraj1803 Date: Fri, 10 Nov 2023 22:45:31 +0530 Subject: [PATCH] made current pointer volatile --- core/sched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/sched.c b/core/sched.c index 1157e33..97f0e6d 100644 --- a/core/sched.c +++ b/core/sched.c @@ -20,7 +20,7 @@ extern struct vm* vmlist[CONFIG_MAX_VMs]; extern int total_vms; -struct vm* current; +volatile struct vm* current; void sched_init(){ @@ -86,7 +86,7 @@ void schedule(){ } nextvm = 0; } - struct vm* prev = current; + struct vm* prev = (struct vm*) current; current = vmlist[nextvm]; if(prev == current){ // this will happen when there is only one VM running. @@ -100,5 +100,5 @@ void schedule(){ debug("Context switch: %s --> %s\n", prev->name, current->name); load_vttbr_el2(current->vmid, (uint64_t)current->virtual_address_space->lv1_table); - switch_context(&prev->cpu.context, ¤t->cpu.context); + switch_context(&prev->cpu.context, (struct context*)¤t->cpu.context); }