⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tct.s

📁 Nucleus OS code一个商业的RTOS
💻 S
📖 第 1 页 / 共 5 页
字号:
	MOVE.W  D0,-(A0)  	            ; Exception Format word for Coldfire        CLR.L   D0                          ; Clear D0 for initial reg values        MOVE.L  D0,-(A0)                    ; Unused area        MOVE.L  D0,-(A0)                    ; Place initial A6 on the stack        MOVE.L  A5,-(A0)                    ; Place initial A5 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A4 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A3 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A2 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A1 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A0 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D7 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D6 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D5 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D4 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D3 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D2 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D1 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D0 on the stack        MOVE.W  #1,D0                       ; Interrupt stack type is a 1        MOVE.W  D0,-(A0)                    ; Place stack type on the stack;    ;    /* Save the new stack pointer into the task's control block.  */;    task -> tc_stack_pointer =  (VOID *) (A0);;        MOVE.L  A0,44(A1)                   ; Save the top of the stack in TCB        RTS                                 ; Return to caller;;};;/*************************************************************************/;/*                                                                       */;/* FUNCTION                                                              */;/*                                                                       */;/*      TCT_Build_HISR_Stack                                             */;/*                                                                       */;/* DESCRIPTION                                                           */;/*                                                                       */;/*      This function builds an HISR stack frame that allows quick       */;/*      scheduling of the HISR.                                          */;/*                                                                       */;/* AUTHOR                                                                */;/*                                                                       */;/*      Barry Sellew, Accelerated Technology, Inc.                       */;/*                                                                       */;/* CALLED BY                                                             */;/*                                                                       */;/*      TCC_Create_HISR                     Create HISR function         */;/*                                                                       */;/* CALLS                                                                 */;/*                                                                       */;/*      None                                                             */;/*                                                                       */;/* INPUTS                                                                */;/*                                                                       */;/*      hisr                                HISR control block pointer   */;/*                                                                       */;/* OUTPUTS                                                               */;/*                                                                       */;/*      None                                                             */;/*                                                                       */;/* HISTORY                                                               */;/*                                                                       */;/*         NAME            DATE                    REMARKS               */;/*                                                                       */;/*      B. Sellew       02-21-1997      Created and verified version 1.0 */                                               */;/*                                                                       */;/*************************************************************************/        XDEF    _TCT_Build_HISR_Stack_TCT_Build_HISR_Stack:;VOID  TCT_Build_HISR_Stack(TC_HCB *hisr);{;        MOVEA.L 4(A7),A1                    ; Pickup HISR pointer in A1;;    /* Pickup the stack base.  */;    REG_Stack_Base =  (BYTE_PTR) hisr -> tc_stack_start;;        MOVE.L  36(A1),D0                   ; Pickup start of stack area;    ;    /* Pickup the stack size.  */;    REG_Stack_Size =  hisr -> tc_stack_size;;            MOVE.L  48(A1),D1                   ; Pickup size of stack area;;    /* Calculate the stack ending address.  */;    REG_Stack_End =  REG_Stack_Base + REG_Stack_Size;;            ADD.L   D1,D0                       ; Compute bottom of stack        AND.L   #$FFFFFFFC,D0               ; Insure long word alignment        SUBQ.L  #4,D0                       ; Backup the stack        MOVEA.L D0,A0                       ; Put stack pointer into A0;;    /* Save the end of the stack area in the control block.  */;    hisr -> tc_stack_end =  (VOID *) REG_Stack_End;;        MOVE.L  D0,40(A1)                   ; Save end of stack area;;    /* Save the minimum amount of remaining stack memory.  */;    hisr -> tc_stack_minimum =  REG_Stack_Size - 80;;        SUB.L   #80,D1                      ; Requires this many bytes        MOVE.L  D1,52(A1)                   ; Save minimum in control block;    ;    /* Build an initial stack.  */;        CLR.L   D0                          ; Clear D0 for initial reg values        MOVE.L  D0,-(A0)                    ; Put a NULL return address on the                                            ;   stack.  This is primarily for                                            ;   source level debuggers        MOVE.L  #_TCT_HISR_Shell,D1         ; All HISRs have same entry point        MOVE.L  D1,-(A0)                    ; Put HISR entry point on stack        MOVE.L  D0,-(A0)                    ; Place initial A6 on the stack        MOVE.L  A5,-(A0)                    ; Place initial A5 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A4 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A3 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A2 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D7 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D6 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D5 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D4 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D3 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D2 on the stack                                            ; D0 contains 0, which is indicates                                            ;   a solicited stack type        MOVE.W  D0,-(A0)                    ; Place stack type on the stack;    ;    /* Save the new stack pointer into the HISR's control block.  */;    hisr -> tc_stack_pointer =  (VOID *) (A0);;        MOVE.L  A0,44(A1)                   ; Save the top of the stack in TCB        RTS                                 ; Return to caller;;};;/*************************************************************************/;/*                                                                       */;/* FUNCTION                                                              */;/*                                                                       */;/*      TCT_Build_Signal_Frame                                           */;/*                                                                       */;/* DESCRIPTION                                                           */;/*                                                                       */;/*      This function builds a frame on top of the task's stack to       */;/*      cause the task's signal handler to execute the next time         */;/*      the task is executed.                                            */;/*                                                                       */;/* AUTHOR                                                                */;/*                                                                       */;/*      Barry Sellew, Accelerated Technology, Inc.                       */;/*                                                                       */;/* CALLED BY                                                             */;/*                                                                       */;/*      TCC_Send_Signals                    Send signals to a task       */;/*                                                                       */;/* CALLS                                                                 */;/*                                                                       */;/*      None                                                             */;/*                                                                       */;/* INPUTS                                                                */;/*                                                                       */;/*      task                                Task control block pointer   */;/*                                                                       */;/* OUTPUTS                                                               */;/*                                                                       */;/*      None                                                             */;/*                                                                       */;/* HISTORY                                                               */;/*                                                                       */;/*         NAME            DATE                    REMARKS               */;/*                                                                       */;/*      B. Sellew       02-21-1997      Created and verified version 1.0 */                                               */;/*                                                                       */;/*************************************************************************/        XDEF    _TCT_Build_Signal_Frame_TCT_Build_Signal_Frame:;VOID  TCT_Build_Signal_Frame(TC_TCB *task);{;        MOVEA.L 4(A7),A1                    ; Point at thread control block;;    /* Pickup the stack pointer.  */;    REG_Stack_Ptr =  (BYTE_PTR) task -> tc_stack_pointer;;        MOVEA.L 44(A1),A0                   ; Point at the task's stack;    ;    /* Build a signal stack.  */;        CLR.L   D0                          ; Clear D0 for initial reg values        MOVE.L  D0,-(A0)                    ; Put a NULL return address on the                                            ;   stack.  This is primarily for                                            ;   source level debuggers        MOVE.L  #_TCC_Signal_Shell,D1       ; All HISRs have same entry point        MOVE.L  D1,-(A0)                    ; Put HISR entry point on stack        MOVE.L  D0,-(A0)                    ; Place initial A6 on the stack        MOVE.L  A5,-(A0)                    ; Place initial A5 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A4 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A3 on the stack        MOVE.L  D0,-(A0)                    ; Place initial A2 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D7 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D6 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D5 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D4 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D3 on the stack        MOVE.L  D0,-(A0)                    ; Place initial D2 on the stack                                            ; D0 contains 0, which is indicates                                            ;   a solicited stack type        MOVE.W  D0,-(A0)                    ; Place stack type on the stack;    ;    /* Save the new stack pointer into the task's control block.  */;    task -> tc_stack_pointer =  (VOID *) REG_Stack_Ptr;;        MOVE.L  A0,44(A1)                   ; Save in the thread control block        RTS                                 ; Return to caller;;};;/*************************************************************************/;/*                                                                       */;/* FUNCTION                                                              */;/*                                                                       */;/*      TCT_Check_Stack                                                  */;/*                                                                       */;/* DESCRIPTION                                                           */;/*                                                                       */;/*      This function checks the current stack for overflow conditions.  */;/*      Additionally, this function keeps track of the minimum amount    */;/*      of stack space for the calling thread and returns the current    */;/*      available stack space.                                           */;/*                                                                       */;/* AUTHOR                                                                */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -