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

📄 tct.s

📁 文件内包含了nuclues的内核代码和针对Power PC的编译器。需要用VirtNet生成一个虚拟网卡才可使用
💻 S
📖 第 1 页 / 共 5 页
字号:
#    */
#
    addi        r9,r9,-8                    # subtract 8 bytes for DIAB/DATA
                                            # location which will be used
                                            # by the C to ASM calling convetion
    li          r8,0                        # clear for doing space filler
    stw         r8,0(r9)                    # store r12 zero for space only
    stwu        r8,-4(r9)                   # store r11 zero for space only
    stwu        r8,-4(r9)                   # store r10 zero for space only
    stwu        r8,-4(r9)                   # store r9 zero for space only
#
#   /* Save the PC, MSR, LR, CR, XTR, and CTR registers */
#
    addis       r7,0,TCC_Task_Shell@ha
    addi        r7,r7,TCC_Task_Shell@l
    stwu        r7,-4(r9)                   # save SRR0/TCC_Task_Shell address
    mfmsr       r7                          # read current MSR value
    stwu        r7,-4(r9)                   # store MSR for SRR1 restore
    stwu        r8,-4(r9)                   # save LR for restore
    stwu        r8,-4(r9)                   # save CR for restore
    stwu        r8,-4(r9)                   # save XTR for restore
    stwu        r8,-4(r9)                   # save CTR for restore
#
#   /* Store GPR's */
#
    stwu        r8,-4(r9)                   # store r31 zero for space only
    stwu        r8,-4(r9)                   # store r30 zero for space only
    stwu        r8,-4(r9)                   # store r29 zero for space only
    stwu        r8,-4(r9)                   # store r28 zero for space only
    stwu        r8,-4(r9)                   # store r27 zero for space only
    stwu        r8,-4(r9)                   # store r26 zero for space only
    stwu        r8,-4(r9)                   # store r25 zero for space only
    stwu        r8,-4(r9)                   # store r24 zero for space only
    stwu        r8,-4(r9)                   # store r23 zero for space only
    stwu        r8,-4(r9)                   # store r22 zero for space only
    stwu        r8,-4(r9)                   # store r21 zero for space only
    stwu        r8,-4(r9)                   # store r20 zero for space only
    stwu        r8,-4(r9)                   # store r19 zero for space only
    stwu        r8,-4(r9)                   # store r18 zero for space only
    stwu        r8,-4(r9)                   # store r17 zero for space only
    stwu        r8,-4(r9)                   # store r16 zero for space only
    stwu        r8,-4(r9)                   # store r15 zero for space only
    stwu        r8,-4(r9)                   # store r14 zero for space only
    stwu        r8,-4(r9)                   # store r8 zero for space only
    stwu        r8,-4(r9)                   # store r7 zero for space only
    stwu        r8,-4(r9)                   # store r6 zero for space only
    stwu        r8,-4(r9)                   # store r5 zero for space only
    stwu        r8,-4(r9)                   # store r4 zero for space only
    stwu        r8,-4(r9)                   # store r3 zero for space only
    stwu        r8,-4(r9)                   # store r0 zero for space only
#
#   /* Store the MSR for compatibility with SingleStep MTD */
#
    stwu        r7,-4(r9)
#
#   /* Set interrupt stack type flag */
#
    li          r8,1
    stwu        r8,-4(r9)                   # store the stack flag type
    addi        r9,r9,-12                   # subtract 12 bytes for DIAB/DATA
                                            # location which will be used
                                            # by the C to ASM calling convetion
                                            # and next available space.
#
#   /* Save the new stack pointer into the task's control block.  */
#   task -> tc_stack_pointer =  (VOID *) Current_Stack_Top;
#
    stw         r9,56(r3)
#
#   /* Return to caller */
#
    blr
#}
#
#/*************************************************************************/
#/*                                                                       */
#/* 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 (argument in r3)               HISR control block pointer   */
#/*                                                                       */
#/* OUTPUTS                                                               */
#/*                                                                       */
#/*      None                                                             */
#/*                                                                       */
#/* HISTORY                                                               */
#/*                                                                       */
#/*         NAME            DATE                    REMARKS               */
#/*                                                                       */
#/*      Barry Sellew    06-24-1996       Created initial version 1.0     */
#/*                                                                       */
#/*************************************************************************/
#VOID  TCT_Build_HISR_Stack(TC_HCB *hisr)
#{
    .text
    .align      2
TCT_Build_HISR_Stack:
#
#    /* Pickup the stack base.  */
#    REG_Stack_Base =  (BYTE_PTR) hisr -> tc_stack_start;
#
    lwz         r11,48(r3)
