From: Jérôme Benoit Date: Mon, 26 Jun 2017 09:15:49 +0000 (+0200) Subject: Add error handling sample code X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b861113c121c153bc0bff3b6815be23782643aad;p=TD_IML.git Add error handling sample code Signed-off-by: Jérôme Benoit --- diff --git a/error_handling/mips1.asm b/error_handling/mips1.asm new file mode 100644 index 0000000..cab0e10 --- /dev/null +++ b/error_handling/mips1.asm @@ -0,0 +1,29 @@ +.ktext 0x80000180 + li $k1, 16 + mfc0 $k0, $13 + beq $k0, $k1, errmem + move $k0, $a0 + move $k1, $v0 + la $a0, trapmsg + li $v0, 4 + syscall + j kret +errmem: + move $k0, $a0 + move $k1, $v0 + la $a0, memmsg + li $v0, 4 + syscall +kret: + move $a0, $k0 + move $k1, $v0 + mfc0 $k0, $14 + addi $k0, $k0, 4 + mtc0 $k0, $14 + eret +.kdata + trapmsg: .asciiz "T" + memmsg: .asciiz "O" +.text + teq $0, $0 + lb $t1, 0($0) \ No newline at end of file