* i8086 far data memory model fixes in the int 0 (div by zero) handler

git-svn-id: trunk@28062 -
This commit is contained in:
nickysn 2014-06-25 16:46:58 +00:00
parent d00c67f9d3
commit ba5ececab9

View File

@ -259,39 +259,43 @@ error_msg:
FPC_INT00_HANDLER: FPC_INT00_HANDLER:
sub sp, 4 ; reserve space on the stack for the retf sub sp, 4 ; reserve space on the stack for the retf
push bx
push cx push cx
push ds push ds
push bp
; init ds ; init ds
%ifdef __TINY__ %ifdef __TINY__
mov bx, cs mov bp, cs
%else %else
mov bx, dgroup mov bp, dgroup
%endif %endif
mov ds, bx mov ds, bp
%ifdef __NEAR_DATA__
; in memory models, where SS=DS, also
; check whether we're running on the same stack ; check whether we're running on the same stack
mov cx, ss mov cx, ss
cmp bx, cx cmp bp, cx
jne .call_previous_handler jne .call_previous_handler
%endif
%ifndef __FAR_CODE__ %ifndef __FAR_CODE__
; check whether we're coming from the same code segment ; check whether we're coming from the same code segment
mov bx, sp mov bp, sp
mov cx, [bx + 3*2 + 6] ; get caller segment mov cx, [bp + 3*2 + 6] ; get caller segment
mov bx, cs mov bp, cs
cmp bx, cx cmp bp, cx
jne .call_previous_handler jne .call_previous_handler
%endif %endif
; runerror 200 ; runerror 200
mov bx, sp mov bp, sp
mov cx, [bx + 3*2 + 4] ; get caller offset mov cx, [bp + 3*2 + 4] ; get caller offset
%ifdef __FAR_CODE__ %ifdef __FAR_CODE__
mov dx, [bx + 3*2 + 6] ; get caller segment mov dx, [bp + 3*2 + 6] ; get caller segment
%endif %endif
add sp, 3*2 + 4 + 6 pop bp
add sp, 2*2 + 4 + 6
xor ax, ax xor ax, ax
push ax push ax
mov ax, 200 mov ax, 200
@ -308,14 +312,14 @@ FPC_INT00_HANDLER:
%endif %endif
.call_previous_handler: .call_previous_handler:
mov bx, sp mov bp, sp
mov cx, [__SaveInt00] mov cx, [__SaveInt00]
mov [ss:bx + 3*2], cx mov [bp + 3*2], cx
mov cx, [__SaveInt00+2] mov cx, [__SaveInt00+2]
mov [ss:bx + 3*2 + 2], cx mov [bp + 3*2 + 2], cx
pop bp
pop ds pop ds
pop cx pop cx
pop bx
retf ; jumps to the previous handler with all registers and stack intact retf ; jumps to the previous handler with all registers and stack intact