mirror of https://github.com/FDOS/kernel.git
int2f: fix call interface around int2F_12_handler( )
This changes the interface between reloc_call_int2f_handler (int2f.asm) and int2F_12_handler( ) (inthndlr.c) so that - int2F_12_handler( ) will not try to output values to its caller by passing "back" input parameter values - reloc_call_int2f_handler will switch to an internal stack before calling int2F_12_handler( ), so that SS == DGROUP as expected by the latter. This partly addresses https://github.com/FDOS/kernel/issues/11 . (The call to syscall_MUX14( ) in int2f.asm seems to have similar issues, and should probably also be updated.)
This commit is contained in:
parent
241875a742
commit
0114ab3be4
|
@ -31,6 +31,53 @@
|
|||
%include "segs.inc"
|
||||
%include "stacks.inc"
|
||||
|
||||
; macro to switch to an internal stack (if necessary), set DS == SS == DGROUP,
|
||||
; and push the old SS:SP onto the internal stack
|
||||
;
|
||||
; destroys AX, SI, BP; turns on IRQs
|
||||
;
|
||||
; int2f does not really need to switch to a separate stack for MS-DOS
|
||||
; compatibility; this is mainly to work around the C code's assumption
|
||||
; that SS == DGROUP
|
||||
;
|
||||
; TODO: remove the need for this hackery -- tkchia
|
||||
%macro SwitchToInt2fStack 0
|
||||
mov ax,[cs:_DGROUP_]
|
||||
mov ds,ax
|
||||
mov si,ss
|
||||
mov bp,sp
|
||||
cmp ax,si
|
||||
jz %%already
|
||||
cli
|
||||
mov ss,ax
|
||||
extern int2f_stk_top
|
||||
mov sp,int2f_stk_top
|
||||
sti
|
||||
%%already:
|
||||
; well, GCC does not currently clobber function parameters passed on the
|
||||
; stack; but just in case it decides to do that in the future, we push _two_
|
||||
; copies of the old SS:SP:
|
||||
; - the second copy can be passed as a pointer parameter to a C function
|
||||
; - the first copy is used to actually restore the user stack later
|
||||
push si
|
||||
push bp
|
||||
push si
|
||||
push bp
|
||||
%endmacro
|
||||
|
||||
; macro to switch back from an internal stack, i.e. undo SwitchToInt2fStack
|
||||
;
|
||||
; destroys BP; turns on IRQs -- tkchia
|
||||
%macro DoneInt2fStack 0
|
||||
pop bp
|
||||
pop bp
|
||||
pop bp
|
||||
cli
|
||||
pop ss
|
||||
mov sp,bp
|
||||
sti
|
||||
%endmacro
|
||||
|
||||
segment HMA_TEXT
|
||||
extern _cu_psp
|
||||
extern _HaltCpuWhileIdle
|
||||
|
@ -135,7 +182,7 @@ DriverSysCal:
|
|||
; internal dos calls INT2F/12xx and INT2F/4A01,4A02 - handled through C
|
||||
;**********************************************************************
|
||||
IntDosCal:
|
||||
; set up register frame
|
||||
; set up register structure
|
||||
;struct int2f12regs
|
||||
;{
|
||||
; [space for 386 regs]
|
||||
|
@ -165,9 +212,10 @@ IntDosCal:
|
|||
%endif
|
||||
%endif
|
||||
|
||||
mov ds,[cs:_DGROUP_]
|
||||
SwitchToInt2fStack
|
||||
extern _int2F_12_handler
|
||||
call _int2F_12_handler
|
||||
DoneInt2fStack
|
||||
|
||||
%if XCPU >= 386
|
||||
%ifdef WATCOM
|
||||
|
|
|
@ -1734,14 +1734,15 @@ struct int2f12regs {
|
|||
UWORD callerARG1; /* used if called from INT2F/12 */
|
||||
};
|
||||
|
||||
/* WARNING: modifications in `r' are used outside of int2F_12_handler()
|
||||
* On input r.AX==0x12xx, 0x4A01 or 0x4A02
|
||||
/* On input pr->AX==0x12xx, 0x4A01 or 0x4A02
|
||||
*/
|
||||
VOID ASMCFUNC int2F_12_handler(struct int2f12regs r)
|
||||
VOID ASMCFUNC int2F_12_handler(struct int2f12regs FAR *pr)
|
||||
{
|
||||
COUNT rc;
|
||||
long lrc;
|
||||
|
||||
#define r (*pr)
|
||||
|
||||
if (r.AH == 0x4a)
|
||||
{
|
||||
size_t size = 0, offs = 0xffff;
|
||||
|
@ -2111,6 +2112,8 @@ error_exit:
|
|||
CritErrCode = r.AX; /* Maybe set */
|
||||
error_carry:
|
||||
r.FLAGS |= FLG_CARRY;
|
||||
|
||||
#undef r
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -812,6 +812,11 @@ blk_stk_top:
|
|||
times 128 dw 0
|
||||
clk_stk_top:
|
||||
|
||||
; int2fh private stack
|
||||
global int2f_stk_top
|
||||
times 128 dw 0
|
||||
int2f_stk_top:
|
||||
|
||||
; Dynamic data:
|
||||
; member of the DOS DATA GROUP
|
||||
; and marks definitive end of all used data in kernel data segment
|
||||
|
|
Loading…
Reference in New Issue