mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-23 05:44:41 +02:00
intr() cleanup and small optimizations.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@628 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
18fa8e0091
commit
d60b01e511
174
kernel/intr.asm
174
kernel/intr.asm
@ -21,13 +21,63 @@
|
|||||||
;
|
;
|
||||||
; You should have received a copy of the GNU General Public
|
; You should have received a copy of the GNU General Public
|
||||||
; License along with DOS-C; see the file COPYING. If not,
|
; License along with DOS-C; see the file COPYING. If not,
|
||||||
; write to the Free Software Foundation, 675 Mass Ave,
|
; write to the Free Software Foundation, Inc.,
|
||||||
; Cambridge, MA 02139, USA.
|
; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
%include "segs.inc"
|
%include "segs.inc"
|
||||||
|
|
||||||
|
%macro INTR 0
|
||||||
|
|
||||||
|
push bp ; Standard C entry
|
||||||
|
mov bp,sp
|
||||||
|
push si
|
||||||
|
push di
|
||||||
|
push ds
|
||||||
|
push es
|
||||||
|
|
||||||
|
mov ax, [bp+4] ; interrupt number
|
||||||
|
mov [cs:%%intr_1-1], al
|
||||||
|
jmp short %%intr_2 ; flush the instruction cache
|
||||||
|
%%intr_2 mov bx, [bp+6] ; regpack structure
|
||||||
|
mov ax, [bx]
|
||||||
|
mov cx, [bx+4]
|
||||||
|
mov dx, [bx+6]
|
||||||
|
mov si, [bx+8]
|
||||||
|
mov di, [bx+10]
|
||||||
|
mov bp, [bx+12]
|
||||||
|
push word [bx+14] ; ds
|
||||||
|
mov es, [bx+16]
|
||||||
|
mov bx, [bx+2]
|
||||||
|
pop ds
|
||||||
|
int 0
|
||||||
|
%%intr_1:
|
||||||
|
|
||||||
|
pushf
|
||||||
|
push ds
|
||||||
|
push bx
|
||||||
|
mov bx, sp
|
||||||
|
mov ds, [ss:bx+8]
|
||||||
|
mov bx, [ss:bx+20] ; address of REGPACK
|
||||||
|
mov [bx], ax
|
||||||
|
pop word [bx+2]
|
||||||
|
mov [bx+4], cx
|
||||||
|
mov [bx+6], dx
|
||||||
|
mov [bx+8], si
|
||||||
|
mov [bx+10], di
|
||||||
|
mov [bx+12], bp
|
||||||
|
pop word [bx+14]
|
||||||
|
mov [bx+16], es
|
||||||
|
pop word [bx+22]
|
||||||
|
|
||||||
|
pop es
|
||||||
|
pop ds
|
||||||
|
pop di
|
||||||
|
pop si
|
||||||
|
pop bp
|
||||||
|
ret
|
||||||
|
%endmacro
|
||||||
|
|
||||||
segment HMA_TEXT
|
segment HMA_TEXT
|
||||||
;
|
;
|
||||||
; void intr(nr, rp)
|
; void intr(nr, rp)
|
||||||
@ -35,60 +85,9 @@ segment HMA_TEXT
|
|||||||
; REG struct REGPACK *rp
|
; REG struct REGPACK *rp
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
global _intr
|
global _intr
|
||||||
_intr:
|
_intr:
|
||||||
push bp ; Standard C entry
|
INTR
|
||||||
mov bp,sp
|
|
||||||
push si
|
|
||||||
push di
|
|
||||||
push ds
|
|
||||||
push es
|
|
||||||
|
|
||||||
mov ax, [bp+4] ; interrupt number
|
|
||||||
mov [CS:intr?1-1], al
|
|
||||||
jmp short intr?2 ; flush the instruction cache
|
|
||||||
intr?2 mov bx, [bp+6] ; regpack structure
|
|
||||||
mov ax, [bx]
|
|
||||||
mov cx, [bx+4]
|
|
||||||
mov dx, [bx+6]
|
|
||||||
mov si, [bx+8]
|
|
||||||
mov di, [bx+10]
|
|
||||||
mov bp, [bx+12]
|
|
||||||
push Word [bx+14] ; ds
|
|
||||||
mov es, [bx+16]
|
|
||||||
mov bx, [bx+2]
|
|
||||||
pop ds
|
|
||||||
|
|
||||||
int 0
|
|
||||||
intr?1:
|
|
||||||
|
|
||||||
pushf
|
|
||||||
push ds
|
|
||||||
push bx
|
|
||||||
mov bx, sp
|
|
||||||
mov ds, [SS:bx+8]
|
|
||||||
mov bx, [ss:bx+20] ; address of REGPACK
|
|
||||||
mov [bx], ax
|
|
||||||
pop ax
|
|
||||||
mov [bx+2], ax
|
|
||||||
mov [bx+4], cx
|
|
||||||
mov [bx+6], dx
|
|
||||||
mov [bx+8], si
|
|
||||||
mov [bx+10], di
|
|
||||||
mov [bx+12], bp
|
|
||||||
pop ax
|
|
||||||
mov [bx+14], ax
|
|
||||||
mov [bx+16], es
|
|
||||||
pop ax
|
|
||||||
mov [bx+22], ax
|
|
||||||
|
|
||||||
pop es
|
|
||||||
pop ds
|
|
||||||
pop di
|
|
||||||
pop si
|
|
||||||
pop bp
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
segment INIT_TEXT
|
segment INIT_TEXT
|
||||||
;
|
;
|
||||||
@ -97,60 +96,9 @@ segment INIT_TEXT
|
|||||||
; REG struct REGPACK *rp
|
; REG struct REGPACK *rp
|
||||||
;
|
;
|
||||||
; same stuff as above, but in INIT_SEGMENT
|
; same stuff as above, but in INIT_SEGMENT
|
||||||
global _init_call_intr
|
global _init_call_intr
|
||||||
_init_call_intr:
|
_init_call_intr:
|
||||||
push bp ; Standard C entry
|
INTR
|
||||||
mov bp,sp
|
|
||||||
push si
|
|
||||||
push di
|
|
||||||
push ds
|
|
||||||
push es
|
|
||||||
|
|
||||||
mov ax, [bp+4] ; interrupt number
|
|
||||||
mov [CS:init_intr?1-1], al
|
|
||||||
jmp short init_intr?2 ; flush the instruction cache
|
|
||||||
init_intr?2 mov bx, [bp+6] ; regpack structure
|
|
||||||
mov ax, [bx]
|
|
||||||
mov cx, [bx+4]
|
|
||||||
mov dx, [bx+6]
|
|
||||||
mov si, [bx+8]
|
|
||||||
mov di, [bx+10]
|
|
||||||
mov bp, [bx+12]
|
|
||||||
push Word [bx+14] ; ds
|
|
||||||
mov es, [bx+16]
|
|
||||||
mov bx, [bx+2]
|
|
||||||
pop ds
|
|
||||||
|
|
||||||
int 0
|
|
||||||
init_intr?1:
|
|
||||||
|
|
||||||
pushf
|
|
||||||
push ds
|
|
||||||
push bx
|
|
||||||
mov bx, sp
|
|
||||||
mov ds, [SS:bx+8]
|
|
||||||
mov bx, [ss:bx+20] ; address of REGPACK
|
|
||||||
mov [bx], ax
|
|
||||||
pop ax
|
|
||||||
mov [bx+2], ax
|
|
||||||
mov [bx+4], cx
|
|
||||||
mov [bx+6], dx
|
|
||||||
mov [bx+8], si
|
|
||||||
mov [bx+10], di
|
|
||||||
mov [bx+12], bp
|
|
||||||
pop ax
|
|
||||||
mov [bx+14], ax
|
|
||||||
mov [bx+16], es
|
|
||||||
pop ax
|
|
||||||
mov [bx+22], ax
|
|
||||||
|
|
||||||
pop es
|
|
||||||
pop ds
|
|
||||||
pop di
|
|
||||||
pop si
|
|
||||||
pop bp
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX)
|
; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX)
|
||||||
@ -282,13 +230,14 @@ _init_DosExec:
|
|||||||
int 21h
|
int 21h
|
||||||
jc short exec_no_error
|
jc short exec_no_error
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
exec_no_error
|
exec_no_error:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;; int init_setdrive(int drive)
|
;; int init_setdrive(int drive)
|
||||||
global _init_setdrive
|
global _init_setdrive
|
||||||
_init_setdrive:
|
_init_setdrive:
|
||||||
mov ah, 0x0e
|
mov ah, 0x0e
|
||||||
|
common_dl_int21:
|
||||||
mov bx, sp
|
mov bx, sp
|
||||||
mov dl, [bx+2]
|
mov dl, [bx+2]
|
||||||
int 21h
|
int 21h
|
||||||
@ -298,10 +247,7 @@ _init_setdrive:
|
|||||||
global _init_switchar
|
global _init_switchar
|
||||||
_init_switchar:
|
_init_switchar:
|
||||||
mov ax, 0x3701
|
mov ax, 0x3701
|
||||||
mov bx, sp
|
jmp short common_dl_int21
|
||||||
mov dl, [bx+2]
|
|
||||||
int 21h
|
|
||||||
ret
|
|
||||||
|
|
||||||
;; int allocmem(UWORD size, seg *segp)
|
;; int allocmem(UWORD size, seg *segp)
|
||||||
global _allocmem
|
global _allocmem
|
||||||
|
Loading…
x
Reference in New Issue
Block a user