Skip to content

Latest commit

 

History

History
41 lines (25 loc) · 1.24 KB

File metadata and controls

41 lines (25 loc) · 1.24 KB

Code: InterruptHandler.[h, c], ISR.asm, Utility.[h, c], Main.c

Explanation

What does the code do?

a round-robin scheduler and more sophisticated task pool is integrated into MINT64OS.

InterruptHandler.[h, c], ISR.asm, Utility.[h, c]

MINT64OS is preemptive OS, so PIT interrupt calls scheduler to choose a task to run. Interrupt handler must call kScheduleInInterrupt because the way to switch context is different in interrupt context.

ISR.asm just added a function which is just intermediate function that calls function written in C

Utility.c contains a variable that counts the number of PIT interrupt after OS booting. This number is incremented by PIT counter0 interrupt handler

Main.c

Main.c initializes task pool and task scheduler before PIC is activated

C language

  1. volatile (Utility.[h, c]) tells the compiler not to optimize anything that has to do with the volatile variable

    • When you interface with hardware that changes the value itself

    • When there's another thread running that also uses the variable

    • When there's a signal handler that might change the value of the variable

References

  1. Why is volatile needed in C?