📄 int.s
字号:
#/* */
#/* INPUTS */
#/* */
#/* None */
#/* */
#/* OUTPUTS */
#/* */
#/* None */
#/* */
#/* HISTORY */
#/* */
#/* NAME DATE REMARKS */
#/* */
#/* Craig L. Meredith 12-08-1994 Created initial version 1.0 */
#/* */
#/*************************************************************************/
#INT INT_Vectors_Loaded(VOID)
#{
.text
.align 2
.globl INT_Vectors_Loaded
INT_Vectors_Loaded:
#
# /* return the value in the INT_Loaded_Flag variable */
#
addis r3,r0,INT_Loaded_Flag@ha # get upper 16 bits < 16 bits
lwz r3,INT_Loaded_Flag@l(r3) # store value to r3 for return
#
# /* Return to caller */
#
blr
#
#/*************************************************************************/
#/* */
#/* FUNCTION */
#/* */
#/* INT_Setup_Vector */
#/* */
#/* DESCRIPTION */
#/* */
#/* This function sets up the specified vector with the new vector */
#/* value. The previous vector value is returned to the caller. */
#/* */
#/* CALLED BY */
#/* */
#/* Application */
#/* TCC_Register_LISR Register LISR for vector */
#/* */
#/* CALLS */
#/* */
#/* None */
#/* */
#/* INPUTS */
#/* */
#/* vector (argument in r3) Vector number to setup */
#/* */
#/* OUTPUTS */
#/* */
#/* old vector contents (return in r3) */
#/* */
#/* HISTORY */
#/* */
#/* NAME DATE REMARKS */
#/* */
#/* Craig L. Meredith 12-08-1994 Created initial version 1.0 */
#/* */
#/*************************************************************************/
#VOID *INT_Setup_Vector(INT vector, VOID *new)
#{
#VOID *old_vector; /* Old interrupt vector */
#
.text
.align 2
.globl INT_Setup_Vector
INT_Setup_Vector:
#
# /* Since the complete vector table is copied to DRAM during
# initialization, this function serves no useful purpose. Simply
# return NULL. */
#
li r3,0
blr
#
#}
#
#/*************************************************************************/
#/* */
#/* FUNCTION */
#/* */
#/* INT_Retrieve_Shell */
#/* */
#/* DESCRIPTION */
#/* */
#/* This function retrieves the pointer to the shell interrupt */
#/* service routine. The shell interrupt service routine calls */
#/* the LISR dispatch routine. */
#/* */
#/* CALLED BY */
#/* */
#/* TCC_Register_LISR Register LISR for vector */
#/* */
#/* CALLS */
#/* */
#/* None */
#/* */
#/* INPUTS */
#/* */
#/* vector (argument r3) Vector number to setup */
#/* */
#/* OUTPUTS */
#/* */
#/* shell pointer (return in r3) */
#/* */
#/* HISTORY */
#/* */
#/* NAME DATE REMARKS */
#/* */
#/* Craig L. Meredith 12-08-1994 Created initial version 1.0 */
#/* */
#/*************************************************************************/
#VOID *INT_Retrieve_Shell(INT vector)
#{
.text
.align 2
.globl INT_Retrieve_Shell
INT_Retrieve_Shell:
#
# /* Return the LISR Shell interrupt routine. */
# return(INT_Vectors[vector][0]);
#
li r3,0 # just return NULL
blr
#
#}
#
#/*************************************************************************/
#/* */
#/* FUNCTION */
#/* */
#/* INT_Timer_Interrupt */
#/* */
#/* DESCRIPTION */
#/* */
#/* This shell will handle the interrupt processing for the */
#/* decrementer interrupt. This is what will be used for the */
#/* periodic timer interrupt. */
#/* */
#/* CALLED BY */
#/* */
#/* None */
#/* */
#/* CALLS */
#/* */
#/* None */
#/* */
#/* INPUTS */
#/* */
#/* None */
#/* */
#/* OUTPUTS */
#/* */
#/* None */
#/* */
#/* HISTORY */
#/* */
#/* NAME DATE REMARKS */
#/* */
#/* Craig L. Meredith 12-08-1994 Initial version 1.0 */
#/* */
#/*************************************************************************/
.text
.align 2
.globl INT_Timer_Interrupt
INT_Timer_Interrupt:
addi r1,r1,-8 # subtract 8 bytes for DIAB/DATA
stw r12,0(r1) # save r12
stwu r11,-4(r1) # save r11
stwu r10,-4(r1) # save r10
stwu r9,-4(r1) # save r9
#
# /* Reenable the MMU and Disable Interrupts (to prevent duplicate
# interrupts occuring and decrementing the timer counter below
# zero). */
#
mfmsr r9
ori r9,r9,0x0030
li r12,0x1000 # create MSR[EE] mask
andc r9,r9,r12 # Disable Interrupts using mask
mtmsr r9
isync
#
# /* reload the DEC register */
#
lis r12,DEC_LOAD_UPPER
ori r12,r12,DEC_LOAD_LOWER
mtdec r12 # write out to the DEC register
#
# /* Re-enable floating point if it was in effect */
#
mfspr r10,SRR1
rlwinm r10,r10,0,18,18
mfmsr r12
or r12,r12,r10
mtmsr r12
#
# /* Save the old PC and MSR. */
#
mfspr r12,SRR0 # read the rfi PC value/SRR0
stwu r12,-4(r1) # save on the stack
mfspr r12,SRR1 # read the MSR value/SRR1
stwu r12,-4(r1) # save on the stack
#
# /* Set the MSR[RI] bit to indicate that system reset and machine check
# exceptions are now recoverable */
#
mfmsr r12
ori r12,r12,MSR_RI_MSK
mtmsr r12
#
# /* Save LR, CR, XER, and CTR on stack. */
#
mfspr r12,8 # read the old LR
stwu r12,-4(r1) # save on the stack
mfcr r12 # read current Condition Register
stwu r12,-4(r1) # save on the stack
mfspr r12,1 # read the XER value
stwu r12,-4(r1) # save on the stack
mfspr r12,9 # read the CTR value
stwu r12,-4(r1) # save on the stack
#
# /* call the timer interrupt code */
#
b TMT_Timer_Interrupt
#
#/*************************************************************************/
#/* */
#/* FUNCTION */
#/* */
#/* INT_Shell */
#/* */
#/* DESCRIPTION */
#/* */
#/* This shell handles saving all the registers and passing the */
#/* current vector for the interrupt to the TCC_Dispatch_LISR */
#/* routine. */
#/* */
#/* CALLED BY */
#/* */
#/* None */
#/* */
#/* CALLS */
#/* */
#/* None */
#/* */
#/* INPUTS */
#/* */
#/* vector number Vector number is special and */
#/* is passed in r31. */
#/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -