mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 18:29:09 +02:00
+ support i8086 far data memory models in fpc_longJmp
git-svn-id: trunk@27413 -
This commit is contained in:
parent
1643c175f2
commit
c0cb3643f8
@ -42,17 +42,27 @@ Procedure fpc_longJmp (Var S : Jmp_buf; value : smallint); assembler;nostackfram
|
|||||||
asm
|
asm
|
||||||
mov si, sp
|
mov si, sp
|
||||||
|
|
||||||
|
{$ifdef FPC_X86_DATA_NEAR}
|
||||||
mov bx, ss:[si + 4 + extra_param_offset] // S
|
mov bx, ss:[si + 4 + extra_param_offset] // S
|
||||||
|
{$else FPC_X86_DATA_NEAR}
|
||||||
|
les bx, ss:[si + 4 + extra_param_offset] // S
|
||||||
|
{$endif FPC_X86_DATA_NEAR}
|
||||||
mov ax, ss:[si + 2 + extra_param_offset] // value
|
mov ax, ss:[si + 2 + extra_param_offset] // value
|
||||||
test ax, ax
|
test ax, ax
|
||||||
jnz @@L1
|
jnz @@L1
|
||||||
inc ax
|
inc ax
|
||||||
@@L1:
|
@@L1:
|
||||||
|
{$ifdef FPC_X86_DATA_NEAR}
|
||||||
mov bp, word [bx + Jmp_buf.bp]
|
mov bp, word [bx + Jmp_buf.bp]
|
||||||
mov sp, word [bx + Jmp_buf.sp]
|
mov sp, word [bx + Jmp_buf.sp]
|
||||||
|
{$else FPC_X86_DATA_NEAR}
|
||||||
|
mov bp, word es:[bx + Jmp_buf.bp]
|
||||||
|
mov sp, word es:[bx + Jmp_buf.sp]
|
||||||
|
{$endif FPC_X86_DATA_NEAR}
|
||||||
// we should also clear the fpu
|
// we should also clear the fpu
|
||||||
// fninit no must be done elsewhere PM
|
// fninit no must be done elsewhere PM
|
||||||
// or we should reset the control word also
|
// or we should reset the control word also
|
||||||
|
{$ifdef FPC_X86_DATA_NEAR}
|
||||||
{$ifdef FPC_X86_CODE_NEAR}
|
{$ifdef FPC_X86_CODE_NEAR}
|
||||||
jmp word [bx + Jmp_buf.ip]
|
jmp word [bx + Jmp_buf.ip]
|
||||||
{$else FPC_X86_CODE_NEAR}
|
{$else FPC_X86_CODE_NEAR}
|
||||||
@ -60,4 +70,13 @@ asm
|
|||||||
// jmp far [bx + Jmp_buf.ip]
|
// jmp far [bx + Jmp_buf.ip]
|
||||||
db 0FFh, 06Fh, Jmp_buf.ip
|
db 0FFh, 06Fh, Jmp_buf.ip
|
||||||
{$endif FPC_X86_CODE_NEAR}
|
{$endif FPC_X86_CODE_NEAR}
|
||||||
|
{$else FPC_X86_DATA_NEAR}
|
||||||
|
{$ifdef FPC_X86_CODE_NEAR}
|
||||||
|
jmp word es:[bx + Jmp_buf.ip]
|
||||||
|
{$else FPC_X86_CODE_NEAR}
|
||||||
|
// the inline asm doesn't support jmp far yet, so we use db for now
|
||||||
|
// jmp far es:[bx + Jmp_buf.ip]
|
||||||
|
db 026h, 0FFh, 06Fh, Jmp_buf.ip
|
||||||
|
{$endif FPC_X86_CODE_NEAR}
|
||||||
|
{$endif FPC_X86_DATA_NEAR}
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user