title 'figure 2. use of external, program and supervisor inte+ rrupts' space 1 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * program to illustrate use of assist-v for handling interrupts * * three different interrupts are caused: * * supervisor - from execution of supervisor call instruction * * external - from expiration of value in interval timer * * program - from protection exception * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * space 1 * the following constants initialize the fixed memory locations * as described in figure 1. figure2 start 0 using *,0 iplpsw dc x'00000000',a(initial) begin machine run at "initial" + super. mode, permit ext. ints. ds 2d unused (ipl ccws) extold ds d for external old psw svcold ds d for supervisor old psw pgmold ds d for program old psw ds d unused (machine check old psw) ds d unused (i/o old psw) ds 2d unused (csw, caw) timer ds f interval timer ds f unused extnew dc x'00000000',a(exthandl) external int. handler new psw svcnew dc x'00000000',a(svchandl) supervisor int. handler new psw pgmnew dc x'00000000',a(pgmhandl) program int. handler new psw ds d unused (machine check new psw) ds d unused (i/o new psw) space 2 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * initialization section * * set storage protection * * request tracing of psw swaps * * turn control to user program at label "user" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * space 1 initial la 1,b'00110000' assign user prot. key b'00110' + (key 3, no fetch protect) la 2,user address of user 2k memory block ssk 1,2 set memory protection keys l 2,=xl4'00008000' trace all psw swaps sr 0,0 begin trace at location 0 la 1,user+2047 end trace at end of user area xopc 3 commence tracing lpsw userpsw transfer control to user space 1 userpsw dc 0d'0',X'01310000',a(user) allow external interrupts + prot. key=3, problem mode eject * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * supervisor call interrupt handler * * store value in reg. 1 in interval timer * * return control to user, after call * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * space 1 svchandl st 1,timer store user timer value (note: + prot key=0 in svc new psw) lpsw svcold return to point after svc with + user psw: prot key=3, prob. mode space 2 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * external interrupt handler * * break user's infinite loop and return to user at * * address "s0c4" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * space 1 exthandl lpsw timpsw go back to user with new psw space 1 timpsw dc 0d'0',x'01310000',a(s0c4) same prot. key, mode; to + label "s0c4" space 2 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * program interrupt handler * * terminate program run, with dump * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * space 1 pgmhandl xopc 25 pseudo-op to terminate with dump ltorg , origin of literal pool space 2 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * user test program * * begin user program at second 2k memory block: address 2048 * * cause supervisor interrupt, after 5 has been placed in reg 1 * * execute statement labelled "loop" repeatedly until timer * * interrupt occurs * * cause s0c4 error (protection) from attempt to store in 2k * * block having different protection key * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * space 1 org figure2+x'800' position user at 2nd 2k block user la 1,5 put value 5 into reg. 1 svc 1 cause supervisor interrupt loop b * enter 1-instruction loop s0c4 st 1,timer try to store in different block end