mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:29:24 +02:00
rtl/m68k/m68k.inc:
* fillchar & fillword: check whether the count is 0 before filling anything This fixes cases like "Writeln('')" which is used inside InternalExit if an unhandled exception happened. git-svn-id: trunk@23431 -
This commit is contained in:
parent
583eb3f9a4
commit
f5e94a02cd
@ -92,6 +92,8 @@ procedure FillChar(var x;count:longint;value:byte); assembler;
|
|||||||
move.l x, a0 { destination }
|
move.l x, a0 { destination }
|
||||||
move.l count, d1 { number of bytes to fill }
|
move.l count, d1 { number of bytes to fill }
|
||||||
move.b value, d0 { fill data }
|
move.b value, d0 { fill data }
|
||||||
|
tst.l d1 { anything to fill at all? }
|
||||||
|
beq @LMEMSET5
|
||||||
cmpi.l #65535, d1 { check, if this is a word move }
|
cmpi.l #65535, d1 { check, if this is a word move }
|
||||||
ble @LMEMSET3 { use fast dbra mode }
|
ble @LMEMSET3 { use fast dbra mode }
|
||||||
bra @LMEMSET2
|
bra @LMEMSET2
|
||||||
@ -318,9 +320,11 @@ end;
|
|||||||
procedure fillword(var x;count : longint;value : word);
|
procedure fillword(var x;count : longint;value : word);
|
||||||
begin
|
begin
|
||||||
asm
|
asm
|
||||||
move.l x, a0 { destination }
|
move.l x, a0 { destination }
|
||||||
move.l count, d1 { number of bytes to fill }
|
move.l count, d1 { number of bytes to fill }
|
||||||
move.w value, d0 { fill data }
|
move.w value, d0 { fill data }
|
||||||
|
tst.l d1 { anything to fill at all? }
|
||||||
|
beq @LMEMSET3
|
||||||
bra @LMEMSET21
|
bra @LMEMSET21
|
||||||
@LMEMSET11:
|
@LMEMSET11:
|
||||||
move.w d0,(a0)+
|
move.w d0,(a0)+
|
||||||
@ -328,6 +332,7 @@ procedure fillword(var x;count : longint;value : word);
|
|||||||
subq.l #1,d1
|
subq.l #1,d1
|
||||||
cmp.b #-1,d1
|
cmp.b #-1,d1
|
||||||
bne @LMEMSET11
|
bne @LMEMSET11
|
||||||
|
@LMEMSET3:
|
||||||
end ['d0','d1','a0'];
|
end ['d0','d1','a0'];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user