Skip to content

Commit

Permalink
Finally fix multitasking to work on a PC
Browse files Browse the repository at this point in the history
  • Loading branch information
portasynthinca3 committed Feb 13, 2020
1 parent 963ea51 commit d261c81
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/isr_wrapper.s
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ exc_wrapper_code:
apic_timer_isr_wrap:
;//Disable interrupts
cli
cmp byte ptr [mtask_enabled], 1
;//Save RAX
push rax
;//Check if multitasking is enabled
call mtask_is_enabled
cmp rax, 1
;//Restore RAX
pop rax
;//Return if not
je apic_timer_isr_wrap_cont
;//Re-enable interrupts; send EOI; return
push r15
Expand Down
12 changes: 12 additions & 0 deletions src/mtask/mtask.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,22 @@ uint32_t mtask_cur_task_no;
uint8_t mtask_enabled;
task_t* mtask_cur_task;

/*
* Returns the current task pointer
* (used only by mtask_sw.s)
*/
task_t* mtask_get_cur_task(){
return mtask_cur_task;
}

/*
* Is multitasking enabled?
* (used only by mtask_sw.s)
*/
uint64_t mtask_is_enabled(){
return mtask_enabled;
}

/*
* Initializes the multitasking system
*/
Expand Down
2 changes: 1 addition & 1 deletion src/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#endif

//The kernel version
#define KRNL_VERSION_STR "v0.4.6"
#define KRNL_VERSION_STR "v0.4.7"

//Use WC for memcpy() transfers?
#define STDLIB_MEMCPY_WC
Expand Down

0 comments on commit d261c81

Please sign in to comment.