Line 63... |
Line 63... |
l.movhi r27, 0
|
l.movhi r27, 0
|
l.movhi r28, 0
|
l.movhi r28, 0
|
l.movhi r29, 0
|
l.movhi r29, 0
|
l.movhi r30, 0
|
l.movhi r30, 0
|
l.movhi r31, 0
|
l.movhi r31, 0
|
|
|
/* Clear status register, set supervisor mode */
|
/* Clear status register, set supervisor mode */
|
l.ori r1, r0, SPR_SR_SM
|
l.ori r1, r0, SPR_SR_SM
|
l.mtspr r0, r1, SPR_SR
|
l.mtspr r0, r1, SPR_SR
|
/* Clear timer */
|
/* Clear timer */
|
l.mtspr r0, r0, SPR_TTMR
|
l.mtspr r0, r0, SPR_TTMR
|
Line 194... |
Line 195... |
/* ========================================================= [ entry ] === */
|
/* ========================================================= [ entry ] === */
|
.section .text
|
.section .text
|
|
|
ENTRY(_start)
|
ENTRY(_start)
|
|
|
|
/* Cache initialisation */
|
|
l.jal _cache_init
|
/* Instruction cache enable */
|
|
/* Check if IC present and skip enabling otherwise */
|
|
l.mfspr r24,r0,SPR_UPR
|
|
l.andi r26,r24,SPR_UPR_ICP
|
|
l.sfeq r26,r0
|
|
l.bf .L8
|
|
l.nop
|
|
|
|
/* Disable IC */
|
|
l.mfspr r6,r0,SPR_SR
|
|
l.addi r5,r0,-1
|
|
l.xori r5,r5,SPR_SR_ICE
|
|
l.and r5,r6,r5
|
|
l.mtspr r0,r5,SPR_SR
|
|
|
|
/* Establish cache block size
|
|
If BS=0, 16;
|
|
If BS=1, 32;
|
|
r14 contain block size
|
|
*/
|
|
l.mfspr r24,r0,SPR_ICCFGR
|
|
l.andi r26,r24,SPR_ICCFGR_CBS
|
|
l.srli r28,r26,7
|
|
l.ori r30,r0,16
|
|
l.sll r14,r30,r28
|
|
|
|
/* Establish number of cache sets
|
|
r16 contains number of cache sets
|
|
r28 contains log(# of cache sets)
|
|
*/
|
|
l.andi r26,r24,SPR_ICCFGR_NCS
|
|
l.srli r28,r26,3
|
|
l.ori r30,r0,1
|
|
l.sll r16,r30,r28
|
|
|
|
/* Invalidate IC */
|
|
l.addi r6,r0,0
|
|
l.sll r5,r14,r28
|
|
|
|
.L7:
|
|
l.mtspr r0,r6,SPR_ICBIR
|
|
l.sfne r6,r5
|
|
l.bf .L7
|
|
l.add r6,r6,r14
|
|
|
|
/* Enable IC */
|
|
l.mfspr r6,r0,SPR_SR
|
|
l.ori r6,r6,SPR_SR_ICE
|
|
l.mtspr r0,r6,SPR_SR
|
|
l.nop
|
|
l.nop
|
|
l.nop
|
|
l.nop
|
|
l.nop
|
|
l.nop
|
|
l.nop
|
|
l.nop
|
|
|
|
.L8:
|
|
/* Data cache enable */
|
|
/* Check if DC present and skip enabling otherwise */
|
|
l.mfspr r24,r0,SPR_UPR
|
|
l.andi r26,r24,SPR_UPR_DCP
|
|
l.sfeq r26,r0
|
|
l.bf .L10
|
|
l.nop
|
l.nop
|
/* Disable DC */
|
|
l.mfspr r6,r0,SPR_SR
|
|
l.addi r5,r0,-1
|
|
l.xori r5,r5,SPR_SR_DCE
|
|
l.and r5,r6,r5
|
|
l.mtspr r0,r5,SPR_SR
|
|
/* Establish cache block size
|
|
If BS=0, 16;
|
|
If BS=1, 32;
|
|
r14 contain block size
|
|
*/
|
|
l.mfspr r24,r0,SPR_DCCFGR
|
|
l.andi r26,r24,SPR_DCCFGR_CBS
|
|
l.srli r28,r26,7
|
|
l.ori r30,r0,16
|
|
l.sll r14,r30,r28
|
|
/* Establish number of cache sets
|
|
r16 contains number of cache sets
|
|
r28 contains log(# of cache sets)
|
|
*/
|
|
l.andi r26,r24,SPR_DCCFGR_NCS
|
|
l.srli r28,r26,3
|
|
l.ori r30,r0,1
|
|
l.sll r16,r30,r28
|
|
/* Invalidate DC */
|
|
l.addi r6,r0,0
|
|
l.sll r5,r14,r28
|
|
.L9:
|
|
l.mtspr r0,r6,SPR_DCBIR
|
|
l.sfne r6,r5
|
|
l.bf .L9
|
|
l.add r6,r6,r14
|
|
/* Enable DC */
|
|
l.mfspr r6,r0,SPR_SR
|
|
l.ori r6,r6,SPR_SR_DCE
|
|
l.mtspr r0,r6,SPR_SR
|
|
|
|
.L10:
|
|
|
|
/* Clear BSS */
|
/* Clear BSS */
|
LOAD_SYMBOL_2_GPR(r28, _bss_start)
|
LOAD_SYMBOL_2_GPR(r5, _bss_start)
|
LOAD_SYMBOL_2_GPR(r30, _bss_end)
|
LOAD_SYMBOL_2_GPR(r6, _bss_end)
|
1:
|
1:
|
l.sw (0)(r28), r0
|
l.sw (0)(r5), r0
|
l.sfltu r28, r30
|
l.sfltu r5, r6
|
l.bf 1b
|
l.bf 1b
|
l.addi r28, r28, 4
|
l.addi r5, r5, 4
|
|
|
/* Initialise UART in a C function */
|
|
/*l.jal _uart_init
|
|
l.nop*/
|
|
|
|
/* Jump to main program entry point (argc = argv = 0) */
|
/* Jump to main program entry point (argc = argv = 0) */
|
CLEAR_GPR(r3)
|
CLEAR_GPR(r3)
|
CLEAR_GPR(r4)
|
CLEAR_GPR(r4)
|
l.jal main
|
l.jal main
|