summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsvenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2>2013-01-17 21:17:13 +0000
committersvenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2>2013-01-17 21:17:13 +0000
commitc482574d1365fe20f4ce7c79a9183f37b2224198 (patch)
treeb38565440212b1ea7f931298c790144ace32febe
parentdcc383a3f8d9f01cc410061600dc7bc73701e147 (diff)
downloadfpc-c482574d1365fe20f4ce7c79a9183f37b2224198.tar.gz
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: http://svn.freepascal.org/svn/fpc/trunk@23431 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--rtl/m68k/m68k.inc11
1 files changed, 8 insertions, 3 deletions
diff --git a/rtl/m68k/m68k.inc b/rtl/m68k/m68k.inc
index 7bf9f6b457..87ef38c225 100644
--- a/rtl/m68k/m68k.inc
+++ b/rtl/m68k/m68k.inc
@@ -92,6 +92,8 @@ procedure FillChar(var x;count:longint;value:byte); assembler;
move.l x, a0 { destination }
move.l count, d1 { number of bytes to fill }
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 }
ble @LMEMSET3 { use fast dbra mode }
bra @LMEMSET2
@@ -318,9 +320,11 @@ end;
procedure fillword(var x;count : longint;value : word);
begin
asm
- move.l x, a0 { destination }
- move.l count, d1 { number of bytes to fill }
- move.w value, d0 { fill data }
+ move.l x, a0 { destination }
+ move.l count, d1 { number of bytes to fill }
+ move.w value, d0 { fill data }
+ tst.l d1 { anything to fill at all? }
+ beq @LMEMSET3
bra @LMEMSET21
@LMEMSET11:
move.w d0,(a0)+
@@ -328,6 +332,7 @@ procedure fillword(var x;count : longint;value : word);
subq.l #1,d1
cmp.b #-1,d1
bne @LMEMSET11
+ @LMEMSET3:
end ['d0','d1','a0'];
end;