1 " ***********************************************************
2 " * *
3 " * Copyright, C Honeywell Bull Inc., 1987 *
4 " * *
5 " * Copyright, C Honeywell Information Systems Inc., 1982 *
6 " * *
7 " ***********************************************************
8
9 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
10 "
11 " vtoc_search - Routine to manage vtoc_buffer_seg's
12 " hash table
13 "
14 " Entries:
15 "
16 " hash_in - hashes a VTOCE buffer desc into a list
17 "
18 " hash_out - hashes a VTOCE buffer desc out of a list
19 "
20 " search - searches for a given PVTE, VTOCE index
21 "
22 " Written February 1982 by J. Bongiovanni
23 "
24 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
25
26 name vtoc_search
27
28 entry hash_in
29 entry hash_out
30 entry search
31
32 temp save_pvtx_vtocx
33
34 null_ptr:
35 its -1,1
36 "^L
37 include vtoc_buffer
38 "^L
39 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
40 "
41 " call vtoc_search$hash_in vtoc_buf_descp
42 "
43 " where vtoc_buf_descp -> buffer descriptor of interest
44 "
45 " Must be called with VTOC buffer locked
46 "
47 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
48
49 hash_in:
50 push
51 eppbp ap|2,* " bp -> vtoc_buf_descp
52 eppbp bp|0,* " bp -> vtoc_buf_desc
53 lda bp|vtoc_buf_desc.pvtx " Areg has pvtx in Upper, vtocx in Lower
54 tsx7 setup " Set pointers, compute hash table index
55 eax0 bp|0 " x0 = offset of this vtoc_buf_desc
56 ldx3 bb|vtoc_buffer.hash_table,x2 " x3 = 1st offset this bucket
57 stx0 bb|vtoc_buffer.hash_table,x2 " Make this the first
58 stx3 bp|vtoc_buf_desc.ht_thread " And the first shall be next
59 return
60 "^L
61 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
62 "
63 " call vtoc_search$hash_out vtoc_buf_descp
64 "
65 " where vtoc_buf_descp -> VTOC buffer descriptor of interest
66 "
67 " This must be called with the VTOC buffer lock
68 "
69 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
70
71 hash_out:
72 push
73 eppbp ap|2,* " bp -> vtoc_buf_descp
74 eppbp bp|0,* " bp -> vtoc_buf_desc
75 lda bp|vtoc_buf_desc.pvtx " Areg has pvtx in Upper, vtocx in Lower
76 tsx7 setup " Set pointers, compute hash index
77 tsx7 search_it " Look for this one in list
78 eax1 0,x1 " Found?
79 tze hash_out_returns " No - shouldn't happen
80 ldx3 bp|vtoc_buf_desc.ht_thread " x3 = offset of next after this
81 eax0 0,x0 " x0 = offset of previous
82 tze hash_out_empty " None previous
83 stx3 bb|vtoc_buf_desc.ht_thread,x0 " Link previous to next
84 tra hash_out_common
85 hash_out_empty:
86 stx3 bb|vtoc_buffer.hash_table,x2 " Make next the first
87 hash_out_common:
88 eax3 0 " Clear thread offset
89 stx3 bp|vtoc_buf_desc.ht_thread " In this one
90 hash_out_returns:
91 return
92 "^L
93 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
94 "
95 " call vtoc_search$search pvtx vtocx vtoc_buf_descp
96 "
97 " where
98 "
99 " pvtx = rel offset of PVTE Input
100 " vtocx = VTOCE index Input
101 " vtoc_buf_descp = ptr to vtoc_buf_desc or null
102 "
103 " This must be called with the VTOC buffer lock.
104 "
105 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
106
107 search:
108 push
109 lda ap|2,* " pvtx
110 ana -1,dl " Strip out any garbage
111 als 18 " pvtx in Upper
112 ora ap|4,* " vtocx in Lower
113 tsx7 setup " Set pointers, compute hash index
114 tsx7 search_it " Search hash thread
115 eax1 0,x1 " x1 = offset of buf desc
116 tze search_not_found " Not there
117 eppbp bb|0,x1 " bp -> buffer descriptor
118 tra search_returns
119 search_not_found:
120 eppbp null_ptr,*
121 search_returns:
122 spribp ap|6,* " Return pointer or null
123 return
124 "^L
125 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
126 "
127 " Internal procedure to search
128 "
129 " tsx7 search_it
130 "
131 " On entry,
132 "
133 " bb -> vtoc_buffer_seg
134 " Areg has pvte rel in Upper, vtocx in Lower
135 " x2 = hash index
136 "
137 " On exit,
138 "
139 " x0 = offset of previous in thread 0 if none
140 " x1 = offset of this entry 0 if none
141 "
142 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
143
144 search_it:
145 eax0 0 " Initialize to none
146 eax1 0
147 ldx1 bb|vtoc_buffer.hash_table,x2 " x1 = offset of first
148 tze 0,x7 " None
149
150 search_it_loop:
151 cmpa bb|vtoc_buf_desc.pvtx,x1 " This one a match
152 tze 0,x7 " yes - exit
153 eax0 0,x1 " Previous = current
154 ldx1 bb|vtoc_buf_desc.ht_thread,x1 " Next
155 tnz search_it_loop " Next exists
156 eax1 0 " Not found
157 tra 0,x7
158 "^L
159 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
160 "
161 " Internal procedure to set pointers and compute hash index
162 "
163 " tsx7 setup
164 "
165 " On entry,
166 "
167 " Areg has pvtx in Upper, vtocx in Lower
168 "
169 " On exit,
170 "
171 " bb -> vtoc_buffer_seg
172 "
173 " x2 = hash index
174 "
175 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
176
177 setup:
178 eppbb vtoc_buffer_seg$
179 sta save_pvtx_vtocx " pvtx, vtocx
180 ldq save_pvtx_vtocx
181
182 qrl 18
183 erq save_pvtx_vtocx
184 anq bb|vtoc_buffer.hash_mask
185 eax2 0,ql
186
187 tra 0,x7
188
189
190 end