+{$include pgtypes.inc}\r
+\r
{$ifndef nolcorernd}\r
uses\r
{$ifdef mswindows}windows,activex,{$endif}\r
{$ifndef nolcorernd}\r
uses\r
{$ifdef mswindows}windows,activex,{$endif}\r
\r
{$ifdef unix}{$include unixstuff.inc}{$endif}\r
\r
\r
{$ifdef unix}{$include unixstuff.inc}{$endif}\r
\r
+procedure rdtsc(buf: pointer);\r
+asm\r
+ {$ifdef cpux86}\r
+ mov ecx, buf\r
+ db $0f; db $31 {rdtsc}\r
+ mov [ecx], edx\r
+ mov [ecx+4], eax\r
+ {$endif}\r
+\r
+ {$ifdef cpux64}\r
+ mov rcx, buf\r
+ rdtsc\r
+ mov [rcx], edx\r
+ mov [rcx+4], eax\r
+ {$endif}\r
+end;\r
+\r
type\r
{hashtype must be array of bytes}\r
hashtype=tmd5;\r
type\r
{hashtype must be array of bytes}\r
hashtype=tmd5;\r
cursor:tpoint;\r
hs:theapstatus;\r
end absolute output;\r
cursor:tpoint;\r
hs:theapstatus;\r
end absolute output;\r
- rdtsc_0,rdtsc_1:integer;\r
begin\r
result := 0;\r
if (bufsize < sizeof(l)) then exit;\r
begin\r
result := 0;\r
if (bufsize < sizeof(l)) then exit;\r
queryperformancecounter(tlargeinteger(l.qpcbuf));\r
\r
{RDTSC}\r
queryperformancecounter(tlargeinteger(l.qpcbuf));\r
\r
{RDTSC}\r
- {$ifdef cpu386}\r
- asm\r
- db $0F; db $31\r
- mov rdtsc_0,eax\r
- mov rdtsc_1,edx\r
- end;\r
- l.rdtscbuf[0] := rdtsc_0;\r
- l.rdtscbuf[1] := rdtsc_1;\r
- {$endif}\r
+ rdtsc(@l.rdtscbuf);\r
+\r
{GETSYSTEMTIME}\r
getsystemtime(tsystemtime(l.systemtimebuf));\r
\r
{GETSYSTEMTIME}\r
getsystemtime(tsystemtime(l.systemtimebuf));\r
\r
tv:ttimeval;\r
pid:integer;\r
end absolute output;\r
tv:ttimeval;\r
pid:integer;\r
end absolute output;\r
- rdtsc_0,rdtsc_1:integer;\r
\r
begin\r
result := 0;\r
\r
begin\r
result := 0;\r
move(wtmpcached,l.devrnd,sizeof(l.devrnd));\r
end;\r
{get more randomness in case there's no /dev/random}\r
move(wtmpcached,l.devrnd,sizeof(l.devrnd));\r
end;\r
{get more randomness in case there's no /dev/random}\r
- {$ifdef cpu386}{$ASMMODE intel}\r
- asm\r
- db $0F; db $31\r
- mov rdtsc_0,eax\r
- mov rdtsc_1,edx\r
- end;\r
- l.rdtscbuf[0] := rdtsc_0;\r
- l.rdtscbuf[1] := rdtsc_1;\r
- {$endif}\r
\r
gettimeofday(l.tv);\r
l.pid := getpid;\r
\r
gettimeofday(l.tv);\r
l.pid := getpid;\r
-{$ifdef i386}{$define ENDIAN_LITTLE}{$endif}
-{$ifdef cpux64}{$define ENDIAN_LITTLE}{$endif}
+{$ifdef i386}{$define ENDIAN_LITTLE}{$asmmode intel}{$endif}
+{$ifdef cpux64}{$define ENDIAN_LITTLE}{$asmmode intel}{$endif}