181 |
|
M68kRegisters r; |
182 |
|
|
183 |
|
// Find shared library |
184 |
< |
static const uint16 proc1[] = { |
185 |
< |
PW(0x558f), // subq.l #2,a7 |
186 |
< |
PW(0x2f08), // move.l a0,-(a7) |
187 |
< |
PW(0x2f3c), PW(0x7077), PW(0x7063), // move.l #'pwpc',-(a7) |
188 |
< |
PW(0x2f3c), PW(0x0000), PW(0x0001), // move.l #kReferenceCFrag,-(a7) |
189 |
< |
PW(0x2f09), // move.l a1,-(a7) |
190 |
< |
PW(0x2f0a), // move.l a2,-(a7) |
191 |
< |
PW(0x2f0b), // move.l a3,-(a7) |
192 |
< |
PW(0x3f3c), PW(0x0001), // (GetSharedLibrary) |
193 |
< |
PW(0xaa5a), // CFMDispatch |
194 |
< |
PW(0x301f), // move.w (a7)+,d0 |
195 |
< |
PW(M68K_RTS) |
184 |
> |
static const uint8 proc1_template[] = { |
185 |
> |
0x55, 0x8f, // subq.l #2,a7 |
186 |
> |
0x2f, 0x08, // move.l a0,-(a7) |
187 |
> |
0x2f, 0x3c, 0x70, 0x77, 0x70, 0x63, // move.l #'pwpc',-(a7) |
188 |
> |
0x2f, 0x3c, 0x00, 0x00, 0x00, 0x01, // move.l #kReferenceCFrag,-(a7) |
189 |
> |
0x2f, 0x09, // move.l a1,-(a7) |
190 |
> |
0x2f, 0x0a, // move.l a2,-(a7) |
191 |
> |
0x2f, 0x0b, // move.l a3,-(a7) |
192 |
> |
0x3f, 0x3c, 0x00, 0x01, // (GetSharedLibrary) |
193 |
> |
0xaa, 0x5a, // CFMDispatch |
194 |
> |
0x30, 0x1f, // move.w (a7)+,d0 |
195 |
> |
M68K_RTS >> 8, M68K_RTS |
196 |
|
}; |
197 |
+ |
BUILD_SHEEPSHAVER_PROCEDURE(proc1); |
198 |
|
r.a[0] = lib.addr(); |
199 |
|
r.a[1] = conn_id.addr(); |
200 |
|
r.a[2] = main_addr.addr(); |
201 |
|
r.a[3] = err.addr(); |
202 |
< |
Execute68k(Host2MacAddr((uint8 *)proc1), &r); |
202 |
> |
Execute68k(proc1, &r); |
203 |
|
D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", (int16)r.d[0], conn_id.value(), main_addr.value())); |
204 |
|
if (r.d[0]) |
205 |
|
return NULL; |
206 |
|
|
207 |
|
// Find symbol |
208 |
< |
static const uint16 proc2[] = { |
209 |
< |
PW(0x558f), // subq.l #2,a7 |
210 |
< |
PW(0x2f00), // move.l d0,-(a7) |
211 |
< |
PW(0x2f08), // move.l a0,-(a7) |
212 |
< |
PW(0x2f09), // move.l a1,-(a7) |
213 |
< |
PW(0x2f0a), // move.l a2,-(a7) |
214 |
< |
PW(0x3f3c), PW(0x0005), // (FindSymbol) |
215 |
< |
PW(0xaa5a), // CFMDispatch |
216 |
< |
PW(0x301f), // move.w (a7)+,d0 |
217 |
< |
PW(M68K_RTS) |
208 |
> |
static const uint8 proc2_template[] = { |
209 |
> |
0x55, 0x8f, // subq.l #2,a7 |
210 |
> |
0x2f, 0x00, // move.l d0,-(a7) |
211 |
> |
0x2f, 0x08, // move.l a0,-(a7) |
212 |
> |
0x2f, 0x09, // move.l a1,-(a7) |
213 |
> |
0x2f, 0x0a, // move.l a2,-(a7) |
214 |
> |
0x3f, 0x3c, 0x00, 0x05, // (FindSymbol) |
215 |
> |
0xaa, 0x5a, // CFMDispatch |
216 |
> |
0x30, 0x1f, // move.w (a7)+,d0 |
217 |
> |
M68K_RTS >> 8, M68K_RTS |
218 |
|
}; |
219 |
+ |
BUILD_SHEEPSHAVER_PROCEDURE(proc2); |
220 |
|
r.d[0] = conn_id.value(); |
221 |
|
r.a[0] = sym.addr(); |
222 |
|
r.a[1] = sym_addr.addr(); |
223 |
|
r.a[2] = sym_class.addr(); |
224 |
< |
Execute68k(Host2MacAddr((uint8 *)proc2), &r); |
224 |
> |
Execute68k(proc2, &r); |
225 |
|
D(bug(" FindSymbol1: ret %d, sym_addr %p, sym_class %ld\n", (int16)r.d[0], sym_addr.value(), sym_class.value())); |
226 |
|
//!! CloseConnection()? |
227 |
|
if (r.d[0]) |