cli/sti corrections (Bart) and int25, 26 stack corrections (Tom)

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@174 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2001-03-22 20:46:46 +00:00
parent d63d1765cb
commit 729114cf00
2 changed files with 21 additions and 18 deletions

View File

@ -27,6 +27,9 @@
; $Id$ ; $Id$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/03/22 20:46:46 bartoldeman
; cli/sti corrections (Bart) and int25, 26 stack corrections (Tom)
;
; Revision 1.4 2001/03/21 02:56:25 bartoldeman ; Revision 1.4 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -85,7 +88,7 @@
segment HMA_TEXT segment HMA_TEXT
global _set_stack global _set_stack
; ;
; void far set_stack(void) - ; void set_stack(void) -
; save current stack and setup our local stack ; save current stack and setup our local stack
; ;
_set_stack: _set_stack:
@ -95,7 +98,6 @@ _set_stack:
; we need to get the return values from the stack ; we need to get the return values from the stack
; since the current stack will change ; since the current stack will change
pop ax ;get return offset pop ax ;get return offset
pop bx ;get return segment
; Save the flags so that we can restore correct interrupt ; Save the flags so that we can restore correct interrupt
; state later. We need to disable interrupts so that we ; state later. We need to disable interrupts so that we
@ -125,17 +127,16 @@ _set_stack:
add bp, cx add bp, cx
; setup for ret ; setup for ret
push bx
push ax push ax
; now restore interrupt state ; now restore interrupt state
push dx push dx
popf popf
retf ret
; ;
; void far restore_stack(void) - ; void restore_stack(void) -
; restore foreground stack, throw ours away ; restore foreground stack, throw ours away
; ;
global _restore_stack global _restore_stack
@ -144,7 +145,6 @@ _restore_stack:
; we need to get the return values from the stack ; we need to get the return values from the stack
; since the current stack will change ; since the current stack will change
pop cx ;get return offset pop cx ;get return offset
pop bx ;get return segment
; Save the flags so that we can restore correct interrupt ; Save the flags so that we can restore correct interrupt
; state later. We need to disable interrupts so that we ; state later. We need to disable interrupts so that we
@ -169,11 +169,10 @@ _restore_stack:
;mov bp,sp ;mov bp,sp
; setup for ret ; setup for ret
push bx
push cx push cx
; now restore interrupt state ; now restore interrupt state
push dx push dx
popf popf
retf ret

View File

@ -28,6 +28,9 @@
; $Id$ ; $Id$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/03/22 20:46:46 bartoldeman
; cli/sti corrections (Bart) and int25, 26 stack corrections (Tom)
;
; Revision 1.4 2001/03/21 02:56:25 bartoldeman ; Revision 1.4 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -79,7 +82,7 @@ segment HMA_TEXT
extern _int21_syscall:wrt HGROUP extern _int21_syscall:wrt HGROUP
extern _int25_handler:wrt HGROUP extern _int25_handler:wrt HGROUP
extern _int26_handler:wrt HGROUP extern _int26_handler:wrt HGROUP
extern _set_stack:wrt HMA_TEXT extern _set_stack:wrt HGROUP
extern _restore_stack:wrt HGROUP extern _restore_stack:wrt HGROUP
extern _error_tos:wrt DGROUP extern _error_tos:wrt DGROUP
extern _char_api_tos:wrt DGROUP extern _char_api_tos:wrt DGROUP
@ -260,21 +263,22 @@ int21_reentry:
cmp ah,62h cmp ah,62h
jne int21_1 jne int21_1
int21_user: push word [_user_r+2] int21_user: sti
push word [_user_r+2]
push word [_user_r] push word [_user_r]
call _int21_syscall call _int21_syscall
pop cx pop cx
pop cx pop cx
jmp int21_ret jmp int21_ret
int21_1: sti int21_1: cli
cmp byte [_ErrorMode],0 cmp byte [_ErrorMode],0
je int21_2 je int21_2
mov bp,ds mov bp,ds
mov ss,bp mov ss,bp
mov bp,_error_tos mov bp,_error_tos
mov sp,bp mov sp,bp
cli sti
push word [_user_r+2] push word [_user_r+2]
push word [_user_r] push word [_user_r]
call _int21_syscall call _int21_syscall
@ -293,7 +297,7 @@ int21_2: inc byte [_InDOS]
mov ss,bp mov ss,bp
mov bp,_char_api_tos mov bp,_char_api_tos
mov sp,bp mov sp,bp
cli sti
push word [_user_r+2] push word [_user_r+2]
push word [_user_r] push word [_user_r]
call _int21_syscall call _int21_syscall
@ -306,7 +310,7 @@ int21_3:
mov ss,bp mov ss,bp
mov bp,_disk_api_tos mov bp,_disk_api_tos
mov sp,bp mov sp,bp
cli sti
; ;
; Push the far pointer to the register frame for ; Push the far pointer to the register frame for
; int21_syscall and remainder of kernel. ; int21_syscall and remainder of kernel.
@ -395,14 +399,14 @@ reloc_call_low_int25_handler:
mov word [_api_sp], _disk_api_tos mov word [_api_sp], _disk_api_tos
mov word [_api_ss], ds mov word [_api_ss], ds
call far _set_stack call _set_stack
push word [cs:stkframe+2] push word [cs:stkframe+2]
push word [cs:stkframe] push word [cs:stkframe]
call _int25_handler call _int25_handler
add sp, byte 4 add sp, byte 4
call far _restore_stack call _restore_stack
pop es pop es
pop ds pop ds
@ -444,14 +448,14 @@ reloc_call_low_int26_handler:
mov word [_api_sp], _disk_api_tos mov word [_api_sp], _disk_api_tos
mov word [_api_ss], ds mov word [_api_ss], ds
call far _set_stack call _set_stack
push word [cs:stkframe+2] push word [cs:stkframe+2]
push word [cs:stkframe] push word [cs:stkframe]
call _int26_handler call _int26_handler
add sp, 4 add sp, 4
call far _restore_stack call _restore_stack
pop es pop es
pop ds pop ds