实时操作系统中的进程调度与通信机制
1. 抢占式实时操作系统
在实时操作系统中, portRESTORE_CONTEXT 这一操作在上下文恢复方面起着关键作用。以下是其对应的汇编语言代码:
LDR
R0, =pxCurrentTCB
LDR
R0, [R0]
LDR
LR, [R0]
/* The critical nesting depth is the first item on the
stack. */
/* Load it into the ulCriticalNesting variable. */
LDR
R0, =ulCriticalNesting
LDMFD
LR!, {R1}
STR
R1, [R0]
/* Get the SPSR from the stack. */
LDMFD
LR!, {R0}
MSR
SPSR, R0
/* Restore all system mode registers for the task. */
LDMFD
LR, {R0-R14}ˆ
NOP
/* Restore the return address. */
LDR
LR, [LR, #+60]
/* And return - correcting the offset in the LR to obtain
the */
/* correct address. */
SUBS
PC, LR, #4
此代码的主要功能是恢复当前进程的上下文,确保进程能够从之前暂停的位置继续执行。
1.1 进程与面向对象设计
在系统设计中,我们可
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



