cp: revamp directory handling
[hvf.git] / cp / guest / guest_ipl.s
blobca3b2793debcbe2348eb761f5d696e9540e1e6d6
1 /*
2 * (C) Copyright 2007-2010 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
5 * details.
6 */
9 # We are guaranteed the following:
11 # 1) we are located above 16M
12 # 2) we are located below 2G
13 # 3) we are running in ESA/390
14 # 4) we are in 31-bit addressing mode
15 # 5) the guest registers are saved at GUEST_IPL_REGSAVE
16 # 6) R1 contains the subchannel #
17 # 7) R2 contains the device #
18 # 8) R12 contains the base address
20 # Register usage:
22 # R1 = subchannel number
23 # R2 = device number
24 # R3 = temp
25 # R12 = base for this code
28 # Nice register names
29 .equ r0,0
30 .equ r1,1
31 .equ r2,2
32 .equ r3,3
33 .equ r12,12
34 .equ r15,15
36 # new IO interruption PSW address
37 .equ PSANEWIO,120
39 ###############################################################################
40 # Code begins here #
41 ###############################################################################
43 .globl GUEST_IPL_CODE
44 .type GUEST_IPL_CODE, @function
45 GUEST_IPL_CODE:
46 STSCH SCHIB(r12) # get the SCHIB
47 BNZ ERROR(r12)
49 OI SCHIB+5(r12),0x80 # enable the subchannel
51 MSCH SCHIB(r12) # load up the SCHIB
52 BNZ ERROR(r12)
54 # got a functioning subchannel, let's set up the new IO psw
56 MVC PSANEWIO(8,r0),IOPSW(r12)
58 L r3,PSANEWIO+4(r0,r0)
59 LA r3,IO(r3,r12) # calculate the address of
60 ST r3,PSANEWIO+4(r0,r0) # the IO handler
62 # let's set up a CCW + an ORB, start the IO, and wait
64 MVC 0(8,r0),INITCCW(r12) # set up the initial CCW
65 OI ORB+6(r12),0xff # set the LPM in the ORB
67 SSCH ORB(r12) # start the IO
68 BNZ ERROR(r12)
70 LPSW ENABLEDWAIT(r12) # wait for IO interruptions
72 .equ IO,(.-GUEST_IPL_CODE)
73 # this is the IO interrupt handler
75 B DONE(r12)
77 .equ ERROR,(.-GUEST_IPL_CODE)
78 # an error occured, return an error
80 LM r0,r15,REGSAVE(r12)
81 DIAG r0,r0,1 # return to hypervisor
83 .equ DONE,(.-GUEST_IPL_CODE)
84 # we were successful!
86 LM r0,r15,REGSAVE(r12)
87 DIAG r0,r0,0 # return to hypervisor
89 ###############################################################################
90 # Data begins here #
91 ###############################################################################
93 .equ DISABLEDWAIT,(.-GUEST_IPL_CODE)
94 .long 0x000c0000
95 .long 0x80000000 # disabled wait PSW; signal
96 # return to hypervisor
97 .equ ENABLEDWAIT,(.-GUEST_IPL_CODE)
98 .long 0x020c0000
99 .long 0x80000000 # enabled wait PSW; wait for IO
101 .equ IOPSW,(.-GUEST_IPL_CODE)
102 .long 0x00080000
103 .long 0x80000000 # new IO psw
105 .equ INITCCW,(.-GUEST_IPL_CODE)
106 .long 0x02000000
107 .long 0x60000018 # fmt0, read 24 bytes to addr 0
109 .align 4
110 .equ ORB,(.-GUEST_IPL_CODE)
111 .skip (8*4),0 # the ORB is BIG
113 .align 4
114 .equ SCHIB,(.-GUEST_IPL_CODE)
115 .skip (13*4),0 # the SCHIB is BIG
117 .align 4
118 .globl GUEST_IPL_REGSAVE
119 .type GUEST_IPL_REGSAVE, @function
120 GUEST_IPL_REGSAVE:
121 .equ REGSAVE,(.-GUEST_IPL_CODE) # register save area