1 1.1 christos # frv testcase to generate reset interrupts 2 1.1 christos # mach: fr500 fr550 fr400 3 1.1 christos # sim: --memory-region 0xff000000,64 4 1.1 christos 5 1.1 christos .include "testutils.inc" 6 1.1 christos 7 1.1 christos start 8 1.1 christos 9 1.1 christos .global reset 10 1.1 christos reset: 11 1.1 christos and_spr_immed 0xfffffffb,psr ; turn off PSR.S 12 1.1 christos set_gr_immed 0xfeff0500,gr10 ; address of reset register 13 1.1 christos set_spr_immed 0x7fffffff,lcr 14 1.1 christos set_bctrlr_0_0 gr0 15 1.1 christos 16 1.1 christos ; Can't recover from hardware interrupt with enough state intact to verify it 17 1.1 christos ; set_spr_addr ok1,lr 18 1.1 christos ; set_mem_immed 0x3,gr10 ; cause hardware reset 19 1.1 christos ; dcf @(gr10,gr0) ; Wait for store to happen 20 1.1 christos ; fail 21 1.1 christos ; 22 1.1 christos ;ok1: ; reset should branch to reset address which should then branch here 23 1.1 christos ; test_mem_immed 0x00000200,gr10 24 1.1 christos ; set_spr_addr ok2,lr 25 1.1 christos ; set_mem_immed 0x2,gr10 ; cause hardware reset 26 1.1 christos ; dcf @(gr10,gr0) ; Wait for store to happen 27 1.1 christos ; fail 28 1.1 christos ; 29 1.1 christos ok2: ; reset should branch to reset address which should then branch here 30 1.1 christos ; test_mem_immed 0x00000200,gr10 31 1.1 christos set_spr_addr ok3,lr 32 1.1 christos set_mem_immed 0x1,gr10 ; cause software reset 33 1.1 christos dcf @(gr10,gr0) ; Wait for store to happen 34 1.1 christos fail 35 1.1 christos 36 1.1 christos ok3: ; reset should branch to reset address which should then branch here 37 1.1 christos test_mem_immed 0x00000100,gr10 38 1.1 christos test_spr_bits 0x4,2,1,psr ; psr.s is set 39 1.1 christos test_spr_bits 0x2,1,0,psr ; psr.ps not set 40 1.1 christos set_spr_addr bad,lr 41 1.1 christos set_mem_immed 0x0,gr10 ; no reset 42 1.1 christos test_mem_immed 0x0,gr10 43 1.1 christos 44 1.1 christos ; now retest with HSR0.SA set 45 1.1 christos set_mem_immed 0,gr0 46 1.1 christos set_gr_addr 0xff000000,gr11 47 1.1 christos set_bctrlr_0_0 gr11 48 1.1 christos or_spr_immed 0x00001000,hsr0 ; set HSR0.SA 49 1.1 christos 50 1.1 christos ; Can't recover from hardware interrupt with enough state intact to verify it 51 1.1 christos ; set_spr_addr ok4,lr 52 1.1 christos ; dcf @(gr10,gr0) ; Wait for store to happen 53 1.1 christos ; set_mem_immed 0x3,gr10 ; cause hardware reset 54 1.1 christos ; fail 55 1.1 christos ; 56 1.1 christos ;ok4: ; reset should branch to reset address which should then branch here 57 1.1 christos ; test_mem_immed 0x00000200,gr10 58 1.1 christos ; set_spr_addr ok5,lr 59 1.1 christos ; set_mem_immed 0x2,gr10 ; cause hardware reset 60 1.1 christos ; dcf @(gr10,gr0) ; Wait for store to happen 61 1.1 christos ; fail 62 1.1 christos ; 63 1.1 christos ok5: ; reset should branch to reset address which should then branch here 64 1.1 christos ; test_mem_immed 0x00000200,gr10 65 1.1 christos set_spr_addr ok6,lr 66 1.1 christos set_mem_immed 0x1,gr10 ; cause software reset 67 1.1 christos dcf @(gr10,gr0) ; Wait for store to happen 68 1.1 christos fail 69 1.1 christos 70 1.1 christos ok6: ; reset should branch to reset address which should then branch here 71 1.1 christos test_mem_immed 0x00000100,gr10 72 1.1 christos test_spr_bits 0x4,2,1,psr ; psr.s is set 73 1.1 christos test_spr_bits 0x2,1,1,psr ; psr.ps is set 74 1.1 christos set_spr_addr bad,lr 75 1.1 christos set_mem_immed 0x0,gr10 ; no reset 76 1.1 christos test_mem_immed 0x0,gr10 77 1.1 christos 78 1.1 christos pass 79 1.1 christos 80 1.1 christos bad: ; Should never get here 81 1.1 christos fail 82