#
#    /* Pickup the stack size.  */
#    REG_Stack_Size =  hisr -> tc_stack_size;
#
    lwz         r10,60(r3)
#
#    /* Calculate the stack ending address.  */
#    REG_Stack_End =  REG_Stack_Base + REG_Stack_Size;
#
    add         r9,r11,r10
    rlwinm      r9,r9,0,0,29                # word alignment
#
#    /* Save the stack ending address.  */
#    hisr -> tc_stack_end =  REG_Stack_End;
#
    subi        r9,r9,0x10
    stw         r9,52(r3)
#    
    addi        r10,r10,-112
#
#    /* Save the minimum amount of remaining stack memory.  */
#    task -> tc_stack_minimum =  REG_Stack_Size - 112;
#
    stw         r10,60(r3)
#
#    /* Reference the HISR shell.  */
#    REG_Function_Ptr =  (VOID *) TCT_HISR_Shell;
#
#
#    /* Build an initial stack.  This initial stack frame facilitates an 
#       solicited return to the TCT_HISR_Shell function, which in turn 
#       invokes the appropriate HISR.  The initial HISR stack frame has the 
#       following format:
#
#  (Lower Address) Stack Top, new SP (r9) ->    XXXX    Empty space for store
#                                               XXXX    DIAB/DATA LR
#                                               XXXX    DIAB/DATA SP
#                                               0       (Solicited stack type)
#                                               MSR     Current MSR value
#                                               r14     Saved GPR14
#                                               r15     Saved GPR15
#                                               r16     Saved GPR16
#                                               r17     Saved GPR17
#                                               r18     Saved GPR18
#                                               r19     Saved GPR19
#                                               r20     Saved GPR20
#                                               r21     Saved GPR21
#                                               r22     Saved GPR22
#                                               r23     Saved GPR23
#                                               r24     Saved GPR24
#                                               r25     Saved GPR25
#                                               r26     Saved GPR26
#                                               r27     Saved GPR27
#                                               r28     Saved GPR28
#                                               r29     Saved GPR29
#                                               r30     Saved GPR30
#                                               r31     Saved GPR31
#                                               CTR     Saved CTR
#                                               XER     Saved XER
#                                               TCT_HISR_Shell  Return address
#                                               XXXX    Old LR from DIAB/DATA
#  (Higher Address) Stack Bottom, old SP (r1)-> XXXX    Old SP from DIAB/DATA
#    */
#
    addi        r9,r9,-8                    # allow old SP from DIAB/DATA
    li          r8,0
    addis       r7,0,TCT_HISR_Shell@ha      # This will normally be the LR
    addi        r7,r7,TCT_HISR_Shell@l
    stw         r7,0(r9)                    # Store entry address on stack
    stwu        r8,-4(r9)                   # store XER for restore
    stwu        r8,-4(r9)                   # store CTR for restore
    stwu        r8,-4(r9)                   # store r31 for space only
    stwu        r8,-4(r9)                   # store r30 for space only
    stwu        r8,-4(r9)                   # store r29 for space only
    stwu        r8,-4(r9)                   # store r28 for space only
    stwu        r8,-4(r9)                   # store r27 for space only
    stwu        r8,-4(r9)                   # store r26 for space only
    stwu        r8,-4(r9)                   # store r25 for space only
    stwu        r8,-4(r9)                   # store r24 for space only
    stwu        r8,-4(r9)                   # store r23 for space only
    stwu        r8,-4(r9)                   # store r22 for space only
    stwu        r8,-4(r9)                   # store r21 for space only
    stwu        r8,-4(r9)                   # store r20 for space only
    stwu        r8,-4(r9)                   # store r19 for space only
    stwu        r8,-4(r9)                   # store r18 for space only
    stwu        r8,-4(r9)                   # store r17 for space only
    stwu        r8,-4(r9)                   # store r16 for space only
    stwu        r8,-4(r9)                   # store r15 for space only
    stwu        r8,-4(r9)                   # store r14 for space only
#
#   /* Store the MSR value for compatibility with SingleStep MTD */
#
    stwu        r12,-4(r9)
    stwu        r8,-4(r9)                   # store solicited stack type
#
#   /* Allocate the extra space for the DIAB/DATA C to ASM interface */
#
    addi        r9,r9,-12
#
#   /* Save the new stack pointer into the task's control block.  */
#   hisr -> tc_stack_pointer =  (VOID *) Current_Stack_Top;
#
    stw         r9,56(r3)
#
#   /* Return to caller */
#
    blr
#
#}
#
#/*************************************************************************/
#/*                                                                       */
#/* 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         */

⌨️ 快捷键说明

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