tests
This commit is contained in:
6
kern.h
6
kern.h
@@ -26,6 +26,12 @@ extern int KERN_CALL C32_ScanRefsIter_Probe(UI iterLo, UI iterHi, void *outbuf
|
||||
extern int KERN_CALL C32_ScanRefs2_Probe(void *outbuf);
|
||||
extern int KERN_CALL C32_ScanFirst_Probe(void *outbuf);
|
||||
extern int KERN_CALL C32_OpenRef_Probe(UI refLo, UI refHi, void *outbuf);
|
||||
extern int KERN_CALL C32_NCP87_Raw5_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 C32_NCP87_Raw_Probe(UI connLo, UI connHi,
|
||||
void *hdr, UI hdrLen,
|
||||
void *path, UI pathLen,
|
||||
|
||||
291
kern_wasm.asm
291
kern_wasm.asm
@@ -25,6 +25,7 @@ public _C32_GetFunc_Probe
|
||||
public _C32_CallVersion_Nios_Probe
|
||||
public _C32_MapLock_Probe
|
||||
public _C32_NCP87_Raw_Probe
|
||||
public _C32_NCP87_Raw5_Probe
|
||||
public _C32_OpenRef_Probe
|
||||
public _C32_ScanFirst_Probe
|
||||
public _C32_ScanRefs2_Probe
|
||||
@@ -2872,4 +2873,294 @@ _C32_MapVar_Probe endp
|
||||
|
||||
|
||||
|
||||
; int C32_NCP87_Raw5_Probe(UI connLo, UI connHi,
|
||||
; void *hdr, UI hdrLen,
|
||||
; void *path, UI pathLen,
|
||||
; void *rep0, UI rep0Len,
|
||||
; void *rep1, UI rep1Len,
|
||||
; void *outbuf)
|
||||
;
|
||||
; Same as C32_NCP87_Raw_Probe but uses d32wrap-compatible 5-slot
|
||||
; fragment tables: 5 * 8 = 0x28 bytes for request and reply.
|
||||
_C32_NCP87_Raw5_Probe proc far
|
||||
push bp
|
||||
mov bp, sp
|
||||
sub sp, 180
|
||||
|
||||
push ds
|
||||
push es
|
||||
push si
|
||||
push di
|
||||
|
||||
; clear ESI/ECX
|
||||
db 66h, 33h, 0F6h
|
||||
db 66h, 33h, 0C9h
|
||||
|
||||
mov ax, 0D8C1h
|
||||
int 2Fh
|
||||
|
||||
mov [bp-2], ax
|
||||
db 66h, 89h, 76h, 0FAh ; resolver at [bp-6]
|
||||
db 66h, 89h, 4Eh, 0F6h ; trampoline at [bp-10]
|
||||
|
||||
or ax, ax
|
||||
jne raw5_fail
|
||||
|
||||
; resolve COMPATNcpRequestReply
|
||||
push cs
|
||||
push offset raw5_name
|
||||
push 0
|
||||
push 0
|
||||
call dword ptr [bp-6]
|
||||
add sp, 8
|
||||
mov [bp-14], ax
|
||||
mov [bp-12], dx
|
||||
or ax, dx
|
||||
jne raw5_have_func
|
||||
jmp raw5_fail
|
||||
|
||||
raw5_have_func:
|
||||
; actual reply len dword at [bp-36]
|
||||
mov word ptr [bp-36], 0
|
||||
mov word ptr [bp-34], 0
|
||||
|
||||
; map hdr -> [bp-20]
|
||||
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-6]
|
||||
add sp, 0cH
|
||||
mov [bp-20], ax
|
||||
mov [bp-18], dx
|
||||
|
||||
; map path -> [bp-24]
|
||||
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-6]
|
||||
add sp, 0cH
|
||||
mov [bp-24], ax
|
||||
mov [bp-22], dx
|
||||
|
||||
; map rep0 -> [bp-28]
|
||||
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-6]
|
||||
add sp, 0cH
|
||||
mov [bp-28], ax
|
||||
mov [bp-26], dx
|
||||
|
||||
; map rep1 -> [bp-32]
|
||||
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-6]
|
||||
add sp, 0cH
|
||||
mov [bp-32], ax
|
||||
mov [bp-30], dx
|
||||
|
||||
; zero req table [bp-160] len 40 and reply table [bp-120] len 40
|
||||
push ss
|
||||
pop es
|
||||
cld
|
||||
xor ax, ax
|
||||
lea di, -160[bp]
|
||||
mov cx, 20
|
||||
rep stosw
|
||||
lea di, -120[bp]
|
||||
mov cx, 20
|
||||
rep stosw
|
||||
|
||||
; req entry0 = hdr
|
||||
mov ax, [bp-20]
|
||||
mov [bp-160], ax
|
||||
mov ax, [bp-18]
|
||||
mov [bp-158], ax
|
||||
mov ax, [bp+0eH]
|
||||
mov [bp-156], ax
|
||||
mov word ptr [bp-154], 0
|
||||
|
||||
; req entry1 = path
|
||||
mov ax, [bp-24]
|
||||
mov [bp-152], ax
|
||||
mov ax, [bp-22]
|
||||
mov [bp-150], ax
|
||||
mov ax, [bp+14H]
|
||||
mov [bp-148], ax
|
||||
mov word ptr [bp-146], 0
|
||||
|
||||
; reply entry0 = rep0
|
||||
mov ax, [bp-28]
|
||||
mov [bp-120], ax
|
||||
mov ax, [bp-26]
|
||||
mov [bp-118], ax
|
||||
mov ax, [bp+1aH]
|
||||
mov [bp-116], ax
|
||||
mov word ptr [bp-114], 0
|
||||
|
||||
; reply entry1 = rep1
|
||||
mov ax, [bp-32]
|
||||
mov [bp-112], ax
|
||||
mov ax, [bp-30]
|
||||
mov [bp-110], ax
|
||||
mov ax, [bp+20H]
|
||||
mov [bp-108], ax
|
||||
mov word ptr [bp-106], 0
|
||||
|
||||
; map req table 0x28 -> [bp-40]
|
||||
push 0
|
||||
push 28H
|
||||
push ss
|
||||
lea ax, -160[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
mov [bp-40], ax
|
||||
mov [bp-38], dx
|
||||
|
||||
; map reply table 0x28 -> [bp-44]
|
||||
push 0
|
||||
push 28H
|
||||
push ss
|
||||
lea ax, -120[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
mov [bp-44], ax
|
||||
mov [bp-42], dx
|
||||
|
||||
; map actual reply len -> [bp-48]
|
||||
push 0
|
||||
push 4
|
||||
push ss
|
||||
lea ax, -36[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
mov [bp-48], ax
|
||||
mov [bp-46], dx
|
||||
|
||||
; call COMPAT via NIOS command 8
|
||||
push word ptr [bp-46]
|
||||
push word ptr [bp-48]
|
||||
push word ptr [bp-42]
|
||||
push word ptr [bp-44]
|
||||
push 0
|
||||
push 2
|
||||
push word ptr [bp-38]
|
||||
push word ptr [bp-40]
|
||||
push 0
|
||||
push 2
|
||||
push 0
|
||||
push 57H
|
||||
push 0
|
||||
push 0
|
||||
push word ptr [bp+8]
|
||||
push word ptr [bp+6]
|
||||
push 0
|
||||
push 8
|
||||
push word ptr [bp-12]
|
||||
push word ptr [bp-14]
|
||||
call dword ptr [bp-10]
|
||||
add sp, 28H
|
||||
|
||||
mov [bp-52], ax
|
||||
mov [bp-50], dx
|
||||
|
||||
; unlock important mappings only; ignore return
|
||||
push 0
|
||||
push 4
|
||||
push word ptr [bp-46]
|
||||
push word ptr [bp-48]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
|
||||
push 0
|
||||
push 28H
|
||||
push word ptr [bp-42]
|
||||
push word ptr [bp-44]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
|
||||
push 0
|
||||
push 28H
|
||||
push word ptr [bp-38]
|
||||
push word ptr [bp-40]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
|
||||
jmp short raw5_store
|
||||
|
||||
raw5_fail:
|
||||
mov word ptr [bp-14], 0
|
||||
mov word ptr [bp-12], 0
|
||||
mov word ptr [bp-52], 0ffffH
|
||||
mov word ptr [bp-50], 0ffffH
|
||||
mov word ptr [bp-36], 0
|
||||
mov word ptr [bp-34], 0
|
||||
|
||||
raw5_store:
|
||||
les di, dword ptr [bp+22H]
|
||||
mov ax, [bp-2]
|
||||
mov es:[di+0], ax
|
||||
mov ax, [bp-6]
|
||||
mov es:[di+2], ax
|
||||
mov ax, [bp-4]
|
||||
mov es:[di+4], ax
|
||||
mov ax, [bp-10]
|
||||
mov es:[di+6], ax
|
||||
mov ax, [bp-8]
|
||||
mov es:[di+8], ax
|
||||
mov ax, [bp-14]
|
||||
mov es:[di+10], ax
|
||||
mov ax, [bp-12]
|
||||
mov es:[di+12], ax
|
||||
mov ax, [bp-52]
|
||||
mov es:[di+14], ax
|
||||
mov ax, [bp-50]
|
||||
mov es:[di+16], ax
|
||||
mov ax, [bp-36]
|
||||
mov es:[di+18], ax
|
||||
mov ax, [bp-34]
|
||||
mov es:[di+20], ax
|
||||
|
||||
pop di
|
||||
pop si
|
||||
pop es
|
||||
pop ds
|
||||
mov sp, bp
|
||||
pop bp
|
||||
xor ah, ah
|
||||
ret
|
||||
|
||||
raw5_name db 'COMPATNcpRequestReply',0
|
||||
|
||||
_C32_NCP87_Raw5_Probe endp
|
||||
|
||||
|
||||
end
|
||||
|
||||
68
nwtests.c
68
nwtests.c
@@ -1867,6 +1867,71 @@ static int tests_c32mapvarmatrix(void)
|
||||
}
|
||||
|
||||
|
||||
static int tests_nwreq87c32raw5(int argc, char *argv[])
|
||||
{
|
||||
UI lo = 0;
|
||||
UI hi = 0;
|
||||
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 ret_ax, ret_dx, act_lo, act_hi;
|
||||
|
||||
if (argc > 2)
|
||||
lo = (UI)atoi(argv[2]);
|
||||
if (argc > 3)
|
||||
hi = (UI)atoi(argv[3]);
|
||||
|
||||
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);
|
||||
|
||||
path_len = tests_build_novell_handle_path(path, dhandle, 0, 0, 1,
|
||||
"LOGIN.EXE", 0, 0);
|
||||
|
||||
memset(rep0, 0, sizeof(rep0));
|
||||
memset(rep1, 0, sizeof(rep1));
|
||||
memset(out, 0, sizeof(out));
|
||||
|
||||
fprintf(stdout, "TEST NWREQ87C32RAW5 conn32=%04X:%04X\n", hi, lo);
|
||||
fprintf(stdout, "d32wrap-compatible 5-slot/0x28 frag tables\n");
|
||||
fprintf(stdout, "drive=%c: connid=%u dhandle=%u flags=%02X path_len=%u\n",
|
||||
'A' + drive, connid, dhandle, flags, path_len);
|
||||
|
||||
C32_NCP87_Raw5_Probe(lo, hi,
|
||||
hdr, 9,
|
||||
path, path_len,
|
||||
rep0, 0x4d,
|
||||
rep1, 0x100,
|
||||
out);
|
||||
|
||||
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, "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);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int func_tests(int argc, char *argv[], int mode)
|
||||
{
|
||||
if (argc >= 2) {
|
||||
@@ -1891,6 +1956,9 @@ int func_tests(int argc, char *argv[], int mode)
|
||||
if (tests_same_arg(argv[1], "NWREQ87C32RAW"))
|
||||
return tests_nwreq87c32raw(argc, argv);
|
||||
|
||||
if (tests_same_arg(argv[1], "NWREQ87C32RAW5"))
|
||||
return tests_nwreq87c32raw5(argc, argv);
|
||||
|
||||
if (tests_same_arg(argv[1], "C32PRIMREF"))
|
||||
return tests_c32primref();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user