📄 os_cpu_reg_a.s
字号:
;
;*******************************************************************************************
; uC/OS-II
; The Real-Time Kernel
;
; (c) Copyright 2006, Micrium, Weston, FL
; All Rights Reserved
;
;
; PIC24FJ128GA010 MPLab Port
;
;
; File : os_cpu_regs_a.s
; By : 不负责任的天使(^_^)
; Port Version : V2.51
;*******************************************************************************************
; INCLUDE
;
;.include "P24FJ128GA010.inc"
;
;*******************************************************************************************
; MACRO OS_REGS_SAVE
;
; Description : This macro saves the current state of the CPU onto the current tasks stack
;
; Notes : W15 is the CPU stack pointer. It should never be pushed from the stack during
; a context save.
;*******************************************************************************************
;
.macro OS_REGS_SAVE ; Start of Macro
push.d w0 ; Push W0 and W1onto the stack
push.d w2 ; Push W2 and W3onto the stack
push.d w4 ; Push W4 and W5onto the stack
push.d w6 ; Push W6 and W7onto the stack
push.d w8 ; Push W8 and W9onto the stack
push.d w10 ; Push W10 and W11onto the stack
push.d w12 ; Push W12 and W13onto the stack
push w14 ; Push W14 **ONLY**onto the stack
push TBLPAG ; Push the Table PageRegister onto the stack
push PSVPAG ; Push the Program Space Visibility Register onto the stack
push RCOUNT ; Push the Repeat Loop Counter Register onto the stack
push SR ; Push the CPU StatusRegister onto the stack
push CORCON ; Push the Core Control Register onto the stack
.endm ; End of Macro
;
;*******************************************************************************************
; MACRO OS_REGS_RESTORE
;
; Description : This macro restores the current state of the CPU from the current tasks stack
;
; Notes : 1) W15 is the CPU stack pointer. It should never be popped from the stack during
; a context restore.
; 2) Registers are always popped in the reverse order from which they were pushed
;*******************************************************************************************
;
.macro OS_REGS_RESTORE ; Start of Macro
pop CORCON ; Pull the CoreControl Register from the stack
pop SR ; Pull the CPU StatusRegister from the stack
pop RCOUNT ; Pull the Repeat LoopCounter Register from the stack
pop PSVPAG ; Pull the ProgramSpace Visibility Register from the stack
pop TBLPAG ; Pull the Table PageRegister from the stack
pop.d w14 ; Pull W14 **ONLY** from the stack
pop.d w12 ; Pull W12 and W13 from the stack
pop.d w10 ; Pull W10 and W11 from the stack
pop.d w8 ; Pull W8 and W9 from the stack
pop.d w6 ; Pull W6 and W7 from the stack
pop.d w4 ; Pull W4 and W5 from the stack
pop.d w2 ; Pull W2 and W3 from the stack
pop w0 ; Pull W0 and W1 from the stack
.endm ; End of Macro
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -