📄 sysalib.s
字号:
/* sysALib.s - SBC8260 system-dependent assembly routines *//* Copyright 1984-2001 Wind River Systems, Inc. */ .data .globl copyright_wind_river .long copyright_wind_river/*modification history--------------------01d,07dec01,kab Fixed decl to keep diab happy01c,23oct01,g_h Remove DIAB dependences01b,07may01,g_h add support for visionWARE 2.0001a,15mar99,elk created from vads8260/sysALib.s (ver 01a).*//*DESCRIPTIONThis module contains system-dependent routines written in assemblylanguage.This module must be the first specified in the \f3ld\f1 command used tobuild the system. The sysInit() routine is the system start-up code.*/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "cacheLib.h"#include "arch/ppc/cachePpcLib.h"#include "config.h"#include "regs.h" #include "sysLib.h" /* globals */ FUNC_EXPORT(_sysInit) /* start of system code */ FUNC_EXPORT(sysPCGet) /* get the value of the PC register */ /* 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) /* initialize the stack pointer */ lis sp, HIADJ(RAM_LOW_ADRS) addi sp, sp, LO(RAM_LOW_ADRS) mtspr SPRG0,r3 mtspr SPRG1,r4 /* Set up MSR for Recoverable Interrupts and Machine Check Enable */ lis r4,HI(0x00001002) ori r4,r4,LO(0x00001002) mtmsr r4 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 */ /* * Possibly do the same for IMMR, BCSR[0:3], and SYPCR * i.e. define _PPC_IMMR_POWERUP, _PPC_BCSR_POWERUP, and * _PPC_SYPCR_POWERUP and write them to those registers */ /* initialize the BAT register */ li p3,0 /* clear p0 */ isync mtspr IBAT0U,p3 /* SPR 528 (IBAT0U) */ isync mtspr IBAT0L,p3 /* SPR 529 (IBAT0L) */ isync mtspr IBAT1U,p3 /* SPR 530 (IBAT1U) */ isync mtspr IBAT1L,p3 /* SPR 531 (IBAT1L) */ isync mtspr IBAT2U,p3 /* SPR 532 (IBAT2U) */ isync mtspr IBAT2L,p3 /* SPR 533 (IBAT2L) */ isync mtspr IBAT3U,p3 /* SPR 534 (IBAT3U) */ isync mtspr IBAT3L,p3 /* SPR 535 (IBAT3L) */ isync mtspr DBAT0U,p3 /* SPR 536 (DBAT0U) */ isync mtspr DBAT0L,p3 /* SPR 537 (DBAT0L) */ isync mtspr DBAT1U,p3 /* SPR 538 (DBAT1U) */ isync mtspr DBAT1L,p3 /* SPR 539 (DBAT1L) */ isync mtspr DBAT2U,p3 /* SPR 540 (DBAT2U) */ isync mtspr DBAT2L,p3 /* SPR 541 (DBAT2L) */ isync mtspr DBAT3U,p3 /* SPR 542 (DBAT3U) */ isync mtspr DBAT3L,p3 /* SPR 543 (DBAT3L) */ isync /* invalidate entries within both TLBs */ li r4,32 mtctr r4 /* CTR = 32 */ xor r3,r3,r3 /* r3 = 0 */ isync /* context sync req'd before tlbie */sysALoop: tlbie r3 addi r3,r3,0x1000 /* increment bits 15-19 */ bdnz sysALoop /* decrement CTR, branch if CTR != 0 */ sync /* sync instr req'd after tlbie */ /* Enable, invalidate, then disable both caches */ /* First, set HID0 to known state. */ li r3, 0 sync isync mtspr HID0, r3 /* enable the two caches */ mfspr r3, HID0 ori r3, r3, (_PPC_HID0_ICE | _PPC_HID0_DCE) sync isync mtspr HID0, r3 /* * Cache invalidation is accomplished by setting and then clearing * the cache invalidate bits */ mfspr r3, HID0 ori r3, r3, (_PPC_HID0_ICFI | _PPC_HID0_DCFI) /* set bits */ sync isync mtspr HID0, r3 li r3, 0 /* cache invalidate bits are cleared */ ori r3, r3, (_PPC_HID0_ICE | _PPC_HID0_DCE) sync isync mtspr HID0, r3 /* disable the caches */ li r3, 0 sync isync mtspr HID0, r3 addi sp, sp, -FRAMEBASESZ /* get frame stack */ li r3, BOOT_WARM_AUTOBOOT /* set the default boot code */ /* jump to usrInit */ b usrInit /* never returns - starts up kernel */FUNC_END(_sysInit)#ifdef INCLUDE_VWARE_LAUNCH#include "sysPpcAVware.s"#endif /* INCLUDE_VWARE_LAUNCH *//******************************************************************************** sysPCGet - Get the value of the PC (Program Counter)** This routine returns the value of the PC.** SYNOPSIS* \ss* UINT32 sysPCGet* (* void* )* \se** RETURNS: the Program Counter Register (PC) value.*/FUNC_BEGIN(sysPCGet) mflr r4 /* Save LR value */ bl Next /* Set PC */Next: mflr r3 /* Get PC */ mtlr r4 /* Restor LR value */ blrFUNC_END(sysPCGet)#ifdef INCLUDE_CACHE_SUPPORT#include "sysCacheLockALib.s"#endif /* INCLUDE_CACHE_SUPPORT */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -