* fpc_setjmp and fpc_longjmp updated to support far code memory models

git-svn-id: trunk@24878 -
This commit is contained in:
nickysn 2013-06-11 23:59:30 +00:00
parent 0de550c2c9
commit 70cd05caa8
2 changed files with 15 additions and 2 deletions

View File

@ -23,8 +23,12 @@ asm
mov bx, ss:[bp + 4 + extra_param_offset] // S
mov word [bx + Jmp_buf.bp], ax
mov word [bx + Jmp_buf.sp], di
mov di, word ss:[di]
mov word [bx + Jmp_buf.ip], di
mov cx, word ss:[di]
mov word [bx + Jmp_buf.ip], cx
{$ifdef FPC_X86_CODE_FAR}
mov cx, word ss:[di + 2]
mov word [bx + Jmp_buf.cs], cx
{$endif FPC_X86_CODE_FAR}
xor ax, ax
pop bp
@ -47,5 +51,11 @@ asm
// 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}
end;

View File

@ -18,6 +18,9 @@ Type
// bx,si,di: Word;
bp,sp: Word;
ip: Word;
{$ifdef FPC_X86_CODE_FAR}
cs: Word;
{$endif FPC_X86_CODE_FAR}
end;
PJmp_buf = ^jmp_buf;