1 " ***********************************************************
  2 " *                                                         *
  3 " * Copyright, (C) Honeywell Bull Inc., 1987                *
  4 " *                                                         *
  5 " * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  6 " *                                                         *
  7 " ***********************************************************
  8 
  9 "
 10 "         BOOTLOAD_DSEG
 11 "
 12 "         This program is called periodically to set up SDWs for the
 13 "         collection 1 segments as they are read in.
 14 "
 15 " Created  10/04/80, W. Olin Sibert, from bootstrap1
 16 " Modified 12/16/80, WOS, to construct both ADP and L68 SDWs, and for
 17 "   bootload_dseg$make_sdw
 18 " Modified 01/16/81, WOS, to remove references to processor_utility_segment, and fix bugs
 19 " Modified sometime in May, 1981, by Chris Jones to cause it to accept system type in x0
 20 " Modified BIM 8/82 to run appended as soon as possible, by receiving a
 21 " bbl0-relative return address. All ic-rel's removed from make_sdw.
 22 " Modified October 1982 by C. Hornig for canned dseg.
 23 " Modified September 1983 by K. Loepere for adp and for make_core_ptw.
 24 
 25           name      bootload_dseg
 26 
 27           include   bootload_equs
 28 
 29           include   adp_sdw
 30           include   sdw_info
 31           include   l68_sdw
 32           include   system_types
 33 "^L
 34 "         tsx2      bootload_dseg$make_sdw
 35 "
 36 "         This entry is called by bootload_loader to create SDWs for collection 1
 37 "         segments. It is entered via tsx2, and expects PR6 to point to an sdw_info
 38 "         block. It returns with the SDW in the AQ.
 39 
 40 
 41 ret_sdw:  bss       ,2
 42 
 43           segdef    make_sdw
 44 
 45 make_sdw: stz       ret_sdw             " Clear the SDW to be returned
 46           stz       ret_sdw+1
 47 
 48           lda       pr6|sdw_info.bound  " Adjust the bound appropriately
 49           ldq       pr6|sdw_info.flags  " for paged or unpaged segment
 50           canq      sdw_info.paged,du
 51           tze       adjust_bound_unpaged
 52           ada       1023,dl                       " Page boundary
 53           arl       10
 54           als       10
 55           tra       have_bound
 56 
 57 adjust_bound_unpaged:
 58           ada       15,dl
 59           arl       4
 60           als       4
 61 
 62 have_bound:
 63           ars       4                             " Divide by 16
 64           tpnz      have_nonzero_bound  " Bound is positive
 65           lda       1,dl                          " Pretend, instead
 66           ldq       sdw_info.faulted,du           " but fault the SDW if bound was
 67           orsq      pr6|sdw_info.flags  " supposed to be zero
 68 
 69 have_nonzero_bound:
 70           sba       1,dl                          " subtract to convert to offset
 71           ldq       bootload_info$system_type
 72           cmpq      ADP_SYSTEM,dl
 73           tnz       l68_bound
 74 
 75           ldq       pr6|sdw_info.flags            " If it's paged, we should remove
 76           canq      sdw_info.paged,du             " the low order bits for the ADP
 77           tze       2,ic                          " since bound is measured in pages.
 78           ana       =o777700,dl                   " Bound was divided by 16 already.
 79           ana       adp_sdw.bound_mask,dl
 80           als       adp_sdw.bound_shift           " Save it
 81           orsa      ret_sdw+adp_sdw.bound_word
 82           tra       bound_setup
 83 
 84 l68_bound:
 85           ana       l68_sdw.bound_mask,dl
 86           als       l68_sdw.bound_shift           " Save it
 87           orsa      ret_sdw+l68_sdw.bound_word
 88 " ^L
 89 bound_setup:
 90           lda       bootload_info$system_type
 91           cmpa      ADP_SYSTEM,dl
 92           tnz       l68_address
 93 
 94           lda       pr6|sdw_info.address          " Adjust and shift. Don't bother
 95           als       adp_sdw.add_shift             " masking this one because it's
 96           orsa      ret_sdw+adp_sdw.add_word " too large for a ,DL mask
 97 
 98           lda       pr6|sdw_info.access " Pick up four access bits
 99           arl       36-4                          " Put in low end of word
