diff --git a/kern.h b/kern.h index 573b1eb..818a4d1 100644 --- a/kern.h +++ b/kern.h @@ -16,16 +16,11 @@ extern int KERN_CALL Net_Call(UI func, void *req, void *repl); extern int KERN_CALL C32_LoadNios_Probe(UI axfunc, void *outbuf); extern int KERN_CALL C32_GetFunc_Probe(char *name, void *outbuf); extern int KERN_CALL C32_CallVersion_Nios_Probe(void *outbuf); -extern int KERN_CALL C32_MapLock_Probe(void *ptr, UI len, void *outbuf); -extern int KERN_CALL C32_NCP87_Raw_Probe(UI connLo, UI connHi, - void *hdr, UI hdrLen, - void *path, UI pathLen, - void *rep0, UI rep0Len, - void *rep1, UI rep1Len, - void *outbuf); extern int KERN_CALL Net_Call_VLM_Raw(UI ax, UI bx, UI cx, UI dx, void *req, void *repl, UI p1, UI p2, UI p3); +extern int KERN_CALL Net_Call_NWCVLMREQ(UI flags, void *regblk, + UI p1, UI p2, UI p3); extern int KERN_CALL Net_Call_C(UI func, void *req, void *repl); extern int KERN_CALL Net_Call_CX(UI func, UI bx, UI cx, UI dx, void *req, void *repl); diff --git a/kern_wasm.asm b/kern_wasm.asm index 78a17d8..a870b3a 100644 --- a/kern_wasm.asm +++ b/kern_wasm.asm @@ -23,9 +23,8 @@ public _Net_Call public _C32_LoadNios_Probe public _C32_GetFunc_Probe public _C32_CallVersion_Nios_Probe -public _C32_MapLock_Probe -public _C32_NCP87_Raw_Probe public _Net_Call_VLM_Raw +public _Net_Call_NWCVLMREQ _IPXinit proc far push bp @@ -594,455 +593,115 @@ c32ver_name db 'CLIENT32GetVersion',0 _C32_CallVersion_Nios_Probe endp -; int C32_MapLock_Probe(void *ptr, UI len, void *outbuf) +; int Net_Call_NWCVLMREQ(UI flags, void *regblk, UI p1, UI p2, UI p3) ; -; Probe d32wrap.o __MapLockFlat / __UnlockFlat: -; INT 2F AX=D8C1 -; ESI resolver returned by D8C1 is used with command 2 and 3: -; push len_hi -; push len_lo -; push seg -; push off -; push 0 -; push 2 -; call ESI ; returns flat DX:AX +; 16-bit wrapper that reproduces the DeveloperNet NWCVLMREQ register-block +; calling convention, but without using Novell globals. ; -; push len_hi -; push len_lo -; push flat_hi -; push flat_lo -; push 0 -; push 3 -; call ESI ; unlock +; regblk layout, same as dvlmreq.o: +; +00 SI +; +02 DS +; +04 DI +; +06 ES +; +08 AX +; +0A BX +; +0C CX +; +0E DX ; -; outbuf: -; +00 load AX -; +02 ESI off -; +04 ESI seg -; +06 map AX low -; +08 map DX high -; +0A unlock AX -; +0C unlock DX -_C32_MapLock_Probe proc far +; It calls the VLM entry returned by INT 2F AX=7A20. +; Stack args are pushed as p3,p2,p1, exactly like NWCVLMREQ. +_Net_Call_NWCVLMREQ proc far push bp mov bp, sp - sub sp, 8 + sub sp, 4 push ds - push es push si push di - - ; clear ECX/ESI - db 66h, 33h, 0C9h - db 66h, 33h, 0F6h - - mov ax, 0D8C1h - int 2Fh - - ; save ESI resolver at [bp-4] - db 66h, 89h, 76h, 0FCh - push ax ; load AX - - or ax, ax - jne mapflat_fail - - ; MapLockFlat(ptr, len) - push 0 - push word ptr [bp+10] ; len - push word ptr [bp+8] ; ptr seg - push word ptr [bp+6] ; ptr off - push 0 - push 2 - call dword ptr [bp-4] - add sp, 0cH - - ; save mapped flat DX:AX at [bp-8] - mov word ptr [bp-8], ax - mov word ptr [bp-6], dx - - ; UnlockFlat(flat, len) - push 0 - push word ptr [bp+10] ; len - push dx - push ax - push 0 - push 3 - call dword ptr [bp-4] - add sp, 0cH - - jmp short mapflat_store - -mapflat_fail: - xor dx, dx - xor ax, ax - mov word ptr [bp-8], ax - mov word ptr [bp-6], dx - -mapflat_store: - les di, dword ptr [bp+12] - - mov bx, ax ; unlock AX - mov cx, dx ; unlock DX - pop ax ; load AX - - mov es:[di+0], ax - mov ax, word ptr [bp-4] - mov es:[di+2], ax - mov ax, word ptr [bp-2] - mov es:[di+4], ax - mov ax, word ptr [bp-8] - mov es:[di+6], ax - mov ax, word ptr [bp-6] - mov es:[di+8], ax - mov es:[di+10], bx - mov es:[di+12], cx - - pop di - pop si - pop es - pop ds - mov sp, bp - pop bp - xor ah, ah - ret -_C32_MapLock_Probe endp - - -; int C32_NCP87_Raw_Probe(UI connLo, UI connHi, -; void *hdr, UI hdrLen, -; void *path, UI pathLen, -; void *rep0, UI rep0Len, -; void *rep1, UI rep1Len, -; void *outbuf) -; -; Specialized raw Client32 NCP87/S6 request probe. -; Reproduces d32wrap.o _COMPATNcpRequestReply mechanics: -; - INT 2F AX=D8C1 -; - resolve COMPATNcpRequestReply via ESI resolver -; - MapLockFlat each fragment data buffer -; - build flat 8-byte frag tables -; - MapLockFlat frag tables and actualReplyLen -; - call ECX NIOS trampoline with command 8 and COMPATNcpRequestReply pointer -; - unlock mappings -; -; outbuf: -; +00 load AX -; +02 resolver off -; +04 resolver seg -; +06 trampoline off -; +08 trampoline seg -; +0A function off -; +0C function seg -; +0E ret AX -; +10 ret DX -; +12 actualReplyLen low -; +14 actualReplyLen high -_C32_NCP87_Raw_Probe proc far - push bp - mov bp, sp - sub sp, 100 - - push ds push es - push si - push di - ; clear ESI/ECX - db 66h, 33h, 0F6h - db 66h, 33h, 0C9h - - mov ax, 0D8C1h + mov ax, 7A20h + xor bx, bx int 2Fh - - ; save resolver ESI at [bp-84] - db 66h, 89h, 76h, 0ACh - ; save trampoline ECX at [bp-88] - db 66h, 89h, 4Eh, 0A8h - - mov [bp-2], ax ; load AX or ax, ax - jne c32raw_fail + jz nwcvlm_found - ; resolve "COMPATNcpRequestReply" - push cs - push offset c32raw_name - push 0 - push 0 - call dword ptr [bp-84] - add sp, 8 - mov [bp-92], ax - mov [bp-90], dx - or ax, dx - jne c32raw_have_func - jmp c32raw_fail + mov ax, 88FFh + jmp short nwcvlm_done -c32raw_have_func: - ; actualReplyLen local at [bp-52] - mov word ptr [bp-52], 0 - mov word ptr [bp-50], 0 +nwcvlm_found: + ; save VLM entry ES:BX in [bp-4] + mov [bp-4], bx + mov ax, es + mov [bp-2], ax - ; Map hdr data -> [bp-56] - push 0 - push word ptr [bp+0eH] - push word ptr [bp+0cH] - push word ptr [bp+0aH] - push 0 - push 2 - call dword ptr [bp-84] - add sp, 0cH - mov [bp-56], ax - mov [bp-54], dx + les bx, dword ptr [bp+8] ; regblk - ; Map path data -> [bp-60] - push 0 - push word ptr [bp+14H] - push word ptr [bp+12H] - push word ptr [bp+10H] - push 0 - push 2 - call dword ptr [bp-84] - add sp, 0cH - mov [bp-60], ax - mov [bp-58], dx + ; Match NWCVLMREQ defaulting: + ; if !(flags & 2), set regblk.ES to current ES. + ; We normally pass flags=2, so this is skipped. + test word ptr [bp+6], 2 + jne nwcvlm_skip_es + mov ax, es + mov word ptr es:[bx+6], ax +nwcvlm_skip_es: - ; Map reply0 -> [bp-64] - push 0 - push word ptr [bp+1aH] - push word ptr [bp+18H] - push word ptr [bp+16H] - push 0 - push 2 - call dword ptr [bp-84] - add sp, 0cH - mov [bp-64], ax - mov [bp-62], dx + ; if !(flags & 1), set regblk.DS to current DS. + test word ptr [bp+6], 1 + jne nwcvlm_skip_ds + mov ax, ds + mov word ptr es:[bx+2], ax +nwcvlm_skip_ds: - ; Map reply1 -> [bp-68] - push 0 - push word ptr [bp+20H] - push word ptr [bp+1eH] - push word ptr [bp+1cH] - push 0 - push 2 - call dword ptr [bp-84] - add sp, 0cH - mov [bp-68], ax - mov [bp-66], dx + ; Load target registers from regblk. + mov ax, word ptr es:[bx+0Ah] + push ax ; target BX + mov ax, word ptr es:[bx+6] + push ax ; target ES - ; Build req flat table at [bp-32], two entries: - ; entry = flatptr dword + len dword - mov ax, [bp-56] - mov [bp-32], ax - mov ax, [bp-54] - mov [bp-30], ax - mov ax, [bp+0eH] - mov [bp-28], ax - mov word ptr [bp-26], 0 + mov ax, word ptr es:[bx+8] + mov cx, word ptr es:[bx+0Ch] + mov dx, word ptr es:[bx+0Eh] + mov si, word ptr es:[bx+0] + mov di, word ptr es:[bx+4] + mov ds, word ptr es:[bx+2] - mov ax, [bp-60] - mov [bp-24], ax - mov ax, [bp-58] - mov [bp-22], ax - mov ax, [bp+14H] - mov [bp-20], ax - mov word ptr [bp-18], 0 + pop es + pop bx - ; Build reply flat table at [bp-48] - mov ax, [bp-64] - mov [bp-48], ax - mov ax, [bp-62] - mov [bp-46], ax - mov ax, [bp+1aH] - mov [bp-44], ax - mov word ptr [bp-42], 0 + push word ptr [bp+10h] ; p3 + push word ptr [bp+0eh] ; p2 + push word ptr [bp+0ch] ; p1 + call dword ptr [bp-4] - mov ax, [bp-68] - mov [bp-40], ax - mov ax, [bp-66] - mov [bp-38], ax - mov ax, [bp+20H] - mov [bp-36], ax - mov word ptr [bp-34], 0 + ; Store registers back into regblk. + push bx + push es - ; Map req table [bp-32] len 16 -> [bp-72] - push 0 - push 10H - push ss - lea ax, -32[bp] - push ax - push 0 - push 2 - call dword ptr [bp-84] - add sp, 0cH - mov [bp-72], ax - mov [bp-70], dx + les bx, dword ptr [bp+8] + mov word ptr es:[bx+8], ax + pop ax + mov word ptr es:[bx+6], ax + pop ax + mov word ptr es:[bx+0Ah], ax + mov word ptr es:[bx+0Ch], cx + mov word ptr es:[bx+0Eh], dx + mov word ptr es:[bx+0], si + mov word ptr es:[bx+4], di + mov word ptr es:[bx+2], ds - ; Map reply table [bp-48] len 16 -> [bp-76] - push 0 - push 10H - push ss - lea ax, -48[bp] - push ax - push 0 - push 2 - call dword ptr [bp-84] - add sp, 0cH - mov [bp-76], ax - mov [bp-74], dx - - ; Map actualReplyLen [bp-52] len 4 -> [bp-80] - push 0 - push 4 - push ss - lea ax, -52[bp] - push ax - push 0 - push 2 - call dword ptr [bp-84] - add sp, 0cH - mov [bp-80], ax - mov [bp-78], dx - - ; Call NIOS trampoline command 8 with COMPATNcpRequestReply pointer. - push word ptr [bp-78] ; actual flat hi - push word ptr [bp-80] ; actual flat lo - push word ptr [bp-74] ; reply table flat hi - push word ptr [bp-76] ; reply table flat lo - push 0 - push 2 ; num reply frags - push word ptr [bp-70] ; req table flat hi - push word ptr [bp-72] ; req table flat lo - push 0 - push 2 ; num req frags - push 0 - push 57H ; NCP function 87 - push 0 - push 0 - push word ptr [bp+8] ; conn high - push word ptr [bp+6] ; conn low - push 0 - push 8 - push word ptr [bp-90] ; function seg - push word ptr [bp-92] ; function off - call dword ptr [bp-88] - add sp, 28H - - mov [bp-96], ax - mov [bp-94], dx - - ; unlock mapped actual/table/data. Ignore returns. - push 0 - push 4 - push word ptr [bp-78] - push word ptr [bp-80] - push 0 - push 3 - call dword ptr [bp-84] - add sp, 0cH - - push 0 - push 10H - push word ptr [bp-74] - push word ptr [bp-76] - push 0 - push 3 - call dword ptr [bp-84] - add sp, 0cH - - push 0 - push 10H - push word ptr [bp-70] - push word ptr [bp-72] - push 0 - push 3 - call dword ptr [bp-84] - add sp, 0cH - - push 0 - push word ptr [bp+20H] - push word ptr [bp-66] - push word ptr [bp-68] - push 0 - push 3 - call dword ptr [bp-84] - add sp, 0cH - - push 0 - push word ptr [bp+1aH] - push word ptr [bp-62] - push word ptr [bp-64] - push 0 - push 3 - call dword ptr [bp-84] - add sp, 0cH - - push 0 - push word ptr [bp+14H] - push word ptr [bp-58] - push word ptr [bp-60] - push 0 - push 3 - call dword ptr [bp-84] - add sp, 0cH - - push 0 - push word ptr [bp+0eH] - push word ptr [bp-54] - push word ptr [bp-56] - push 0 - push 3 - call dword ptr [bp-84] - add sp, 0cH - - jmp short c32raw_store - -c32raw_fail: - mov word ptr [bp-92], 0 - mov word ptr [bp-90], 0 - mov word ptr [bp-96], 0FFFFH - mov word ptr [bp-94], 0FFFFH - mov word ptr [bp-52], 0 - mov word ptr [bp-50], 0 - -c32raw_store: - les di, dword ptr [bp+22H] - - mov ax, [bp-2] - mov es:[di+0], ax - mov ax, [bp-84] - mov es:[di+2], ax - mov ax, [bp-82] - mov es:[di+4], ax - mov ax, [bp-88] - mov es:[di+6], ax - mov ax, [bp-86] - mov es:[di+8], ax - mov ax, [bp-92] - mov es:[di+10], ax - mov ax, [bp-90] - mov es:[di+12], ax - mov ax, [bp-96] - mov es:[di+14], ax - mov ax, [bp-94] - mov es:[di+16], ax - mov ax, [bp-52] - mov es:[di+18], ax - mov ax, [bp-50] - mov es:[di+20], ax + mov ax, word ptr es:[bx+8] +nwcvlm_done: + pop es pop di pop si - pop es pop ds + mov sp, bp pop bp - xor ah, ah ret - -c32raw_name db 'COMPATNcpRequestReply',0 - -_C32_NCP87_Raw_Probe endp +_Net_Call_NWCVLMREQ endp end diff --git a/nwtests.c b/nwtests.c index 78600f8..40efb08 100644 --- a/nwtests.c +++ b/nwtests.c @@ -1259,150 +1259,207 @@ static int tests_c32callver2(void) } -static int tests_c32mapflat(void) +static void tests_set_reg_word(uint8 *r, int off, UI val) { - uint8 out[32]; - char sample[32]; - uint16 load_ax, esi_off, esi_seg; - uint16 map_lo, map_hi; - uint16 unl_ax, unl_dx; + tests_put_word_lh(r + off, (uint16)val); +} - strcpy(sample, "C32MAPFLAT"); - memset(out, 0, sizeof(out)); +static UI tests_get_reg_word(uint8 *r, int off) +{ + return (UI)(r[off] | ((UI)r[off + 1] << 8)); +} - fprintf(stdout, "TEST C32MAPFLAT\n"); - fprintf(stdout, "Probe d32wrap __MapLockFlat/__UnlockFlat via NIOS resolver\n"); - fprintf(stdout, "sample ptr=%04X:%04X len=%u text=%s\n", - FP_SEG(sample), FP_OFF(sample), (UI)strlen(sample) + 1, sample); +static void tests_dump_vlm_regs(char *title, uint8 *r) +{ + fprintf(stdout, "%s SI=%04X DS=%04X DI=%04X ES=%04X AX=%04X BX=%04X CX=%04X DX=%04X\n", + title, + tests_get_reg_word(r, 0), + tests_get_reg_word(r, 2), + tests_get_reg_word(r, 4), + tests_get_reg_word(r, 6), + tests_get_reg_word(r, 8), + tests_get_reg_word(r, 10), + tests_get_reg_word(r, 12), + tests_get_reg_word(r, 14)); +} - C32_MapLock_Probe(sample, (UI)strlen(sample) + 1, out); +static int tests_c32mapconn(void) +{ + int drive; + uint8 connid = 0; + uint8 dhandle = 0; + uint8 flags = 0; + uint8 regs[16]; + uint8 reply[128]; + int rc; - load_ax = tests_get_word_lh(out + 0); - esi_off = tests_get_word_lh(out + 2); - esi_seg = tests_get_word_lh(out + 4); - map_lo = tests_get_word_lh(out + 6); - map_hi = tests_get_word_lh(out + 8); - unl_ax = tests_get_word_lh(out + 10); - unl_dx = tests_get_word_lh(out + 12); + drive = tests_get_current_drive(); + if (get_drive_info((uint8)drive, &connid, &dhandle, &flags)) { + fprintf(stdout, "get_drive_info failed\n"); + return(1); + } - fprintf(stdout, "Load AX=%04X Resolver=%04X:%04X\n", - load_ax, esi_seg, esi_off); - fprintf(stdout, "MapLock returned flat=%04X:%04X\n", map_hi, map_lo); - fprintf(stdout, "Unlock returned DX:AX=%04X:%04X\n", unl_dx, unl_ax); - tests_dump_bytes("RAW:", out, 14); + memset(regs, 0, sizeof(regs)); + memset(reply, 0, sizeof(reply)); - if (load_ax == 0 && (map_lo || map_hi)) - fprintf(stdout, "\nMapLockFlat appears to work.\n"); - else - fprintf(stdout, "\nMapLockFlat did not return a flat pointer.\n"); + /* + * First half of DeveloperNet __C32MapConn16To32: + * + * reg.CX = conn16 + * reg.ES:DI = reply buffer + * NWCVLMREQ(flags=2, regblk, p1=0Dh, p2=10h, p3=0) + * + * The reply buffer should contain the connection/server reference string + * that w95mconn.o later passes to NWCSCANCONNINFO. + */ + tests_set_reg_word(regs, 4, FP_OFF(reply)); /* DI */ + tests_set_reg_word(regs, 6, FP_SEG(reply)); /* ES */ + tests_set_reg_word(regs, 12, connid); /* CX */ + fprintf(stdout, "TEST C32MAPCONN step1, __C32MapConn16To32 VLM probe\n"); + fprintf(stdout, "drive=%c: connid=%u dhandle=%u flags=%02X\n", + 'A' + drive, connid, dhandle, flags); + tests_dump_vlm_regs("REG in :", regs); + fprintf(stdout, "Call NWCVLMREQ flags=2 p1=000D p2=0010 p3=0000\n"); + + rc = Net_Call_NWCVLMREQ(2, regs, 0x000D, 0x0010, 0); + + fprintf(stdout, "NWCVLMREQ rc=%04X\n", rc); + tests_dump_vlm_regs("REG out:", regs); + tests_dump_bytes("REPLY:", reply, 64); + fprintf(stdout, "REPLY text: %s\n", reply); + + fprintf(stdout, "\nIf REPLY contains a server/conn string, next step is NWCSCANCONNINFO.\n"); return(0); } -static int tests_nwreq87c32raw_one(UI connLo, UI connHi, UI label) +static int tests_c32mapconn_value(UI conn16, UI label) { + uint8 regs[16]; + uint8 reply[128]; + int rc; + + memset(regs, 0, sizeof(regs)); + memset(reply, 0, sizeof(reply)); + + tests_set_reg_word(regs, 4, FP_OFF(reply)); /* DI */ + tests_set_reg_word(regs, 6, FP_SEG(reply)); /* ES */ + tests_set_reg_word(regs, 12, conn16); /* CX */ + + fprintf(stdout, "\nC32MAPCONN value=%u label=%u\n", conn16, label); + tests_dump_vlm_regs("REG in :", regs); + fprintf(stdout, "Call NWCVLMREQ flags=2 p1=000D p2=0010 p3=0000\n"); + + rc = Net_Call_NWCVLMREQ(2, regs, 0x000D, 0x0010, 0); + + fprintf(stdout, "NWCVLMREQ rc=%04X\n", rc); + tests_dump_vlm_regs("REG out:", regs); + tests_dump_bytes("REPLY:", reply, 64); + fprintf(stdout, "REPLY text: %s\n", reply); + + return rc; +} + +static int tests_c32mapconnone(int argc, char *argv[]) +{ + UI val; + + if (argc < 3) { + fprintf(stdout, "Usage: TESTS C32MAPCONNONE value\n"); + return(1); + } + + val = (UI)atoi(argv[2]); + return tests_c32mapconn_value(val, val); +} + +static int tests_c32mapconnmatrix(void) +{ + int drive; uint8 connid = 0; uint8 dhandle = 0; uint8 flags = 0; - int drive; - uint8 hdr[16]; - uint8 path[0x140]; - uint8 rep0[0x60]; - uint8 rep1[0x110]; - uint8 out[32]; - UI path_len; - uint16 load_ax, res_off, res_seg, tramp_off, tramp_seg, fn_off, fn_seg; - uint16 ret_ax, ret_dx, act_lo, act_hi; + UI values[12]; + int i; drive = tests_get_current_drive(); get_drive_info((uint8)drive, &connid, &dhandle, &flags); - memset(hdr, 0, sizeof(hdr)); - hdr[0] = 6; - hdr[1] = 0; - hdr[2] = 0; - tests_put_word_lh(hdr + 3, 0x0006); - tests_put_dword_lh(hdr + 5, 0x00000004UL); + values[0] = 0; + values[1] = 1; + values[2] = 2; + values[3] = 3; + values[4] = 4; + values[5] = (UI)connid; + values[6] = (UI)dhandle; + values[7] = (UI)drive; + values[8] = (UI)(drive + 1); + values[9] = 0x31; + values[10] = 0x3130; + values[11] = 0xffff; - path_len = tests_build_novell_handle_path(path, dhandle, 0, 0, 1, - "LOGIN.EXE", 0, 0); + fprintf(stdout, "TEST C32MAPCONNMATRIX paged\n"); + fprintf(stdout, "drive=%c: connid=%u dhandle=%u flags=%02X\n", + 'A' + drive, connid, dhandle, flags); + tests_wait_key(); - memset(rep0, 0, sizeof(rep0)); - memset(rep1, 0, sizeof(rep1)); - memset(out, 0, sizeof(out)); - - fprintf(stdout, "\nTEST NWREQ87C32RAW label=%u conn32=%04X:%04X\n", - label, connHi, connLo); - fprintf(stdout, "drive=%c: connid=%u dhandle=%u flags=%02X path_len=%u\n", - 'A' + drive, connid, dhandle, flags, path_len); - tests_dump_bytes("HDR :", hdr, 9); - tests_dump_bytes("PATH:", path, path_len > 48 ? 48 : path_len); - - C32_NCP87_Raw_Probe(connLo, connHi, - hdr, 9, - path, path_len, - rep0, 0x4d, - rep1, 0x100, - out); - - load_ax = tests_get_word_lh(out + 0); - res_off = tests_get_word_lh(out + 2); - res_seg = tests_get_word_lh(out + 4); - tramp_off = tests_get_word_lh(out + 6); - tramp_seg = tests_get_word_lh(out + 8); - fn_off = tests_get_word_lh(out + 10); - fn_seg = tests_get_word_lh(out + 12); - ret_ax = tests_get_word_lh(out + 14); - ret_dx = tests_get_word_lh(out + 16); - act_lo = tests_get_word_lh(out + 18); - act_hi = tests_get_word_lh(out + 20); - - fprintf(stdout, "Load AX=%04X Resolver=%04X:%04X Tramp=%04X:%04X\n", - load_ax, res_seg, res_off, tramp_seg, tramp_off); - fprintf(stdout, "Function COMPAT=%04X:%04X\n", fn_seg, fn_off); - fprintf(stdout, "Return DX:AX=%04X:%04X actual=%04X:%04X\n", - ret_dx, ret_ax, act_hi, act_lo); - tests_dump_bytes("OUT :", out, 22); - tests_dump_bytes("REP0:", rep0, 64); - tests_dump_bytes("REP1:", rep1, 64); + for (i = 0; i < 12; i++) { + tests_c32mapconn_value(values[i], (UI)i); + if (i != 11) + tests_wait_key(); + } return(0); } -static int tests_nwreq87c32raw(int argc, char *argv[]) + +static int tests_c32primref(void) { - UI lo = 0; - UI hi = 0; + uint8 regs[16]; + int rc; + UI primref; - if (argc > 2) - lo = (UI)atoi(argv[2]); - if (argc > 3) - hi = (UI)atoi(argv[3]); + memset(regs, 0, sizeof(regs)); - return tests_nwreq87c32raw_one(lo, hi, 0); -} + /* + * DeveloperNet dgtprmci.o / NWCGETPRIMCONNREF: + * + * regblk.AX = 1 + * NWCVLMREQ(flags=0, regblk, p1=4, p2=43h, p3=0) + * if rc==0: + * primaryConnRef = regblk.CX + * + * regblk layout used by NWCVLMREQ: + * +00 SI + * +02 DS + * +04 DI + * +06 ES + * +08 AX + * +0A BX + * +0C CX + * +0E DX + */ + tests_set_reg_word(regs, 8, 1); /* AX */ -static int tests_nwreq87c32matrix(void) -{ - UI vals[6]; - int i; + fprintf(stdout, "TEST C32PRIMREF / NWCGETPRIMCONNREF VLM step\n"); + tests_dump_vlm_regs("REG in :", regs); + fprintf(stdout, "Call NWCVLMREQ flags=0 p1=0004 p2=0043 p3=0000\n"); - vals[0] = 0; - vals[1] = 1; - vals[2] = 2; - vals[3] = 3; - vals[4] = 0x31; - vals[5] = 0x3130; + rc = Net_Call_NWCVLMREQ(0, regs, 0x0004, 0x0043, 0); - fprintf(stdout, "TEST NWREQ87C32MATRIX paged\n"); - tests_wait_key(); + fprintf(stdout, "NWCVLMREQ rc=%04X\n", rc); + tests_dump_vlm_regs("REG out:", regs); + + primref = tests_get_reg_word(regs, 12); /* CX */ + fprintf(stdout, "primary connection reference candidate CX=%04X decimal=%u\n", + primref, primref); + + if (rc == 0) + fprintf(stdout, "\nIf CX is non-zero, try it as connLo in NWREQ87C32RAW.\n"); + else + fprintf(stdout, "\nPrimary reference VLM call failed.\n"); - for (i = 0; i < 6; i++) { - tests_nwreq87c32raw_one(vals[i], 0, (UI)i); - if (i != 5) - tests_wait_key(); - } return(0); } @@ -1425,14 +1482,17 @@ int func_tests(int argc, char *argv[], int mode) if (tests_same_arg(argv[1], "C32CALLVER2")) return tests_c32callver2(); - if (tests_same_arg(argv[1], "C32MAPFLAT")) - return tests_c32mapflat(); + if (tests_same_arg(argv[1], "C32MAPCONN")) + return tests_c32mapconn(); - if (tests_same_arg(argv[1], "NWREQ87C32RAW")) - return tests_nwreq87c32raw(argc, argv); + if (tests_same_arg(argv[1], "C32MAPCONNONE")) + return tests_c32mapconnone(argc, argv); - if (tests_same_arg(argv[1], "NWREQ87C32MATRIX")) - return tests_nwreq87c32matrix(); + if (tests_same_arg(argv[1], "C32MAPCONNMATRIX")) + return tests_c32mapconnmatrix(); + + if (tests_same_arg(argv[1], "C32PRIMREF")) + return tests_c32primref(); if (tests_same_arg(argv[1], "NWREQ87")) return tests_nwreq87(argc, argv);