📄 start.lst.svn-base
字号:
16 #define r4 4
17 #define r5 5
18 #define r6 6
19 #define r7 7
20 #define r8 8
21 #define r9 9
22 #define r10 10
23 #define r11 11
24 #define r12 12
25 #define r13 13
26 #define r14 14
27 #define r15 15
28 #define r16 16
29 #define r17 17
30 #define r18 18
31 #define r19 19
32 #define r20 20
33 #define r21 21
34 #define r22 22
35 #define r23 23
36 #define r24 24
37 #define r25 25
38 #define r26 26
39 #define r27 27
40 #define r28 28
41 #define r29 29
42 #define r30 30
43 #define r31 31
44
45 #define XER 1 /*Integer Exception Register*/
46 #define LR 8 /*Link Register*/
47 #define CTR 9 /*Count Register*/
48 #define DAR 19 /*Data Address Register*/
49 #define DEC 22 /*Decrementer Register*/
50 #define SRR0 26 /*Machine Status Save/Store Register 0*/
51 #define SRR1 27 /*Machine Status Save/Store Register 1*/
52 #define EIE 80
53 #define EID 81
GAS LISTING /tmp/cc60KWFF.s page 6 54 #define NRI 82
55 #define CMPA 144 /*Comparator A Value Register*/
56 #define CMPB 145 /*Comparator B Value Register*/
57 #define CMPC 146 /*Comparator C Value Register*/
58 #define CMPD 147 /*Compatator D Value Register*/
59 #define ECR 148 /*Exception Cause Register*/
60 #define DER 149 /* Debug Enable Register */
61 #define COUNTA 150 /* Breakpoint Counter*/
62 #define COUNTB 151 /* Breakpoint Counter*/
63 #define LCTRL1 156 /* L-Bus Support Control Register1*/
64 #define LCTRL2 157 /* L-Bus Support Control Register 2*/
65 #define ICTRL 158 /* I-Bus Support Control Register*/
66 #define BAR 159 /*Breakpoint Address Register*/
67 #define SPRG0 272 /*General Special Purpose Registers*/
68 #define SPRG1 273 /*General Special Purpose Registers*/
69 #define SPRG2 274 /*General Special Purpose Registers*/
70 #define SPRG3 275 /*General Special Purpose Registers*/
71 #define PVR 287 /*Processor Version Register*/
72 #define MI_GRA 528 /*Global Region Attribute Register*/
73 #define L2U_GRA 536 /*L2U Global Region Attribute Register*/
74 #define BBCMCR 560 /*BBC Module Configuration Register*/
75 #define L2U_MCR 568 /*L2U Module Configuration Register*/
76 #define DPDR 630 /*Development Port Data Register*/
77 #define IMMR 638 /*Internal Memory Mapping Register*/
78
11
12 0000 00000000 .org EXC_OFF_SYS_RESET 12 00000000 12 00000000 12 00000000 12 00000000 13 .globl _start
14
15 _start:
16
17 /*Set the msr register*/
18 0100 3C600000 lis r3, CFG_MSR@h
19 0104 60630000 ori r3, r3, CFG_MSR@l
20 0108 7C600124 mtmsr r3
21 010c 7C7B03A6 mtspr SRR1, r3
22
23 /*Set the bbcmcr register*/
24 0110 3C600000 lis r3, CFG_BBCMCR@h
25 0114 60630000 ori r3, r3, CFG_BBCMCR@l
26 0118 7C708BA6 mtspr BBCMCR, r3 27 28 /*Set the immr register, 638 is its number*/
29 011c 3C600000 lis r3, CFG_IMMR_SET@h
30 0120 60630800 ori r3, r3, CFG_IMMR_SET@l
31 0124 7C7E9BA6 mtspr IMMR, r3 32
33 /* Set up the stack in internal SRAM */
34 0128 3C200040 lis r1, __SP_INIT@h
35 012c 60210000 ori r1, r1, __SP_INIT@l
36
37 /*Make r0 be 0*/
38 0130 7C000278 xor r0, r0, r0
GAS LISTING /tmp/cc60KWFF.s page 7 39
40 /*Clear final stack frame so that stack backtraces terminate cleanly*/
41 0134 9401FFFC stwu r0, -4(r1)
42 0138 9401FFFC stwu r0, -4(r1)
43
44 /*initalize some cpu internal memory space registers, r3 is immr*/
45 46 013c 48000001 bl cpu_init_f 47 48 /*run low-level board init code, and it's empty right now! (from Flash)
49 * Maybe we have no external RAM, so check it! If we just have small
50 * external RAM, what can I do?
51 */
52 /* #if defined(EXTERNAL_RAM)
53 bl board_init_f
54 #endif
55 */
56 /*board_init_f will never return, so if we don't execute it, it means that
57 * we don't need to relocate the code, therefore let's just jump to the entry
58 * point of OS.
59 */
60 0140 3C600000 lis r3, jump2OS@h
61 0144 60630000 ori r3, r3, jump2OS@l
62 0148 7C6803A6 mtlr r3
63 014c 4E800021 blrl
64 65
66 /*Exception handler*/
67 .globl _start_of_vectors
68 _start_of_vectors:
69
70 /* Machine Check
71 * Override the behavior by over-writing the handler code in RAM.
72 */
73 0150 00000000 .org 0x200
73 00000000 73 00000000 73 00000000 73 00000000 74 0200 48000000 b _start
75
76 /* Data Storage
77 * Override the behavior by over-writing the handler code in RAM.
78 */
79 0204 00000000 .org 0x300
79 00000000 79 00000000 79 00000000 79 00000000 80 0300 48000000 b _start
81
82 /* Instruction Storage
83 * Override the behavior by over-writing the handler code in RAM.
84 */
85 0304 00000000 .org 0x400
85 00000000 85 00000000 GAS LISTING /tmp/cc60KWFF.s page 8 85 00000000 85 00000000 86 0400 48000000 b _start
87
88 /* External Interrupt
89 * Override the behavior by over-writing the handler code in RAM.
90 */
91 0404 00000000 .org 0x500
91 00000000 91 00000000 91 00000000 91 00000000 92 0500 48000000 b Interrupt_ESR
93
94 /* Alignment
95 * Override the behavior by over-writing the handler code in RAM.
96 */
97 0504 00000000 .org 0x600
97 00000000 97 00000000 97 00000000 97 00000000 98 0600 48000000 b _start
99
100 /* Program
101 * Override the behavior by over-writing the handler code in RAM.
102 */
103 0604 00000000 .org 0x700
103 00000000 103 00000000 103 00000000 103 00000000 104 0700 48000000 b _start
105
106 /* Floating Point Unavailable
107 * Override the behavior by over-writing the handler code in RAM.
108 */
109 0704 00000000 .org 0x800
109 00000000 109 00000000 109 00000000 109 00000000 110 0800 48000000 b _start
111
112 /* Decrementer Interrupt
113 * Override the behavior by over-writing the handler code in RAM.
114 */
115 0804 00000000 .org 0x900
115 00000000 115 00000000 115 00000000 115 00000000 116 0900 9421FFB0 stwu r1,-80(r1) #47条指令
117 0904 90010020 stw r0,32(r1) #save working register
118
119 0908 7C1A02A6 mfsrr0 r0 #0=sr0
120 090c 9001000C stw r0,12(1) #memory[1+12]=s0
GAS LISTING /tmp/cc60KWFF.s page 9 121 0910 7C1B02A6 mfsrr1 r0 #save s1,0=s1
122 0914 90010010 stw r0,16(r1) #memory[1+16]=s1
123 0918 7C7113A6 mtspr 81,r3 #set msr[ee]=0,msr[ri]=1
124
125 091c 7C0802A6 mflr r0 #get lr
126 0920 90010008 stw r0,8(r1) #save lr
127 0924 7C0102A6 mfxer r0
128 0928 90010014 stw r0,20(r1) #save xer
129 092c 7C0902A6 mfspr r0,CTR #save ctr
130 0930 90010018 stw r0,24(r1)
131 0934 7C000026 mfcr r0
132 0938 9001001C stw r0,28(r1) #save cr,以上15
133
134 093c 90610024 stw r3,36(r1) #save r3-12
135 0940 90810028 stw r4,40(r1)
136 0944 90A1002C stw r5,44(r1)
137 0948 90C10030 stw r6,48(r1)
138 094c 90E10034 stw r7,52(r1)
139 0950 91010038 stw r8,56(r1)
140 0954 9121003C stw r9,60(r1)
141 0958 91410040 stw 10,64(r1)
142 095c 91610044 stw r11,68(r1)
143 0960 91810048 stw r12,72(r1)
144 0964 3C800000 lis r4, OSTimeTick@h #跳转到节拍处理函数
145 0968 60840000 ori r4,r4,OSTimeTick@l
146 096c 4E800020 blr
147
148 0970 3CA00003 lis r5, 0x3 # 0x00030000 ,计数器重置。
149 0974 38A50D40 addi r5, r5, 0x0D40 # 0x30000 + 0xD40 = 0x30D40 = 200,000
150 0978 7CB603A6 mtdec r5 # Re-load decrementer ,以上16条
151
152 097c 81810048 lwz 12,72(r1) #restore 12-5,16条指令
153 0980 81610044 lwz r11,68(r1)
154 0984 81410040 lwz 10,64(r1)
155 0988 8121003C lwz r9, 60(r1)
156 098c 81010038 lwz r8, 56(r1)
157 0990 80E10034 lwz r7, 52(r1)
158 0994 80C10030 lwz r6, 48(r1)
159 0998 80A1002C lwz r5, 44(r1)
160
161 099c 8001001C lwz r0, 28(r1)#restore cr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -