mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 19:19:24 +02:00
* changed the default i8086 calling convention to pocall_pascal
git-svn-id: branches/i8086@24290 -
This commit is contained in:
parent
709ba5e053
commit
5ed1222e64
@ -491,7 +491,7 @@ interface
|
||||
|
||||
{ Default calling convention }
|
||||
{$if defined(i8086)}
|
||||
pocall_default = pocall_register;
|
||||
pocall_default = pocall_pascal;
|
||||
{$elseif defined(i386) or defined(x86_64)}
|
||||
pocall_default = pocall_register;
|
||||
{$else}
|
||||
|
@ -45,47 +45,57 @@ end;
|
||||
{$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
|
||||
function get_caller_addr(framebp:pointer;addr:pointer=nil):pointer;nostackframe;assembler;
|
||||
asm
|
||||
push bp
|
||||
mov bp, sp
|
||||
mov ax, ss:[bp + 6]
|
||||
or ax, ax
|
||||
jz @@Lg_a_null
|
||||
xchg ax, bx
|
||||
mov bx, [bx+2]
|
||||
xchg ax, bx
|
||||
@@Lg_a_null:
|
||||
pop bp
|
||||
end;
|
||||
|
||||
{$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
|
||||
function get_caller_frame(framebp:pointer;addr:pointer=nil):pointer;nostackframe;assembler;
|
||||
asm
|
||||
push bp
|
||||
mov bp, sp
|
||||
mov ax, ss:[bp + 6]
|
||||
or ax, ax
|
||||
jz @@Lgnf_null
|
||||
xchg ax, bx
|
||||
mov bx, [bx]
|
||||
xchg ax, bx
|
||||
@@Lgnf_null:
|
||||
pop bp
|
||||
end;
|
||||
|
||||
{TODO: fix, use smallint?}
|
||||
function InterLockedDecrement (var Target: longint) : longint; assembler;
|
||||
asm
|
||||
push bx
|
||||
mov bx, ax
|
||||
push bp
|
||||
mov bp, sp
|
||||
mov bx, ss:[bp + 4]
|
||||
sub word [bx], 1
|
||||
sbb word [bx+2], 0
|
||||
mov ax, [bx]
|
||||
mov dx, [bx+2]
|
||||
pop bx
|
||||
pop bp
|
||||
end;
|
||||
|
||||
{TODO: fix, use smallint?}
|
||||
function InterLockedIncrement (var Target: longint) : longint; assembler;
|
||||
asm
|
||||
push bx
|
||||
mov bx, ax
|
||||
push bp
|
||||
mov bp, sp
|
||||
mov bx, ss:[bp + 4]
|
||||
add word [bx], 1
|
||||
adc word [bx+2], 0
|
||||
mov ax, [bx]
|
||||
mov dx, [bx+2]
|
||||
pop bx
|
||||
pop bp
|
||||
end;
|
||||
|
||||
{TODO: fix, use smallint?}
|
||||
|
@ -15,36 +15,36 @@
|
||||
|
||||
Function fpc_SetJmp (Var S : Jmp_buf) : smallint;assembler;nostackframe;[Public, alias : 'FPC_SETJMP']; compilerproc;
|
||||
asm
|
||||
xchg ax, bx
|
||||
mov word [bx + Jmp_buf.bx], ax
|
||||
mov word [bx + Jmp_buf.si], si
|
||||
mov word [bx + Jmp_buf.di], di
|
||||
mov word [bx + Jmp_buf.bp], bp
|
||||
mov ax, bp
|
||||
mov di, sp
|
||||
add di, 2
|
||||
push bp
|
||||
mov bp, sp
|
||||
|
||||
mov bx, ss:[bp + 4]
|
||||
mov word [bx + Jmp_buf.bp], ax
|
||||
mov word [bx + Jmp_buf.sp], di
|
||||
mov di, word [di - 2]
|
||||
mov di, word ss:[di]
|
||||
mov word [bx + Jmp_buf.pc], di
|
||||
mov di, word [bx + Jmp_buf.di]
|
||||
mov bx, ax
|
||||
|
||||
xor ax, ax
|
||||
pop bp
|
||||
end;
|
||||
|
||||
|
||||
Procedure fpc_longJmp (Var S : Jmp_buf; value : smallint); assembler;nostackframe;[Public, alias : 'FPC_LONGJMP']; compilerproc;
|
||||
asm
|
||||
mov bx, ax
|
||||
mov ax, dx
|
||||
push bp
|
||||
mov bp, sp
|
||||
|
||||
mov bx, ss:[bp + 6]
|
||||
mov ax, ss:[bp + 4]
|
||||
test ax, ax
|
||||
jnz @@L1
|
||||
inc ax
|
||||
@@L1:
|
||||
mov si, word [bx + Jmp_buf.si]
|
||||
mov di, word [bx + Jmp_buf.di]
|
||||
mov dx, word [bx + Jmp_buf.pc]
|
||||
mov bp, word [bx + Jmp_buf.bp]
|
||||
mov sp, word [bx + Jmp_buf.sp]
|
||||
mov bx, word [bx + Jmp_buf.bx]
|
||||
// we should also clear the fpu
|
||||
// fninit no must be done elsewhere PM
|
||||
// or we should reset the control word also
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
Type
|
||||
jmp_buf = packed record
|
||||
bx,si,di: Word;
|
||||
// bx,si,di: Word;
|
||||
bp,sp,pc: Pointer;
|
||||
end;
|
||||
PJmp_buf = ^jmp_buf;
|
||||
|
@ -89,20 +89,25 @@ FPC_MSDOS_CARRY:
|
||||
stc
|
||||
global FPC_MSDOS
|
||||
FPC_MSDOS:
|
||||
mov dx, ax
|
||||
mov al, 21h
|
||||
mov ax, 21h
|
||||
pop dx
|
||||
pop cx
|
||||
push ax
|
||||
push cx
|
||||
push dx
|
||||
global FPC_INTR
|
||||
FPC_INTR:
|
||||
mov byte [cs:int_number], al
|
||||
push bp
|
||||
mov bp, sp
|
||||
mov al, byte [ss:bp + 6]
|
||||
mov byte [cs:int_number], al
|
||||
push es
|
||||
push di
|
||||
push bx
|
||||
push cx
|
||||
mov si, [ss:bp + 4]
|
||||
push si
|
||||
push dx
|
||||
push ds
|
||||
mov si, dx
|
||||
mov ax, word [si + 16]
|
||||
mov es, ax
|
||||
mov ax, word [si + 14] ; ds
|
||||
@ -145,14 +150,13 @@ int_number:
|
||||
mov word [si + 18], ax
|
||||
|
||||
pop ds
|
||||
pop dx
|
||||
pop si
|
||||
pop cx
|
||||
pop bx
|
||||
pop di
|
||||
pop es
|
||||
pop bp
|
||||
ret
|
||||
ret 4
|
||||
|
||||
segment data
|
||||
mem_realloc_err_msg:
|
||||
|
Loading…
Reference in New Issue
Block a user