tests
This commit is contained in:
1
kern.h
1
kern.h
@@ -14,6 +14,7 @@ extern void esr_routine(ECB *ecb);
|
||||
extern void KERN_CALL xmemmove(void *ziel, void *quelle, UI anz);
|
||||
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 Net_Call_VLM_Raw(UI ax, UI bx, UI cx, UI dx,
|
||||
void *req, void *repl,
|
||||
UI p1, UI p2, UI p3);
|
||||
|
||||
@@ -21,7 +21,7 @@ public _IPXlisten
|
||||
public _xmemmove
|
||||
public _Net_Call
|
||||
public _C32_LoadNios_Probe
|
||||
public _C32_Call_ESI_Probe
|
||||
public _C32_GetFunc_Probe
|
||||
public _Net_Call_VLM_Raw
|
||||
|
||||
_IPXinit proc far
|
||||
@@ -372,4 +372,98 @@ _C32_LoadNios_Probe proc far
|
||||
_C32_LoadNios_Probe endp
|
||||
|
||||
|
||||
; int C32_GetFunc_Probe(char *name, void *outbuf)
|
||||
;
|
||||
; 16-bit OMF Client32 function resolver probe.
|
||||
; This mimics C32BEGINUSE for one function name:
|
||||
; INT 2F AX=D8C1
|
||||
; save ESI as far pointer to __Nios+8 function resolver
|
||||
; push name segment
|
||||
; push name offset
|
||||
; push 0
|
||||
; push 0
|
||||
; call far [ESI]
|
||||
; add sp,8
|
||||
;
|
||||
; outbuf:
|
||||
; +00 word load AX from INT2F
|
||||
; +02 dword ESI from INT2F
|
||||
; +06 dword ECX from INT2F
|
||||
; +0A word resolver return AX
|
||||
; +0C word resolver return DX
|
||||
; +0E word BX
|
||||
; +10 word CX
|
||||
_C32_GetFunc_Probe proc far
|
||||
push bp
|
||||
mov bp, sp
|
||||
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 dword to [bp-4]
|
||||
db 66h, 89h, 76h, 0FCh
|
||||
|
||||
push ax ; save load AX
|
||||
|
||||
; call resolver only if AX == 0
|
||||
or ax, ax
|
||||
jne c32get_store_fail
|
||||
|
||||
push word ptr [bp+8] ; name segment
|
||||
push word ptr [bp+6] ; name offset
|
||||
push 0
|
||||
push 0
|
||||
call dword ptr [bp-4]
|
||||
add sp, 8
|
||||
|
||||
jmp short c32get_store
|
||||
|
||||
c32get_store_fail:
|
||||
xor dx, dx
|
||||
xor ax, ax
|
||||
|
||||
c32get_store:
|
||||
push dx
|
||||
push ax
|
||||
|
||||
les di, dword ptr [bp+10]
|
||||
|
||||
pop ax ; resolver AX
|
||||
pop dx ; resolver DX
|
||||
pop bx ; load AX saved in BX temporarily
|
||||
|
||||
mov es:[di+0], bx
|
||||
|
||||
; Store ESI dword at out+2: ES override + operand prefix
|
||||
db 26h, 66h, 89h, 75h, 02h
|
||||
|
||||
; Store ECX dword at out+6
|
||||
db 26h, 66h, 89h, 4Dh, 06h
|
||||
|
||||
mov es:[di+10], ax
|
||||
mov es:[di+12], dx
|
||||
mov es:[di+14], bx
|
||||
mov es:[di+16], cx
|
||||
|
||||
pop di
|
||||
pop si
|
||||
pop es
|
||||
pop ds
|
||||
mov sp, bp
|
||||
pop bp
|
||||
xor ah, ah
|
||||
ret
|
||||
_C32_GetFunc_Probe endp
|
||||
|
||||
|
||||
end
|
||||
|
||||
51
nwtests.c
51
nwtests.c
@@ -1182,39 +1182,38 @@ static int tests_c32type(void)
|
||||
}
|
||||
|
||||
|
||||
static int tests_c32values(void)
|
||||
static void tests_c32get_one(char *name)
|
||||
{
|
||||
uint8 out[32];
|
||||
uint16 ax, bx, cx, dx, si, dsreg, esreg;
|
||||
uint16 load_ax;
|
||||
uint32 esi, ecx;
|
||||
uint16 ret_ax, ret_dx;
|
||||
|
||||
memset(out, 0, sizeof(out));
|
||||
C32_LoadNios_Probe(0xD8C1, out);
|
||||
C32_GetFunc_Probe(name, out);
|
||||
|
||||
ax = tests_get_word_lh(out + 0);
|
||||
esi = tests_get_dword_lh2(out + 2);
|
||||
ecx = tests_get_dword_lh2(out + 6);
|
||||
bx = tests_get_word_lh(out + 10);
|
||||
cx = tests_get_word_lh(out + 12);
|
||||
dx = tests_get_word_lh(out + 14);
|
||||
si = tests_get_word_lh(out + 16);
|
||||
dsreg = tests_get_word_lh(out + 18);
|
||||
esreg = tests_get_word_lh(out + 20);
|
||||
load_ax = tests_get_word_lh(out + 0);
|
||||
esi = tests_get_dword_lh2(out + 2);
|
||||
ecx = tests_get_dword_lh2(out + 6);
|
||||
ret_ax = tests_get_word_lh(out + 10);
|
||||
ret_dx = tests_get_word_lh(out + 12);
|
||||
|
||||
fprintf(stdout, "TEST C32VALUES\n");
|
||||
fprintf(stdout, "AX=%04X ESI=%08lX ECX=%08lX\n", ax, esi, ecx);
|
||||
fprintf(stdout, "BX=%04X CX=%04X DX=%04X SI=%04X DS=%04X ES=%04X\n",
|
||||
bx, cx, dx, si, dsreg, esreg);
|
||||
fprintf(stdout, "\nFUNC %s\n", name);
|
||||
fprintf(stdout, "Load AX=%04X ESI=%08lX ECX=%08lX\n", load_ax, esi, ecx);
|
||||
fprintf(stdout, "Resolver returned DX:AX=%04X:%04X\n", ret_dx, ret_ax);
|
||||
tests_dump_bytes("RAW:", out, 18);
|
||||
}
|
||||
|
||||
fprintf(stdout, "\nPointer interpretation:\n");
|
||||
fprintf(stdout, "ESI as seg:off = %04lX:%04lX\n",
|
||||
(esi >> 16) & 0xffff, esi & 0xffff);
|
||||
fprintf(stdout, "ECX as seg:off = %04lX:%04lX\n",
|
||||
(ecx >> 16) & 0xffff, ecx & 0xffff);
|
||||
fprintf(stdout, "16-bit regs suggest entry offsets: SI=%04X DX=%04X CX=%04X\n",
|
||||
si, dx, cx);
|
||||
static int tests_c32getfunc(void)
|
||||
{
|
||||
fprintf(stdout, "TEST C32GETFUNC\n");
|
||||
fprintf(stdout, "Resolve Client32 function addresses via NIOS resolver\n");
|
||||
|
||||
tests_c32get_one("CLIENT32GetVersion");
|
||||
tests_c32get_one("COMPATNcpRequestReply");
|
||||
tests_c32get_one("CONNOpenByReference");
|
||||
tests_c32get_one("CONNClose");
|
||||
|
||||
fprintf(stdout, "\nNext build will call C32BEGINUSE using these pointers.\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1231,8 +1230,8 @@ int func_tests(int argc, char *argv[], int mode)
|
||||
if (tests_same_arg(argv[1], "C32TYPE"))
|
||||
return tests_c32type();
|
||||
|
||||
if (tests_same_arg(argv[1], "C32VALUES"))
|
||||
return tests_c32values();
|
||||
if (tests_same_arg(argv[1], "C32GETFUNC"))
|
||||
return tests_c32getfunc();
|
||||
|
||||
if (tests_same_arg(argv[1], "NWREQ87"))
|
||||
return tests_nwreq87(argc, argv);
|
||||
|
||||
Reference in New Issue
Block a user