URL
https://opencores.org/ocsvn/mips32r1/mips32r1/trunk
Subversion Repositories mips32r1
[/] [mips32r1/] [trunk/] [Software/] [demos/] [XD5_Threads/] [src/] [os/] [exceptions.asm] - Rev 2
Compare with Previous | Blame | View Log
################################################################################ TITLE: Exception Vectors# AUTHOR: Grant Ayers (ayers@cs.utah.edu)# DATE: 23 May 2012# FILENAME: exceptions.asm# PROJECT: University of Utah XUM Single Core# DESCRIPTION:# Provides the exception vectors which jump to# exception-handling routines.################################################################################.text.balign 4.set noreorderexc_save:addiu $sp, $sp, -96sw $2, 0($sp)sw $3, 4($sp)sw $4, 8($sp)sw $5, 12($sp)sw $6, 16($sp)sw $7, 20($sp)sw $8, 24($sp)sw $9, 28($sp)sw $10, 32($sp)sw $11, 36($sp)sw $12, 40($sp)sw $13, 44($sp)sw $14, 48($sp)sw $15, 52($sp)sw $16, 56($sp)sw $17, 60($sp)sw $18, 64($sp)sw $19, 68($sp)sw $20, 72($sp)sw $21, 76($sp)sw $22, 80($sp)sw $23, 84($sp)sw $24, 88($sp)jr $rasw $25, 92($sp)exc_restore:lw $2, 0($sp)lw $3, 4($sp)lw $4, 8($sp)lw $5, 12($sp)lw $6, 16($sp)lw $7, 20($sp)lw $8, 24($sp)lw $9, 28($sp)lw $10, 32($sp)lw $11, 36($sp)lw $12, 40($sp)lw $13, 44($sp)lw $14, 48($sp)lw $15, 52($sp)lw $16, 56($sp)lw $17, 60($sp)lw $18, 64($sp)lw $19, 68($sp)lw $20, 72($sp)lw $21, 76($sp)lw $22, 80($sp)lw $23, 84($sp)lw $24, 88($sp)lw $25, 92($sp)jr $raaddiu $sp, $sp, 96.global mips32_general_exception.ent mips32_general_exceptionmips32_general_exception:or $26, $0, $rajal exc_savenopmfc0 $27, $13, 0 # Read Cause which has ExcCode bitssrl $27, $27, 2 # Extract exception code to $k1andi $27, $27, 0x001fla $ra, $end_exception # Jump to the appropriate handleraddiu $t0, $0, 4addiu $t1, $0, 5addiu $t2, $0, 8addiu $t3, $0, 9beq $t0, $27, mips32_handler_AdELaddiu $t0, $0, 10beq $t1, $27, mips32_handler_AdESaddiu $t1, $0, 11beq $t2, $27, mips32_handler_Sysaddiu $t2, $0, 12beq $t3, $27, mips32_handler_Bpaddiu $t3, $0, 13beq $t0, $27, mips32_handler_RInopbeq $t1, $27, mips32_handler_CpUnopbeq $t2, $27, mips32_handler_Ovnopbeq $t3, $27, mips32_handler_Trnop$end_exception:jal exc_restorexor $27, $0, $0or $ra, $0, $26xor $26, $0, $0eret.end mips32_general_exception### "Special" Interrupt Vector: Cause_IV must be set..ent mips32_interrupt_exception.global mips32_interrupt_exceptionmips32_interrupt_exception:mfc0 $26, $12, 0 # Status register for IM bitsmfc0 $27, $13, 0 # Cause register for IP bitsand $26, $26, $27 # Extract pending, unmasked interruptssrl $26, $26, 8andi $26, $26, 0x00ffclz $26, $26addiu $27, $0, 24beq $26, $27, scheduler # Hw Int 5 goes directly to schedulernopaddu $27, $0, $rajal exc_savenopla $ra, $end_interruptaddiu $t0, $0, 25addiu $t1, $0, 26addiu $t2, $0, 27beq $26, $t0, mips32_handler_HwInt4addiu $t0, $0, 28beq $26, $t1, mips32_handler_HwInt3addiu $t1, $0, 29beq $26, $t2, mips32_handler_HwInt2addiu $t2, $0, 30beq $26, $t0, mips32_handler_HwInt1addiu $t0, $0, 31beq $26, $t1, mips32_handler_HwInt0nopbeq $26, $t2, mips32_handler_SwInt1nopbeq $26, $t0, mips32_handler_SwInt0nop$end_interrupt:jal exc_restorexor $27, $0, $0or $ra, $0, $26xor $26, $0, $0eret.end mips32_interrupt_exception
