mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 09:39:09 +02:00
+ added nil pointer assignment test at the end of program for i8086-msdos
(works only for small and medium memory model) git-svn-id: trunk@26888 -
This commit is contained in:
parent
47b4a52c8f
commit
90c04fef80
@ -361,6 +361,29 @@ int_number:
|
|||||||
ret 4
|
ret 4
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
global FPC_CHECK_NULLAREA
|
||||||
|
FPC_CHECK_NULLAREA:
|
||||||
|
%ifdef __TINY__
|
||||||
|
; tiny model has no nil pointer assignment checking; always return true.
|
||||||
|
mov al, 1
|
||||||
|
%else
|
||||||
|
push ds
|
||||||
|
pop es
|
||||||
|
xor di, di
|
||||||
|
mov cx, 32
|
||||||
|
mov al, 1
|
||||||
|
cld
|
||||||
|
repe scasb
|
||||||
|
je .skip
|
||||||
|
dec ax ; 1 byte shorter than dec al
|
||||||
|
.skip:
|
||||||
|
%endif
|
||||||
|
%ifdef __FAR_CODE__
|
||||||
|
retf
|
||||||
|
%else
|
||||||
|
ret
|
||||||
|
%endif
|
||||||
|
|
||||||
segment data
|
segment data
|
||||||
mem_realloc_err_msg:
|
mem_realloc_err_msg:
|
||||||
db 'Memory allocation error', 13, 10, '$'
|
db 'Memory allocation error', 13, 10, '$'
|
||||||
|
@ -116,6 +116,8 @@ procedure MsDos_Carry(var Regs: Registers); external name 'FPC_MSDOS_CARRY';
|
|||||||
procedure InstallInterruptHandlers; external name 'FPC_INSTALL_INTERRUPT_HANDLERS';
|
procedure InstallInterruptHandlers; external name 'FPC_INSTALL_INTERRUPT_HANDLERS';
|
||||||
procedure RestoreInterruptHandlers; external name 'FPC_RESTORE_INTERRUPT_HANDLERS';
|
procedure RestoreInterruptHandlers; external name 'FPC_RESTORE_INTERRUPT_HANDLERS';
|
||||||
|
|
||||||
|
function CheckNullArea: Boolean; external name 'FPC_CHECK_NULLAREA';
|
||||||
|
|
||||||
{$I system.inc}
|
{$I system.inc}
|
||||||
|
|
||||||
{$I tinyheap.inc}
|
{$I tinyheap.inc}
|
||||||
@ -279,6 +281,8 @@ begin
|
|||||||
if h>=5 then
|
if h>=5 then
|
||||||
do_close(h);
|
do_close(h);
|
||||||
end;
|
end;
|
||||||
|
if not CheckNullArea then
|
||||||
|
writeln(stderr, 'Nil pointer assignment');
|
||||||
asm
|
asm
|
||||||
mov al, byte [exitcode]
|
mov al, byte [exitcode]
|
||||||
mov ah, 4Ch
|
mov ah, 4Ch
|
||||||
|
Loading…
Reference in New Issue
Block a user