mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-22 21:34:33 +02:00
Third stage for int2f callers: split int2f.asm functions, don't let them
preserve as many registers, use pascal calling convention for the "open" (but really: multiplex) function. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@892 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
ebbd6b8336
commit
4dc4ae8be8
@ -233,7 +233,8 @@ long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode)
|
|||||||
lpCurSft = s;
|
lpCurSft = s;
|
||||||
current_filepos = s->sft_posit; /* needed for MSCDEX */
|
current_filepos = s->sft_posit; /* needed for MSCDEX */
|
||||||
dta = bp;
|
dta = bp;
|
||||||
XferCount = (mode == XFR_READ ? remote_read : remote_write)(s, n, &err);
|
XferCount = network_redirector_rw(mode == XFR_READ ? REM_READ : REM_WRITE,
|
||||||
|
s, n, &err);
|
||||||
dta = save_dta;
|
dta = save_dta;
|
||||||
return err == SUCCESS ? (long)XferCount : err;
|
return err == SUCCESS ? (long)XferCount : err;
|
||||||
}
|
}
|
||||||
@ -546,22 +547,26 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
|
|||||||
if (result & IS_NETWORK)
|
if (result & IS_NETWORK)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
unsigned cmd;
|
||||||
if ((flags & (O_TRUNC | O_CREAT)) == O_CREAT)
|
if ((flags & (O_TRUNC | O_CREAT)) == O_CREAT)
|
||||||
attrib |= 0x100;
|
attrib |= 0x100;
|
||||||
|
|
||||||
lpCurSft = sftp;
|
lpCurSft = sftp;
|
||||||
|
cmd = REM_CREATE;
|
||||||
if (!(flags & O_LEGACY))
|
if (!(flags & O_LEGACY))
|
||||||
{
|
{
|
||||||
extern UWORD ASM ext_open_mode, ASM ext_open_attrib, ASM ext_open_action;
|
extern UWORD ASM ext_open_mode, ASM ext_open_attrib, ASM ext_open_action;
|
||||||
ext_open_mode = flags & 0x70ff;
|
ext_open_mode = flags & 0x70ff;
|
||||||
ext_open_attrib = attrib & 0xff;
|
ext_open_attrib = attrib & 0xff;
|
||||||
ext_open_action = ((flags & 0x0300) >> 8) | ((flags & O_CREAT) >> 6);
|
ext_open_action = ((flags & 0x0300) >> 8) | ((flags & O_CREAT) >> 6);
|
||||||
status = remote_extopen(sftp, attrib);
|
cmd = REM_EXTOC;
|
||||||
}
|
}
|
||||||
else if (flags & O_CREAT)
|
else if (!(flags & O_CREAT))
|
||||||
status = remote_creat(sftp, attrib);
|
{
|
||||||
else
|
cmd = REM_OPEN;
|
||||||
status = remote_open(sftp, (BYTE)flags);
|
attrib = (BYTE)flags;
|
||||||
|
}
|
||||||
|
status = network_redirector_open(cmd, sftp, attrib);
|
||||||
if (status >= SUCCESS)
|
if (status >= SUCCESS)
|
||||||
{
|
{
|
||||||
if (sftp->sft_count == 0)
|
if (sftp->sft_count == 0)
|
||||||
|
197
kernel/int2f.asm
197
kernel/int2f.asm
@ -273,107 +273,64 @@ SHARE_LOCK_UNLOCK:
|
|||||||
; sumtimes return data *ptr is the push stack word
|
; sumtimes return data *ptr is the push stack word
|
||||||
;
|
;
|
||||||
|
|
||||||
global NETWORK_REDIRECTOR_FP
|
global _remote_printredir
|
||||||
NETWORK_REDIRECTOR_FP:
|
_remote_printredir:
|
||||||
push bp
|
push bp
|
||||||
mov bp, sp
|
mov bp,sp
|
||||||
mov al, [bp+8]
|
push si
|
||||||
pop bp
|
push di
|
||||||
call call_int2f
|
mov ax, 1125h
|
||||||
ret 6
|
mov dx, [bp+4]
|
||||||
|
push word [bp+6]
|
||||||
global _remote_read
|
jmp short int2f_call
|
||||||
_remote_read: mov al, 08h
|
|
||||||
jmp short call_int2f
|
|
||||||
|
|
||||||
global _remote_write
|
|
||||||
_remote_write: mov al, 09h
|
|
||||||
jmp short call_int2f
|
|
||||||
|
|
||||||
global _remote_getfree
|
|
||||||
_remote_getfree:
|
|
||||||
mov al, 0ch
|
|
||||||
jmp short call_int2f
|
|
||||||
|
|
||||||
global _remote_setfattr
|
global _remote_setfattr
|
||||||
_remote_setfattr:
|
_remote_setfattr:
|
||||||
mov al, 0eh
|
push bp
|
||||||
jmp short call_int2f
|
mov bp,sp
|
||||||
|
push si
|
||||||
global _remote_open
|
push di
|
||||||
_remote_open:
|
mov ax, 110eh
|
||||||
mov al, 16h
|
push word [bp+4]
|
||||||
jmp short call_int2f
|
jmp short int2f_call
|
||||||
|
|
||||||
global _remote_creat
|
|
||||||
_remote_creat:
|
|
||||||
mov al, 17h
|
|
||||||
jmp short call_int2f
|
|
||||||
|
|
||||||
global _remote_doredirect
|
|
||||||
_remote_doredirect:
|
|
||||||
mov al, 1eh
|
|
||||||
jmp short call_int2f
|
|
||||||
|
|
||||||
global _remote_printset
|
|
||||||
_remote_printset:
|
|
||||||
mov al, 1fh
|
|
||||||
jmp short call_int2f
|
|
||||||
|
|
||||||
global _remote_lseek
|
global _remote_lseek
|
||||||
_remote_lseek:
|
_remote_lseek:
|
||||||
mov al, 21h
|
|
||||||
jmp short call_int2f
|
|
||||||
|
|
||||||
global _QRemote_Fn
|
|
||||||
_QRemote_Fn
|
|
||||||
mov al, 23h
|
|
||||||
jmp short call_int2f
|
|
||||||
|
|
||||||
global _remote_printredir
|
|
||||||
_remote_printredir:
|
|
||||||
mov al, 25h
|
|
||||||
jmp short call_int2f
|
|
||||||
|
|
||||||
global _remote_extopen
|
|
||||||
_remote_extopen:
|
|
||||||
mov al, 2eh
|
|
||||||
|
|
||||||
call_int2f:
|
|
||||||
mov ah, 11h
|
|
||||||
push bp
|
push bp
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
push es
|
|
||||||
push si
|
push si
|
||||||
push di
|
push di
|
||||||
push cx
|
|
||||||
push bx
|
|
||||||
|
|
||||||
cmp al, 0eh
|
mov ax, 1121h ; 21h, Lseek from eof
|
||||||
je remote_setfattr
|
les di, [bp+4]
|
||||||
|
mov dx, [bp+8]
|
||||||
|
mov cx, [bp+10]
|
||||||
|
; "fall through"
|
||||||
|
|
||||||
|
remote_getfattr:
|
||||||
|
clc ; set to succeed
|
||||||
|
int 2fh
|
||||||
|
jc no_clear_ax
|
||||||
|
jmp short no_neg_ax
|
||||||
|
|
||||||
|
;int ASMPASCAL network_redirector_open(unsigned cmd, void far *s, unsigned arg)
|
||||||
|
global NETWORK_REDIRECTOR_OPEN
|
||||||
|
NETWORK_REDIRECTOR_OPEN:
|
||||||
|
pop bx ; ret address
|
||||||
|
pop cx ; stack value (arg)
|
||||||
|
pop dx ; off s
|
||||||
|
pop es ; seg s
|
||||||
|
pop ax ; cmd (ax)
|
||||||
|
push bx ; ret address
|
||||||
|
call_int2f:
|
||||||
|
push bp
|
||||||
|
push si
|
||||||
|
push di
|
||||||
|
mov di, dx ; es:di -> s
|
||||||
cmp al, 0fh
|
cmp al, 0fh
|
||||||
je remote_getfattr
|
je remote_getfattr
|
||||||
cmp al, 1eh
|
push cx ; arg
|
||||||
je print_doredir
|
|
||||||
cmp al, 1fh
|
|
||||||
je print_doredir
|
|
||||||
cmp al, 25h
|
|
||||||
je remote_printredir
|
|
||||||
|
|
||||||
les di, [bp+4]
|
|
||||||
cmp al, 08h
|
|
||||||
je remote_rw
|
|
||||||
cmp al, 09h
|
|
||||||
je remote_rw
|
|
||||||
cmp al, 0ch
|
|
||||||
je remote_getfree
|
|
||||||
cmp al, 21h ; 21h, Lseek from eof
|
|
||||||
je lseekeof
|
|
||||||
cmp al, 23h
|
|
||||||
je qremote_fn
|
|
||||||
|
|
||||||
int2f_call_push:
|
|
||||||
push word [bp+8] ; very fakey, HaHa ;)
|
|
||||||
int2f_call:
|
int2f_call:
|
||||||
xor cx, cx ; set to succeed; clear carry and CX
|
xor cx, cx ; set to succeed; clear carry and CX
|
||||||
int 2fh
|
int 2fh
|
||||||
@ -386,31 +343,26 @@ clear_ax:
|
|||||||
xchg ax, cx ; extended open -> status from CX in AX
|
xchg ax, cx ; extended open -> status from CX in AX
|
||||||
; otherwise CX was set to zero above
|
; otherwise CX was set to zero above
|
||||||
no_neg_ax:
|
no_neg_ax:
|
||||||
pop bx
|
|
||||||
pop cx
|
|
||||||
pop di
|
pop di
|
||||||
pop si
|
pop si
|
||||||
pop es
|
|
||||||
pop bp
|
pop bp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
lseekeof:
|
global _remote_doredirect
|
||||||
mov dx, [bp+8]
|
_remote_doredirect:
|
||||||
mov cx, [bp+10]
|
mov al, 1eh
|
||||||
; "fall through"
|
jmp short print_doredir
|
||||||
|
|
||||||
remote_getfattr:
|
|
||||||
clc ; set to succeed
|
|
||||||
int 2fh
|
|
||||||
jc no_clear_ax
|
|
||||||
jmp short no_neg_ax
|
|
||||||
|
|
||||||
remote_setfattr:
|
|
||||||
push word [bp+4]
|
|
||||||
jmp short int2f_call
|
|
||||||
|
|
||||||
|
global _remote_printset
|
||||||
|
_remote_printset:
|
||||||
|
mov al, 1fh
|
||||||
print_doredir:
|
print_doredir:
|
||||||
|
push bp
|
||||||
|
mov bp,sp
|
||||||
|
push si
|
||||||
|
push di
|
||||||
push ds
|
push ds
|
||||||
|
mov ah, 11h
|
||||||
mov si,[bp+14]
|
mov si,[bp+14]
|
||||||
les di,[bp+10]
|
les di,[bp+10]
|
||||||
mov dx,[bp+8]
|
mov dx,[bp+8]
|
||||||
@ -427,7 +379,14 @@ print_doredir:
|
|||||||
xor cx, cx
|
xor cx, cx
|
||||||
jmp short clear_ax
|
jmp short clear_ax
|
||||||
|
|
||||||
remote_getfree:
|
global _remote_getfree
|
||||||
|
_remote_getfree:
|
||||||
|
push bp
|
||||||
|
mov bp,sp
|
||||||
|
push si
|
||||||
|
push di
|
||||||
|
mov ax, 110ch
|
||||||
|
les di, [bp+4]
|
||||||
clc ; set to succeed
|
clc ; set to succeed
|
||||||
int 2fh
|
int 2fh
|
||||||
jc no_clear_ax
|
jc no_clear_ax
|
||||||
@ -439,15 +398,15 @@ remote_getfree:
|
|||||||
xor cx, cx
|
xor cx, cx
|
||||||
jmp short clear_ax
|
jmp short clear_ax
|
||||||
|
|
||||||
remote_printredir:
|
global _QRemote_Fn
|
||||||
mov dx, [bp+4]
|
_QRemote_Fn:
|
||||||
push word [bp+6]
|
push bp
|
||||||
jmp short int2f_call
|
mov bp,sp
|
||||||
|
push si
|
||||||
remote_rw: jmp short remote_rw1
|
push di
|
||||||
|
|
||||||
qremote_fn:
|
|
||||||
push ds
|
push ds
|
||||||
|
mov ax, 1123h
|
||||||
|
les di, [bp+4]
|
||||||
lds si,[bp+8]
|
lds si,[bp+8]
|
||||||
clc
|
clc
|
||||||
int 2fh
|
int 2fh
|
||||||
@ -457,13 +416,21 @@ qremote_fn:
|
|||||||
xor cx, cx
|
xor cx, cx
|
||||||
jmp short clear_ax
|
jmp short clear_ax
|
||||||
|
|
||||||
remote_rw1: mov cx, [bp+8]
|
global _network_redirector_rw
|
||||||
|
_network_redirector_rw:
|
||||||
|
push bp
|
||||||
|
mov bp, sp
|
||||||
|
push si
|
||||||
|
push di
|
||||||
|
mov ax, [bp+4]
|
||||||
|
les di, [bp+6]
|
||||||
|
mov cx, [bp+10]
|
||||||
clc ; set to succeed
|
clc ; set to succeed
|
||||||
int 2fh
|
int 2fh
|
||||||
jc int2f_carry
|
jc int2f_carry
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
int2f_carry: neg ax
|
int2f_carry: neg ax
|
||||||
mov di, [bp+10]
|
mov di, [bp+12]
|
||||||
mov [di], ax
|
mov [di], ax
|
||||||
mov ax, cx
|
mov ax, cx
|
||||||
jmp no_neg_ax
|
jmp no_neg_ax
|
||||||
@ -471,7 +438,7 @@ int2f_carry: neg ax
|
|||||||
global _remote_process_end
|
global _remote_process_end
|
||||||
_remote_process_end: ; Terminate process
|
_remote_process_end: ; Terminate process
|
||||||
mov ds, [_cu_psp]
|
mov ds, [_cu_psp]
|
||||||
mov al, 22h
|
mov ax, 1122h
|
||||||
call call_int2f
|
call call_int2f
|
||||||
push ss
|
push ss
|
||||||
pop ds
|
pop ds
|
||||||
|
@ -51,8 +51,12 @@ VOID set_machine_name(BYTE FAR * netname, UWORD name_num)
|
|||||||
net_set_count++;
|
net_set_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int network_redirector_fp(unsigned cmd, void far *s)
|
||||||
|
{
|
||||||
|
return network_redirector_open(cmd, s, 0);
|
||||||
|
}
|
||||||
|
|
||||||
int network_redirector(unsigned cmd)
|
int network_redirector(unsigned cmd)
|
||||||
{
|
{
|
||||||
return network_redirector_fp(cmd, NULL);
|
return network_redirector_fp(cmd, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,40 +380,20 @@ COUNT truename(const char FAR * src, char * dest, COUNT t);
|
|||||||
|
|
||||||
/* network.c */
|
/* network.c */
|
||||||
int network_redirector(unsigned cmd);
|
int network_redirector(unsigned cmd);
|
||||||
int ASMPASCAL network_redirector_fp(unsigned cmd, void far *s);
|
int network_redirector_fp(unsigned cmd, void far *s);
|
||||||
|
int ASMPASCAL network_redirector_open(unsigned cmd, void far *s, unsigned arg);
|
||||||
|
unsigned ASMCFUNC network_redirector_rw(unsigned cmd, void far *s,
|
||||||
|
unsigned n, int *err);
|
||||||
COUNT ASMCFUNC remote_doredirect(UWORD b, UCOUNT n, UWORD d, VOID FAR * s,
|
COUNT ASMCFUNC remote_doredirect(UWORD b, UCOUNT n, UWORD d, VOID FAR * s,
|
||||||
UWORD i, VOID FAR * data);
|
UWORD i, VOID FAR * data);
|
||||||
COUNT ASMCFUNC remote_printset(UWORD b, UCOUNT n, UWORD d, VOID FAR * s,
|
COUNT ASMCFUNC remote_printset(UWORD b, UCOUNT n, UWORD d, VOID FAR * s,
|
||||||
UWORD i, VOID FAR * data);
|
UWORD i, VOID FAR * data);
|
||||||
COUNT ASMCFUNC remote_process_end(VOID);
|
COUNT ASMCFUNC remote_process_end(VOID);
|
||||||
COUNT ASMCFUNC remote_getfree(VOID FAR * s, VOID * d);
|
COUNT ASMCFUNC remote_getfree(VOID FAR * s, VOID * d);
|
||||||
COUNT ASMCFUNC remote_open(sft FAR * s, COUNT mode);
|
|
||||||
int ASMCFUNC remote_extopen(sft FAR * s, unsigned attr);
|
|
||||||
LONG ASMCFUNC remote_lseek(sft FAR * s, LONG new_pos);
|
LONG ASMCFUNC remote_lseek(sft FAR * s, LONG new_pos);
|
||||||
UCOUNT ASMCFUNC remote_read(sft FAR * s, UCOUNT n, COUNT * err);
|
|
||||||
UCOUNT ASMCFUNC remote_write(sft FAR * s, UCOUNT n, COUNT * err);
|
|
||||||
COUNT ASMCFUNC remote_creat(sft FAR * s, COUNT attr);
|
|
||||||
COUNT ASMCFUNC remote_setfattr(COUNT attr);
|
COUNT ASMCFUNC remote_setfattr(COUNT attr);
|
||||||
COUNT ASMCFUNC remote_printredir(UCOUNT dx, UCOUNT ax);
|
COUNT ASMCFUNC remote_printredir(UCOUNT dx, UCOUNT ax);
|
||||||
COUNT ASMCFUNC QRemote_Fn(char FAR * d, const char FAR * s);
|
COUNT ASMCFUNC QRemote_Fn(char FAR * d, const char FAR * s);
|
||||||
#ifdef __WATCOMC__
|
|
||||||
/* bx, cx, and es not used or clobbered for all remote functions,
|
|
||||||
* except lock_unlock and process_end */
|
|
||||||
#pragma aux cdecl_axdx "_*" parm caller [] modify exact [ax dx]
|
|
||||||
#pragma aux (cdecl_axdx) remote_doredirect
|
|
||||||
#pragma aux (cdecl_axdx) remote_printset
|
|
||||||
#pragma aux (cdecl_axdx) remote_getfree
|
|
||||||
#pragma aux (cdecl_axdx) remote_open
|
|
||||||
#pragma aux (cdecl_axdx) remote_extopen
|
|
||||||
#pragma aux (cdecl_axdx) remote_lseek
|
|
||||||
#pragma aux (cdecl_axdx) remote_read
|
|
||||||
#pragma aux (cdecl_axdx) remote_write
|
|
||||||
#pragma aux (cdecl_axdx) remote_creat
|
|
||||||
#pragma aux (cdecl_axdx) remote_setfattr
|
|
||||||
#pragma aux (cdecl_axdx) remote_printredir
|
|
||||||
#pragma aux (cdecl_axdx) QRemote_Fn
|
|
||||||
#pragma aux (pascal) network_redirector_fp modify exact [ax dx]
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UWORD get_machine_name(BYTE FAR * netname);
|
UWORD get_machine_name(BYTE FAR * netname);
|
||||||
VOID set_machine_name(BYTE FAR * netname, UWORD name_num);
|
VOID set_machine_name(BYTE FAR * netname, UWORD name_num);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user