Further int2f.asm reduction... now using generic void *arg argument to pass

the third parameter which can be various things.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@894 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-04-21 11:04:08 +00:00
parent 01e5973aa0
commit 8d1eda45f9
3 changed files with 26 additions and 120 deletions

View File

@ -233,7 +233,7 @@ long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode)
current_filepos = s->sft_posit; /* needed for MSCDEX */
dta = bp;
XferCount = network_redirector_mx(mode == XFR_READ ? REM_READ : REM_WRITE,
s, n);
s, (void *)n);
dta = save_dta;
return XferCount;
}
@ -565,7 +565,7 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
cmd = REM_OPEN;
attrib = (BYTE)flags;
}
status = (int)network_redirector_mx(cmd, sftp, attrib);
status = (int)network_redirector_mx(cmd, sftp, (void *)attrib);
if (status >= SUCCESS)
{
if (sftp->sft_count == 0)

View File

@ -284,27 +284,10 @@ _remote_printredir:
push word [bp+6]
jmp short int2f_call
global _remote_setfattr
_remote_setfattr:
push bp
mov bp,sp
push si
push di
mov ax, 110eh
push word [bp+4]
jmp short int2f_call
global _remote_lseek
_remote_lseek:
push bp
mov bp,sp
push si
push di
mov ax, 1121h ; 21h, Lseek from eof
les di, [bp+4]
mov dx, [bp+8]
mov cx, [bp+10]
remote_lseek: ; arg is a pointer to the long seek value
mov bx, cx
mov dx, [bx]
mov cx, [bx+2]
; "fall through"
remote_getfattr:
@ -313,11 +296,11 @@ remote_getfattr:
jc no_clear_ax
jmp short no_neg_ax
;long ASMPASCAL network_redirector_mx(unsigned cmd, void far *s, unsigned arg)
;long ASMPASCAL network_redirector_mx(unsigned cmd, void far *s, void *arg)
global NETWORK_REDIRECTOR_MX
NETWORK_REDIRECTOR_MX:
pop bx ; ret address
pop cx ; stack value (arg)
pop cx ; stack value (arg); cx in remote_rw
pop dx ; off s
pop es ; seg s
pop ax ; cmd (ax)
@ -334,6 +317,12 @@ call_int2f:
je remote_rw
cmp al, 09h
je remote_rw
cmp al, 0ch
je remote_getfree
cmp al, 23h
je qremote_fn
cmp al, 25h
je remote_lseek
push cx ; arg
int2f_call:
@ -384,18 +373,12 @@ print_doredir:
xor cx, cx
jmp short clear_ax
global _remote_getfree
_remote_getfree:
push bp
mov bp,sp
push si
push di
mov ax, 110ch
les di, [bp+4]
remote_getfree:
clc ; set to succeed
push cx ; pointer arg
int 2fh
pop di
jc no_clear_ax
mov di,[bp+8]
mov [di],ax
mov [di+2],bx
mov [di+4],cx
@ -414,23 +397,17 @@ int2f_carry: neg ax
cwd
jmp short no_neg_ax
global _QRemote_Fn
_QRemote_Fn:
push bp
mov bp,sp
push si
push di
qremote_fn:
push ds
mov ax, 1123h
les di, [bp+4]
lds si,[bp+8]
mov bx, cx
lds si, [bx]
clc
int 2fh
pop ds
mov ax,0xffff
jc no_neg_ax
xor cx, cx
jmp clear_ax
jmp short clear_ax
global _remote_process_end
_remote_process_end: ; Terminate process
@ -494,77 +471,6 @@ nostore:
pop bp
ret
%if 0
; int_2f_111e_call(iregs FAR *iregs)
;
; set up all registers to the int21 entry registers
; call int2f/111e
; copy returned registers into int21 entry registers back
;
; disabled: does not work better than previous implementation
global _int_2f_111e_call
_int_2f_111e_call:
push bp
mov bp,sp
push si
push di
push ds
lds si, [bp+4] ; ds:si -> iregs
mov ax, [si ]
mov bx, [si+2]
mov cx, [si+4]
mov dx, [si+6]
push word [si+8] ; si
mov di, [si+10]
mov bp, [si+12]
mov es, [si+16]
mov ds, [si+14]
pop si
push ax
mov ax, 111eh
int 2fh
jc fault
pop ax ; restore orig value of ax if no errors
push ax
fault:
pushf
push ds
push si
push bp
mov bp,sp
lds si,[bp+4+6+10] ; 4=fun, 6=si,di,ds, 10 additional bytes on stack
pop word [si+12] ; bp
pop word [si+ 8] ; si
pop word [si+14] ; ds
pop word [si+22] ; flags
add sp,2 ; pushed function value
mov [si ],ax
cmp ax, 5f02h ; 5f02 is special: it manipulates the user stack directly
je skip5f02
mov [si+2],bx
mov [si+4],cx
skip5f02:
mov [si+6],dx
mov [si+10],di
mov [si+16],es
pop ds
pop di
pop si
pop bp
ret
%endif
;
; Test to see if a umb driver has been loaded.
; if so, retrieve largest available block+size

View File

@ -381,17 +381,17 @@ COUNT truename(const char FAR * src, char * dest, COUNT t);
/* network.c */
int network_redirector(unsigned cmd);
int network_redirector_fp(unsigned cmd, void far *s);
long ASMPASCAL network_redirector_mx(unsigned cmd, void far *s, unsigned arg);
long ASMPASCAL network_redirector_mx(unsigned cmd, void far *s, void *arg);
COUNT ASMCFUNC remote_doredirect(UWORD b, UCOUNT n, UWORD d, VOID FAR * s,
UWORD i, VOID FAR * data);
COUNT ASMCFUNC remote_printset(UWORD b, UCOUNT n, UWORD d, VOID FAR * s,
UWORD i, VOID FAR * data);
COUNT ASMCFUNC remote_process_end(VOID);
COUNT ASMCFUNC remote_getfree(VOID FAR * s, VOID * d);
LONG ASMCFUNC remote_lseek(sft FAR * s, LONG new_pos);
COUNT ASMCFUNC remote_setfattr(COUNT attr);
#define remote_getfree(s,d) (int)network_redirector_mx(REM_GETSPACE, s, d)
#define remote_lseek(s,new_pos) network_redirector_mx(REM_LSEEK, s, &new_pos)
#define remote_setfattr(attr) (int)network_redirector_mx(REM_SETATTR, NULL, (void *)attr)
COUNT ASMCFUNC remote_printredir(UCOUNT dx, UCOUNT ax);
COUNT ASMCFUNC QRemote_Fn(char FAR * d, const char FAR * s);
#define QRemote_Fn(d,s) (int)network_redirector_mx(REM_FILENAME, d, &s)
UWORD get_machine_name(BYTE FAR * netname);
VOID set_machine_name(BYTE FAR * netname, UWORD name_num);