📄 crt0d860.s
字号:
#
# src/crtppc/crt0.s: startup for an embedded environment: PowerPC
# ---------------------------------------------------------------
#
# Copyright 1998 Diab Data, Inc.
USING_CMXISRS .equ 0 ; SET TO 1 to include cmx isrs
.file "crt0.c"
.text
.globl _start
.align 2
addi r0,r0,0 # Debuggers may object to starting at 0.
_start:
addis r11,r0,__SP_INIT@ha # Initialize stack pointer r1 to
addi r1,r11,__SP_INIT@l # value in linker command file.
addis r13,r0,_SDA_BASE_@ha # Initialize r13 to sdata base
addi r13,r13,_SDA_BASE_@l # (provided by linker).
addis r2,r0,_SDA2_BASE_@ha # Initialize r2 to sdata2 base
addi r2,r2,_SDA2_BASE_@l # (provided by linker).
addi r0,r0,0 # Clear r0.
stwu r0,-64(r1) # Terminate stack.
#
# Insert other initialize code here.
#
bl __init_main # Finish initialization; call main().
b exit # Never returns.
bl main # Dummy to pull in main() as soon as
# possible.
.if USING_CMXISRS != 0
; PowerPC 32 bit, all-far-code-relative, far-data-relative mode
;
; note: Big-Endian
;
; r14 is reserved for cmx_flag1
.global K_OS_Intrp_Entry
.global K_OS_Intrp_Exit
.global cmxsampa
.global ext_int_handler
; .section .external_except,2,c
DecExceptHandler:
; use the red zone to save r0 and LR
; this is safe because interrupts are disabled here.
stw r0,-8(r1)
mfspr r0,LR
stw r0,-4(r1) ; need to save LR at -4(r1)
; before calling K_OS_Intrp_Entry
; PVO ADDED Reload decrement counter -
li r0,19999 ; reload decrement counter, 20 msec
mtspr 22,r0 ;
lwz r0,-8(r1) ; restore r0
bla K_OS_Intrp_Entry
bla cmxsampa ;call K_OS_Tick_Update and send message
ba K_OS_Intrp_Exit ; doesn't return
; .previous
; external exception handler
ExtExceptHandler:
; use the red zone to save r0 and LR
; this is safe because interrupts are disabled here.
stw r0,-8(r1)
mfspr r0,LR
stw r0,-4(r1) ; need to save LR at -4(r1)
; before calling K_OS_Intrp_Entry
lwz r0,-8(r1) ; restore r0
bla K_OS_Intrp_Entry
bla ext_int_handler ; Call external int handler
ba K_OS_Intrp_Exit ; doesn't return
; .previous
.endc
#------------------------------------------------------------- .init section --
.section .init$00,2,C
.globl __init
__init: # Entry to __init, called by
mfspr r0,8 # __init_main called above.
stwu r1,-64(r1)
stw r0,68(r1)
# Linker places .init sections from other modules, containing
# calls to initialize global objects, here.
.section .init$99,2,C
lwz r0,68(r1) # Return from __init.
addi r1,r1,64
mtspr 8,r0
blr
#------------------------------------------------------------- .fini section --
.section .fini$00,2,C
.globl __fini
__fini: # Entry to __fini, called by exit().
mfspr r0,8
stwu r1,-64(r1)
stw r0,68(r1)
# Linker places .fini sections from other modules, containing
# calls to destroy global objects, here.
.section .fini$99,2,C
lwz r0,68(r1) # Return from __fini.
addi r1,r1,64
mtspr 8,r0
blr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -