1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
; ###----------------------------------------------------------------###
; # file : exc012.u #
; # date : Mar 26 1996 #
; # descr. : functional test for mips #
; ###----------------------------------------------------------------###
; ###--------------------------------------------------------###
; # exceptions : #
; # - data address miss alignment (storing a half-word) #
; ###--------------------------------------------------------###
adr .equ 0x40000050
data .equ 0x616b ; data
.org 0x00400000
.start init
init:
loadi r31, back_from_exception
loadi r1 , adr ; half word's address in r1
loadi r2 , data ; data in r2
loadi r3 , data ; same data in r3
loadi r4 , data ^ 0xffffffff ; complemented data in r4
; ###--------------------------------------------------------###
; # store the word to initialize the memory location #
; ###--------------------------------------------------------###
sw r2, 0 (r1 )
; ###--------------------------------------------------------###
; # store half-word at a miss aligned address #
; ###--------------------------------------------------------###
sh r4, 1 (r1 ) ; EXCEPTION (alignment)
; ###--------------------------------------------------------###
; # after returning from exception, read the memory #
; # location and check that the faulty store word has not #
; # modified the memory #
; ###--------------------------------------------------------###
back_from_exception:
lw r5 , 0 (r1 )
; ###--------------------------------------------------------###
; # if the read word is correct branch to good #
; ###--------------------------------------------------------###
bne r5, r3,bad
nop
j good
nop
.org 0x004000d0
good: j good
nop
bad: j bad
nop
.end
|