100           als       adp_sdw.access_shift          " Must be in the order: REWP
101           orsa      ret_sdw+adp_sdw.access_word
102 
103           lda       pr6|sdw_info.rings  " Pick up the ring brackets
104           arl       36-3*3
105           als       adp_sdw.rings_shift
106           orsa      ret_sdw+adp_sdw.rings_word
107 
108           lda       pr6|sdw_info.gate_entry_bound " Is it a gate?
109           tnz       set_adp_entry_bound
110 
111           ldq       adp_sdw.not_a_gate,dl         " Get the not-a-gate flag
112           orsq      ret_sdw+adp_sdw.not_a_gate_word " and set it
113           tra       set_adp_sdw_flags
114 
115 set_adp_entry_bound:
116           sba       1,dl                          " Convert into actual offset
117           ana       adp_sdw.entry_bound_mask,dl   " for entry bound in SDW
118           als       adp_sdw.entry_bound_shift
119           orsa      ret_sdw+adp_sdw.entry_bound_word
120 
121 set_adp_sdw_flags:
122           ldq       pr6|sdw_info.flags  " Get the flags (ignore cache for ADP)
123 
124           lda       adp_sdw.unpaged,dl            " Get the unpaged flag
125           canq      sdw_info.paged,du
126           tnz       2,ic                          " If not paged, don't seg unpaged
127           orsa      ret_sdw+adp_sdw.unpaged_word
128 
129           lda       adp_sdw.valid,dl              " Get the valid flag
130           canq      sdw_info.faulted,du           " See if it should NOT be set
131           tnz       2,ic                          " If faulted, don't set valid to 1.
132           orsa      ret_sdw+adp_sdw.valid_word
133           tra       address_setup
134 " ^L
135 l68_address:
136           lda       pr6|sdw_info.address          " Adjust and shift. Don't bother
137           als       l68_sdw.add_shift             " masking this one because it's
138           orsa      ret_sdw+l68_sdw.add_word " too large for a ,DL mask
139 
140           lda       pr6|sdw_info.access " Pick up four access bits
141           arl       36-4                          " Put in low end of word
142           als       l68_sdw.access_shift          " Must be in the order: REWP
143           orsa      ret_sdw+l68_sdw.access_word
144 
145           lda       pr6|sdw_info.rings  " Pick up the ring brackets
146           arl       36-3*3
147           als       l68_sdw.rings_shift
148           orsa      ret_sdw+l68_sdw.rings_word
149 
150           lda       pr6|sdw_info.gate_entry_bound " Is it a gate?
151           tnz       set_l68_entry_bound " Not unless this is nonzero
152 
153           ldq       l68_sdw.not_a_gate,dl         " Get the not-a-gate flag
154           orsq      ret_sdw+l68_sdw.not_a_gate_word " and set it
155           tra       set_l68_sdw_flags
156 
157 set_l68_entry_bound:
158           sba       1,dl                          " Convert into actual offset
159           ana       l68_sdw.entry_bound_mask,dl   " for entry bound in SDW
160           als       l68_sdw.entry_bound_shift
161           orsa      ret_sdw+l68_sdw.entry_bound_word
162 
163 set_l68_sdw_flags:
164           ldq       pr6|sdw_info.flags  " Get the flags (ignore cache for ADP)
165 
166           lda       l68_sdw.unpaged,dl            " Get the unpaged flag
167           canq      sdw_info.paged,du
168           tnz       2,ic                          " If not paged, don't seg unpaged
169           orsa      ret_sdw+l68_sdw.unpaged_word
170 
171           lda       l68_sdw.valid,dl              " Since Level 68 segment fault is
172           canq      sdw_info.faulted,du           " DF0, there is no need to set df_no
173           tnz       2,ic
174           orsa      ret_sdw+l68_sdw.valid_word
175 
176           lda       l68_sdw.cache,dl              " Get the encacheability flag
177           canq      sdw_info.cache,du
178           tze       2,ic                          " If not paged, don't seg unpaged
179           orsa      ret_sdw+l68_sdw.cache_word
180 
181 address_setup:
182           ldaq      ret_sdw
183           tra       0,x2
184 "^L
185 "         tsx2      bootload_dseg$make_core_ptw
186 "
187 " called with a memory address in a.  Returns a ptw for this in q.
188 
189           segdef    make_core_ptw
190 
191 make_core_ptw:
192           sta       core_addr
193           ldq       bootload_info$system_type
194           cmpq      ADP_SYSTEM,dl
195           tnz       l68_ptw
196 
197           ldq       core_addr
198           qls       18-10
199           orq       =o010064,dl
200           tra       0,x2
201 
202 l68_ptw:  ldq       core_addr
203           qls       18-6
204           orq       =o420025,dl
205           tra       0,x2
206 
207 core_addr:
208           dec       0
209           end