Multitasking Systems: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
No edit summary
Line 28: Line 28:
<pre>
<pre>
PUSH ;; put the accumulator's content on stack
PUSH ;; put the accumulator's content on stack
LOAD [current_pid] ;; put it in the accumulator
LOAD [current_pid] ;; load the current PID in the accumulator
STORE_SP [context_table+ACC]
STORE_SP [context_table+ACC] ;; save the stack of the suspended task

;; get somehow the next pid into ACC, without using the stack
;; get somehow the PID for the next task into ACC, without using the stack
STORE [current_pid] ;; we'll need it here for the next run

LOAD_SP [context_table+ACC]
LOAD_SP [context_table+ACC] ;; load the stack of the chosen task
STORE [current_pid] ;; store it's PID
POP ;; get back the accumulator's content
POP ;; get back the accumulator's content
IRET ;; end of interrupt
IRET ;; end of interrupt