mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 20:09:20 +02:00
* fixed tests for systems where the page size <> 4096
git-svn-id: trunk@12852 -
This commit is contained in:
parent
0af39c77d9
commit
55373cd1a9
@ -133,28 +133,44 @@ $518787,$219852,$48BD56,$827F40,$3CC0A6,$E79AF6
|
|||||||
var
|
var
|
||||||
i: longint;
|
i: longint;
|
||||||
{$ifdef unix}
|
{$ifdef unix}
|
||||||
p,p2: pbyte;
|
p,p2,p3: pbyte;
|
||||||
bp: paa;
|
bp: paa;
|
||||||
|
mapsize: ptruint;
|
||||||
|
first: boolean;
|
||||||
{$endif}
|
{$endif}
|
||||||
begin
|
begin
|
||||||
if (sizeof(b)<>3*length(results)) then
|
if (sizeof(b)<>3*length(results)) then
|
||||||
error(48);
|
error(48);
|
||||||
{$ifdef unix}
|
{$ifdef unix}
|
||||||
{ check for reading past end of array }
|
{ check for reading past end of array }
|
||||||
repeat
|
mapsize:=4096;
|
||||||
p := fpmmap(nil,4096,PROT_READ or PROT_WRITE,MAP_PRIVATE or MAP_ANONYMOUS,-1,0);
|
{ look for a place where we can map one page and are certain that there's
|
||||||
p2 := fpmmap(nil,4096,PROT_READ or PROT_WRITE,MAP_PRIVATE or MAP_ANONYMOUS,-1,0);
|
no valid page right behind it
|
||||||
until (ptruint(p2) = ptruint(p) + 4096);
|
}
|
||||||
fpmunmap(p2,4096);
|
for i:=1 to 18 do
|
||||||
move(b,pbyte(ptruint(p)+4096-sizeof(b))^,sizeof(b));
|
begin
|
||||||
bp := paa(ptruint(p)+4096-sizeof(b));
|
p:=fpmmap(nil,mapsize*3,PROT_READ or PROT_WRITE,MAP_PRIVATE or MAP_ANONYMOUS,-1,0);
|
||||||
|
if (p<>pointer(-1)) then
|
||||||
|
begin
|
||||||
|
fpmunmap(p,mapsize*3);
|
||||||
|
p2:=fpmmap(p,mapsize,PROT_READ or PROT_WRITE,MAP_PRIVATE or MAP_ANONYMOUS,-1,0);
|
||||||
|
if (p2=p) then
|
||||||
|
break;
|
||||||
|
p2:=pointer(-1);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if (p2 = pointer(-1)) then
|
||||||
|
{ didn't find a suitable mapping }
|
||||||
|
exit;
|
||||||
|
move(b,pbyte(ptruint(p)+mapsize-sizeof(b))^,sizeof(b));
|
||||||
|
bp := paa(ptruint(p)+mapsize-sizeof(b));
|
||||||
for i := low(results) to high(results) do
|
for i := low(results) to high(results) do
|
||||||
if bp^[i] <> results[i] then
|
if bp^[i] <> results[i] then
|
||||||
begin
|
begin
|
||||||
writeln(i);
|
writeln(i);
|
||||||
error(49);
|
error(49);
|
||||||
end;
|
end;
|
||||||
fpmunmap(p,4096);
|
fpmunmap(p,mapsize);
|
||||||
{$else}
|
{$else}
|
||||||
for i := low(results) to high(results) do
|
for i := low(results) to high(results) do
|
||||||
if b[i] <> results[i] then
|
if b[i] <> results[i] then
|
||||||
|
@ -229,18 +229,33 @@ var
|
|||||||
{$ifdef unix}
|
{$ifdef unix}
|
||||||
p,p2: pbyte;
|
p,p2: pbyte;
|
||||||
bp: paa;
|
bp: paa;
|
||||||
|
mapsize: ptruint;
|
||||||
{$else}
|
{$else}
|
||||||
b: tb;
|
b: tb;
|
||||||
{$endif}
|
{$endif}
|
||||||
begin
|
begin
|
||||||
{$ifdef unix}
|
{$ifdef unix}
|
||||||
{ check for reading/writing past end of array }
|
{ check for reading past end of array }
|
||||||
repeat
|
mapsize:=4096;
|
||||||
p := fpmmap(nil,4096,PROT_READ or PROT_WRITE,MAP_PRIVATE or MAP_ANONYMOUS,-1,0);
|
{ look for a place where we can map one page and are certain that there's
|
||||||
p2 := fpmmap(nil,4096,PROT_READ or PROT_WRITE,MAP_PRIVATE or MAP_ANONYMOUS,-1,0);
|
no valid page right behind it
|
||||||
until (ptruint(p2) = ptruint(p) + 4096);
|
}
|
||||||
fpmunmap(p2,4096);
|
for i:=1 to 18 do
|
||||||
fillchar(p^,4096,$ff);
|
begin
|
||||||
|
p:=fpmmap(nil,mapsize*3,PROT_READ or PROT_WRITE,MAP_PRIVATE or MAP_ANONYMOUS,-1,0);
|
||||||
|
if (p<>pointer(-1)) then
|
||||||
|
begin
|
||||||
|
fpmunmap(p,mapsize*3);
|
||||||
|
p2:=fpmmap(p,mapsize,PROT_READ or PROT_WRITE,MAP_PRIVATE or MAP_ANONYMOUS,-1,0);
|
||||||
|
if (p2=p) then
|
||||||
|
break;
|
||||||
|
p2:=pointer(-1);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if (p2 = pointer(-1)) then
|
||||||
|
{ didn't find a suitable mapping }
|
||||||
|
exit;
|
||||||
|
fillchar(p^,mapsize,$ff);
|
||||||
bp := paa(ptruint(p)+4096-sizeof(tb));
|
bp := paa(ptruint(p)+4096-sizeof(tb));
|
||||||
for i := low(results) to high(results) do
|
for i := low(results) to high(results) do
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user