+ support i8086 far data memory models in fpc_longJmp

git-svn-id: trunk@27413 -
This commit is contained in:
nickysn 2014-03-31 15:53:12 +00:00
parent 1643c175f2
commit c0cb3643f8

View File

@ -42,22 +42,41 @@ Procedure fpc_longJmp (Var S : Jmp_buf; value : smallint); assembler;nostackfram
asm
mov si, sp
{$ifdef FPC_X86_DATA_NEAR}
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
test ax, ax
jnz @@L1
inc ax
@@L1:
{$ifdef FPC_X86_DATA_NEAR}
mov bp, word [bx + Jmp_buf.bp]
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
// fninit no must be done elsewhere PM
// or we should reset the control word also
{$ifdef FPC_X86_CODE_NEAR}
jmp word [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 [bx + Jmp_buf.ip]
db 0FFh, 06Fh, Jmp_buf.ip
{$endif FPC_X86_CODE_NEAR}
{$ifdef FPC_X86_DATA_NEAR}
{$ifdef FPC_X86_CODE_NEAR}
jmp word [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 [bx + Jmp_buf.ip]
db 0FFh, 06Fh, Jmp_buf.ip
{$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;