?? sysalib.s
字號:
/* sysALib.s - Motorola MPC 5200 system-dependent assembly routines *//*DESCRIPTIONThis module contains the entry code, sysInit(), for VxWorks images that startrunning from RAM, such as 'vxWorks'. These images are loaded into memoryby some external program (e.g., a boot ROM) and then started.The routine sysInit() must come first in the text segment. Its job is to performthe minimal setup needed to call the generic Croutine usrInit() with parameter BOOT_COLD.The routine sysInit() typically masks interrupts in the processor, sets theinitial stack pointer (to STACK_ADRS which is defined in configAll.h),then jumps to usrInit.Most other hardware and device initialization is performed later bysysHwInit().*/#define _ASMLANGUAGE/* includes */#include "vxWorks.h"#include "sysLib.h"#include "config.h"#include "regs.h" #include "asm.h" /* globals */ FUNC_EXPORT(_sysInit) /* start of system code */ FUNC_EXPORT(vxMBarGet) FUNC_EXPORT(vxMBarSet) FUNC_EXPORT(sysInByte) FUNC_EXPORT(sysOutByte) FUNC_EXPORT(sysInWord) FUNC_EXPORT(sysOutWord) FUNC_EXPORT(sysInLong) FUNC_EXPORT(sysOutLong) FUNC_EXPORT(sysPciInByte) FUNC_EXPORT(sysPciOutByte) FUNC_EXPORT(sysPciInWord) FUNC_EXPORT(sysPciOutWord) FUNC_EXPORT(sysPciInLong) FUNC_EXPORT(sysPciOutLong) FUNC_EXPORT(sysClearBATsInvalidateTLBs) FUNC_EXPORT(sysInvalidateTLBs) FUNC_EXPORT(sysMinimumBATsInit) /* externals */ FUNC_IMPORT(usrInit) _WRS_TEXT_SEG_START/***************************************************************************** sysInit - start after boot** This is the system start-up entry point for VxWorks in RAM, the* first code executed after booting. It disables interrupts, sets up* the stack, and jumps to the C routine usrInit() in usrConfig.c.** The initial stack is set to grow down from the address of sysInit(). This* stack is used only by usrInit() and is never used again. Memory for the* stack must be accounted for when determining the system load address.** SYNOPSIS* \ss* sysInit* (* void /@ THIS IS NOT A CALLABLE ROUTINE @/* )* \se** NOTE: This routine should not be called by the user.** RETURNS: N/A*/FUNC_BEGIN(_sysInit) /* disable external interrupts (by zeroing out msr) */ /* disable external interrupts (by zeroing out msr) */ xor r5,r5,r5 isync mtmsr r5 isync /* define the macro USE_EMULATOR if the VxWorks image is loaded from the emulator * and if the MBAR is at reset value (0x80000000). */#undef USE_EMULATOR #ifdef USE_EMULATOR /* Setup MBAR mirror register. MBAR is at 0x80000000 after reset. */ lis r3,HI(MBAR_RESET_VALUE) ori r3,r3,LO(MBAR_RESET_VALUE) mtspr MBAR,r3 /* store new MBAR value to MBAR */ lis r4,LO(MBAR_VALUE) /* this is to load the high address part into the LSB */ ori r4,r4,HI(MBAR_VALUE) stw r4,MBAR_IPBI(r3) eieio /* setup new MBAR */ lis r3,HI(MBAR_VALUE) ori r3,r3,LO(MBAR_VALUE) mtspr MBAR,r3#endif /* invalidate and disable the MPU's data/instruction caches */ mfspr r6,HID0 ori r5,r5,(_PPC_HID0_ICE | _PPC_HID0_DCE) andc r6,r6,r5 /* clear cache enable bits in r6 */ mr r5,r6 ori r5,r5,(_PPC_HID0_ICE | _PPC_HID0_DCE | _PPC_HID0_ICFI | _PPC_HID0_DCFI) sync /* r5 has DCE,ICE,ICFI,DCFI set */ mtspr HID0,r5 /* invalidate both caches with 2 stores */ mtspr HID0,r6 /* leaving them both disabled */ isync mtspr SPRG0,r3 mtspr SPRG1,r4 bl sysClearBATs bl sysInvalidateTLBs bl sysClearSegs mfspr r3,SPRG0 mfspr r4,SPRG1#ifdef INCLUDE_VWARE_LAUNCH lis r5,HI(sysPrivateVwareParams) ori r5,r5,LO(sysPrivateVwareParams) stw r4,0(r5) stw r3,4(r5)#endif /* INCLUDE_VWARE_LAUNCH */ /* Zero-out registers: r0 & SPRGs */ xor r0,r0,r0 mtspr SPRG0,r0 mtspr SPRG1,r0 mtspr SPRG2,r0 mtspr SPRG3,r0 /* Turn on FP (temporarily) */ ori r3,r0,_PPC_MSR_FP mtmsr r3 sync /* Init the floating point control/status register */ mtfsfi 7,0x0 mtfsfi 6,0x0 mtfsfi 5,0x0 mtfsfi 4,0x0 mtfsfi 3,0x0 mtfsfi 2,0x0 mtfsfi 1,0x0 mtfsfi 0,0x0 isync /* Initialize the floating point data registers to a known state */ bl ifpdrValue .long 0x3f800000 /* 1.0 */ifpdrValue: mflr r3 lfs f0,0(r3) lfs f1,0(r3) lfs f2,0(r3) lfs f3,0(r3) lfs f4,0(r3) lfs f5,0(r3) lfs f6,0(r3) lfs f7,0(r3) lfs f8,0(r3) lfs f9,0(r3) lfs f10,0(r3) lfs f11,0(r3) lfs f12,0(r3) lfs f13,0(r3) lfs f14,0(r3) lfs f15,0(r3) lfs f16,0(r3) lfs f17,0(r3) lfs f18,0(r3) lfs f19,0(r3) lfs f20,0(r3) lfs f21,0(r3) lfs f22,0(r3) lfs f23,0(r3) lfs f24,0(r3) lfs f25,0(r3) lfs f26,0(r3) lfs f27,0(r3) lfs f28,0(r3) lfs f29,0(r3) lfs f30,0(r3) lfs f31,0(r3) sync /* * Turn on FP and recoverable interrupt RI. * Do not enable Machine Check until the vectors are set up. */ ori r4,r0,(_PPC_MSR_FP | _PPC_MSR_RI) mtmsr r4 sync /* fake a Decrementer Exception Handler (i.e. rfi @ 0x900) */ lis r3,HI(0x4C000064) ori r3,r3,LO(0x4C000064) /* load rfi (0x4c000064) to */ stw r3,0x900(r0) /* store rfi at 0x00000900 */ /* PKR bl sysMinimumBATsInit */#if FALSE /* XXX TPR NO SDA for now */ /* initialize Small Data Area (SDA) start address */ lis r2, HI(_SDA2_BASE_) ori r2, r2, LO(_SDA2_BASE_) lis r13, HI(_SDA_BASE_) ori r13, r13, LO(_SDA_BASE_)#endif /* initialize the stack pointer */ lis sp, HI(RAM_LOW_ADRS) /* NOTE: sp = r1 */ ori sp, sp, LO(RAM_LOW_ADRS) addi sp, sp, -FRAMEBASESZ /* get frame stack */ li r3, BOOT_WARM_AUTOBOOT isync b usrInit /* never returns - starts up kernel */ /* (jumps to usrConfig.c ) */FUNC_END(_sysInit)/******************************************************************************** vxMBarGet - Get the current MBAR value*/FUNC_BEGIN(vxMBarGet) mfspr p0, MBAR blrFUNC_END(vxMBarGet)/******************************************************************************** vxMBarSet - Set the new MBAR value*/FUNC_BEGIN(vxMBarSet) mtspr MBAR, p0 blrFUNC_END(vxMBarSet)#ifdef INCLUDE_VWARE_LAUNCH#include "sysPpcAVware.s"#endif /* INCLUDE_VWARE_LAUNCH */#include "sysCacheLockALib.s"/***************************************************************************** sysClearBATsInvalidateTLBs - clear the BAT's register and invalidate the TLB's** This routine will clear the BAT's register & invalidate the TLB's register. ** SYNOPSIS* \ss* void sysClearBATsInvalidateTLBs* (* void* )* \se** SEE ALSO: sysClearBATs(), sysInvalidateTLBs(), sysMinimumBATsInit()** RETURNS: N/A*/FUNC_BEGIN(sysClearBATsInvalidateTLBs) mfmsr r3 xor r4,r4,r4 ori r4,r4,0x30 andc r3,r3,r4 sync mtmsr r3 isync mflr r4 bl sysClearBATs bl sysInvalidateTLBs mtlr r4 blrFUNC_END(sysClearBATsInvalidateTLBs)/***************************************************************************** sysClearBATs - clear all the BAT's register** This routine will zero the BAT's register.** SYNOPSIS* \ss* void sysClearBATs* (* void* )* \se** SEE ALSO: sysClearBATsInvalidateTLBs(), sysInvalidateTLBs(), sysMinimumBATsInit()** RETURNS: N/A*/FUNC_BEGIN(sysClearBATs) /* zero out the BAT registers */ xor r3,r3,r3 isync mtspr IBAT0U,r3 /* clear all upper BATS first */ mtspr IBAT1U,r3 mtspr IBAT2U,r3 mtspr IBAT3U,r3 mtspr IBAT4U,r3 mtspr IBAT5U,r3 mtspr IBAT6U,r3 mtspr IBAT7U,r3 mtspr DBAT0U,r3 mtspr DBAT1U,r3 mtspr DBAT2U,r3 mtspr DBAT3U,r3 mtspr DBAT4U,r3 mtspr DBAT5U,r3 mtspr DBAT6U,r3 mtspr DBAT7U,r3 mtspr IBAT0L,r3 /* then clear lower BATS */ mtspr IBAT1L,r3 mtspr IBAT2L,r3 mtspr IBAT3L,r3 mtspr IBAT4L,r3 mtspr IBAT5L,r3 mtspr IBAT6L,r3 mtspr IBAT7L,r3 mtspr DBAT0L,r3 mtspr DBAT1L,r3 mtspr DBAT2L,r3 mtspr DBAT3L,r3 mtspr DBAT4L,r3 mtspr DBAT5L,r3 mtspr DBAT6L,r3 mtspr DBAT7L,r3 isync blrFUNC_END(sysClearBATs)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -