mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-26 07:15:03 +02:00
correct INTR macro (fix oops, LFN skeleton wasn't meant to be pushed yet)
This commit is contained in:
parent
e2832a5563
commit
c4d6f885f4
@ -28,7 +28,7 @@
|
|||||||
%include "segs.inc"
|
%include "segs.inc"
|
||||||
%include "stacks.inc"
|
%include "stacks.inc"
|
||||||
|
|
||||||
%macro INTR 0
|
%macro INTR 1
|
||||||
|
|
||||||
push bp ; Standard C entry
|
push bp ; Standard C entry
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
@ -41,12 +41,18 @@
|
|||||||
push es
|
push es
|
||||||
%endif
|
%endif
|
||||||
push ds
|
push ds
|
||||||
|
pushf
|
||||||
|
|
||||||
arg nr, rp
|
arg nr, {rp,%1}
|
||||||
mov ax, [.nr] ; interrupt number
|
mov ax, [.nr] ; interrupt number
|
||||||
mov [cs:%%intr_1-1], al
|
mov [cs:%%intr_1-1], al
|
||||||
jmp short %%intr_2 ; flush the instruction cache
|
jmp short %%intr_2 ; flush the instruction cache
|
||||||
%%intr_2 mov bx, [.rp] ; regpack structure
|
%%intr_2
|
||||||
|
%if %1 == 4
|
||||||
|
lds bx, [.rp] ; regpack structure FAR
|
||||||
|
%else
|
||||||
|
mov bx, [.rp] ; regpack structure
|
||||||
|
%endif
|
||||||
mov ax, [bx]
|
mov ax, [bx]
|
||||||
mov cx, [bx+4]
|
mov cx, [bx+4]
|
||||||
mov dx, [bx+6]
|
mov dx, [bx+6]
|
||||||
@ -55,6 +61,8 @@ arg nr, rp
|
|||||||
mov bp, [bx+12]
|
mov bp, [bx+12]
|
||||||
push word [bx+14] ; ds
|
push word [bx+14] ; ds
|
||||||
mov es, [bx+16]
|
mov es, [bx+16]
|
||||||
|
push word [bx+22] ; flags
|
||||||
|
popf
|
||||||
mov bx, [bx+2]
|
mov bx, [bx+2]
|
||||||
pop ds
|
pop ds
|
||||||
int 0
|
int 0
|
||||||
@ -64,23 +72,33 @@ arg nr, rp
|
|||||||
push ds
|
push ds
|
||||||
push bx
|
push bx
|
||||||
mov bx, sp
|
mov bx, sp
|
||||||
mov ds, [ss:bx+6]
|
%if %1 == 4
|
||||||
%ifdef WATCOM
|
%ifdef WATCOM
|
||||||
mov bx, [ss:bx+24] ; address of REGPACK
|
lds bx, [ss:bx+(14+8)+4] ; FAR address of REGPACK, pascal convention
|
||||||
%else
|
%else
|
||||||
mov bx, [ss:bx+12+.rp-bp] ; address of REGPACK
|
lds bx, [ss:bx+14+.rp-bp] ; FAR address of REGPACK, SP=BX + skip saved registers (14) +
|
||||||
|
%endif
|
||||||
|
%else
|
||||||
|
mov ds, [ss:bx+8]
|
||||||
|
%ifdef WATCOM
|
||||||
|
mov bx, [ss:bx+26] ; NEAR address of REGPACK, pascal convention
|
||||||
|
%else
|
||||||
|
mov bx, [ss:bx+14+.rp-bp] ; NEAR address of REGPACK
|
||||||
|
%endif
|
||||||
%endif
|
%endif
|
||||||
mov [bx], ax
|
mov [bx], ax
|
||||||
pop word [bx+2]
|
pop word [bx+2] ; bx
|
||||||
mov [bx+4], cx
|
mov [bx+4], cx
|
||||||
mov [bx+6], dx
|
mov [bx+6], dx
|
||||||
mov [bx+8], si
|
mov [bx+8], si
|
||||||
mov [bx+10], di
|
mov [bx+10], di
|
||||||
mov [bx+12], bp
|
mov [bx+12], bp
|
||||||
pop word [bx+14]
|
pop word [bx+14] ; ds
|
||||||
mov [bx+16], es
|
mov [bx+16], es
|
||||||
pop word [bx+22]
|
pop word [bx+22] ; flags
|
||||||
|
|
||||||
|
; restore all registers to values from INTR entry
|
||||||
|
popf
|
||||||
pop ds
|
pop ds
|
||||||
%ifdef WATCOM
|
%ifdef WATCOM
|
||||||
pop es
|
pop es
|
||||||
@ -91,19 +109,17 @@ arg nr, rp
|
|||||||
pop di
|
pop di
|
||||||
pop si
|
pop si
|
||||||
pop bp
|
pop bp
|
||||||
ret 4
|
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
segment HMA_TEXT
|
segment HMA_TEXT
|
||||||
|
|
||||||
;
|
;
|
||||||
; void call_intr(nr, rp)
|
; void ASMPASCAL call_intr(WORD nr, struct REGPACK FAR *rp)
|
||||||
; REG int nr
|
|
||||||
; REG struct REGPACK *rp
|
|
||||||
;
|
;
|
||||||
global CALL_INTR
|
global CALL_INTR
|
||||||
CALL_INTR:
|
CALL_INTR:
|
||||||
INTR
|
INTR 4 ; rp is far, DWORD argument
|
||||||
|
ret 6
|
||||||
|
|
||||||
;; COUNT ASMPASCAL res_DosExec(COUNT mode, exec_blk * ep, BYTE * lp)
|
;; COUNT ASMPASCAL res_DosExec(COUNT mode, exec_blk * ep, BYTE * lp)
|
||||||
global RES_DOSEXEC
|
global RES_DOSEXEC
|
||||||
@ -141,7 +157,8 @@ segment INIT_TEXT
|
|||||||
;
|
;
|
||||||
global INIT_CALL_INTR
|
global INIT_CALL_INTR
|
||||||
INIT_CALL_INTR:
|
INIT_CALL_INTR:
|
||||||
INTR
|
INTR 2 ; rp is near, WORD argument
|
||||||
|
ret 4
|
||||||
|
|
||||||
;
|
;
|
||||||
; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX)
|
; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX)
|
||||||
|
@ -89,6 +89,7 @@ SECTIONS
|
|||||||
.text 0 : AT (ALIGN(LOADADDR(.data) + SIZEOF(.data), 16)) {
|
.text 0 : AT (ALIGN(LOADADDR(.data) + SIZEOF(.data), 16)) {
|
||||||
*(HMA_TEXT_START)
|
*(HMA_TEXT_START)
|
||||||
*(HMA_TEXT)
|
*(HMA_TEXT)
|
||||||
|
_call_intr = CALL_INTR;
|
||||||
_res_DosExec = RES_DOSEXEC;
|
_res_DosExec = RES_DOSEXEC;
|
||||||
_res_read = RES_READ;
|
_res_read = RES_READ;
|
||||||
_strlen = STRLEN;
|
_strlen = STRLEN;
|
||||||
|
@ -222,6 +222,7 @@ UWORD ASMPASCAL call_intr(WORD nr, iregs FAR * rp);
|
|||||||
COUNT ASMPASCAL res_DosExec(COUNT mode, exec_blk * ep, BYTE * lp);
|
COUNT ASMPASCAL res_DosExec(COUNT mode, exec_blk * ep, BYTE * lp);
|
||||||
UCOUNT ASMPASCAL res_read(int fd, void *buf, UCOUNT count);
|
UCOUNT ASMPASCAL res_read(int fd, void *buf, UCOUNT count);
|
||||||
#ifdef __WATCOMC__
|
#ifdef __WATCOMC__
|
||||||
|
#pragma aux (pascal) call_intr modify exact [ax]
|
||||||
#pragma aux (pascal) res_DosExec modify exact [ax bx dx es]
|
#pragma aux (pascal) res_DosExec modify exact [ax bx dx es]
|
||||||
#pragma aux (pascal) res_read modify exact [ax bx cx dx]
|
#pragma aux (pascal) res_read modify exact [ax bx cx dx]
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user