Line 77... |
Line 77... |
|
|
l.j _start /* Jump to the start of code */
|
l.j _start /* Jump to the start of code */
|
l.nop
|
l.nop
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* Range exception
|
* Alignment exception
|
*
|
*
|
* Don't be tempted to use the LOAD_STR macro here, it will dump us back into
|
* Don't be tempted to use the LOAD_STR macro here, it will dump us back into
|
* text space.
|
* text section.
|
|
*
|
|
* The handling is a bit dubious at present. We just patch the instruction and
|
|
* restart. This will go wrong in branch delay slots. Really we need to single
|
|
* step past and then continue.
|
*
|
*
|
* Print a message about the instruction triggering the exception. Then
|
* Print a message identifying the exception type.
|
* replace it by l.nop and return.
|
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
.section .rodata
|
.section .rodata
|
50: .string " RANGE exception\n"
|
50: .string " ALIGNMENT exception\n"
|
51: .string " - caused by: "
|
|
52: .string " - SR value: "
|
|
|
|
.section .boot-text
|
.section .boot-text
|
.org 0xb00
|
.org 0x600
|
.global _range
|
.global _align
|
_range:
|
_align:
|
/* Note exception */
|
/* Report exception */
|
LOAD_CONST (r3, 50b)
|
LOAD_CONST (r3, 50b)
|
l.jal _puts
|
l.jal _puts
|
l.nop
|
l.nop
|
|
|
/* Report problem instruction */
|
/* Patch with l.nop */
|
|
l.mfspr r2,r0,SPR_EPCR_BASE /* Addr of problem instr */
|
|
LOAD_CONST (r3, 0x15000000) /* l.nop */
|
|
l.sw 0(r2),r3
|
|
|
|
/* All done */
|
|
l.rfe
|
|
_align_end:
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Illegal instruction exception
|
|
*
|
|
* Don't be tempted to use the LOAD_STR macro here, it will dump us back into
|
|
* text section.
|
|
*
|
|
* The handling is a bit dubious at present. We just patch the instruction and
|
|
* restart. This will go wrong in branch delay slots. Really we need to single
|
|
* step past and then continue.
|
|
*
|
|
* Print a message identifying the exception type.
|
|
* ------------------------------------------------------------------------- */
|
|
.section .rodata
|
|
51: .string " ILLEGAL INSTRUCTION exception\n"
|
|
|
|
.section .boot-text
|
|
.org 0x700
|
|
.global _illegal
|
|
_illegal:
|
|
/* Report exception */
|
LOAD_CONST (r3, 51b)
|
LOAD_CONST (r3, 51b)
|
l.jal _puts
|
l.jal _puts
|
l.nop
|
l.nop
|
|
|
|
/* Patch with l.nop */
|
l.mfspr r2,r0,SPR_EPCR_BASE /* Addr of problem instr */
|
l.mfspr r2,r0,SPR_EPCR_BASE /* Addr of problem instr */
|
l.lws r3,0(r2) /* The actual instruction */
|
LOAD_CONST (r3, 0x15000000) /* l.nop */
|
l.nop NOP_REPORT
|
l.sw 0(r2),r3
|
|
|
|
/* All done */
|
|
l.rfe
|
|
_illegal_end:
|
|
|
/* Report status register */
|
/* ----------------------------------------------------------------------------
|
|
* Range exception
|
|
*
|
|
* Don't be tempted to use the LOAD_STR macro here, it will dump us back into
|
|
* text section.
|
|
*
|
|
* The handling is a bit dubious at present. We just patch the instruction and
|
|
* restart. This will go wrong in branch delay slots. Really we need to single
|
|
* step past and then continue.
|
|
*
|
|
* Print a message identifying the exception type.
|
|
* ------------------------------------------------------------------------- */
|
|
.section .rodata
|
|
52: .string " RANGE exception\n"
|
|
|
|
.section .boot-text
|
|
.org 0xb00
|
|
.global _range
|
|
_range:
|
|
/* Report exception */
|
LOAD_CONST (r3, 52b)
|
LOAD_CONST (r3, 52b)
|
l.jal _puts
|
l.jal _puts
|
l.nop
|
l.nop
|
|
|
l.mfspr r3,r0,SPR_ESR_BASE /* Status reg */
|
|
l.nop NOP_REPORT
|
|
|
|
/* Patch with l.nop */
|
/* Patch with l.nop */
|
l.mfspr r2,r0,SPR_EPCR_BASE /* Addr of problem instr */
|
l.mfspr r2,r0,SPR_EPCR_BASE /* Addr of problem instr */
|
LOAD_CONST (r3, 0x15000000) /* l.nop */
|
LOAD_CONST (r3, 0x15000000) /* l.nop */
|
l.sw 0(r2),r3
|
l.sw 0(r2),r3
|
|
|