Skip to content

Commit

Permalink
made current pointer volatile
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvraj1803 committed Nov 10, 2023
1 parent 57d4d9f commit f86c4ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(){

Expand Down Expand Up @@ -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.
Expand All @@ -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, &current->cpu.context);
switch_context(&prev->cpu.context, (struct context*)&current->cpu.context);
}

0 comments on commit f86c4ec

Please sign in to comment.