This commit is contained in:
Pavel 2024-03-28 17:19:15 +03:00
parent 65fcdf37b2
commit 79757846dc
7 changed files with 49 additions and 9 deletions

View File

@ -71,7 +71,7 @@ var
begin
Result:=False;
ib_base:=QWORD(buf^.ibBaseLo) or (QWORD(buf^.ibBaseHi) shl 32);
ib_base:=QWORD(buf^.ibBase);
ib_size:=QWORD(buf^.ibSize)*sizeof(DWORD);
addr:=nil;

View File

@ -18,8 +18,7 @@ type
PPM4CMDINDIRECTBUFFER=^PM4CMDINDIRECTBUFFER;
PM4CMDINDIRECTBUFFER=bitpacked record
header :DWORD; // PM4_TYPE_3_HEADER
ibBaseLo :DWORD; // Indirect buffer base address, must be 4 byte aligned
ibBaseHi :bit8;
ibBase :bit40; // Indirect buffer base address, must be 4 byte aligned
reserved0:bit24;
//
ibSize :bit20; // Indirect buffer size

View File

@ -315,8 +315,7 @@ type
header :PM4_TYPE_3_HEADER;
baseIndex:bit4; // < base index selector
reserved1:bit28;
addressLo:bit32; // < base address Lo of buffer, must be 8 byte aligned
addressHi:bit16; // < base address Hi of buffer
address :bit48; // < base address of buffer, must be 8 byte aligned
end;
const
@ -329,8 +328,7 @@ type
PPM4CMDSETPREDICATION=^PM4CMDSETPREDICATION;
PM4CMDSETPREDICATION=bitpacked record
header :PM4_TYPE_3_HEADER;
startAddressLo :bit32; // < start address low
startAddrHi :bit8; // < start address hi
startAddress :bit40; // < start address
predicationBoolean:bit1; // < predication boolean
reserved1 :bit3;
hint :bit1; // < hint

View File

@ -38,6 +38,7 @@ type
bit31=0..2147483647;
bit32=DWORD;
bit38=0..274877906943;
bit40=0..1099511627775;
bit43=0..8796093022207;
bit44=0..17592186044415;
bit48=0..281474976710655;

View File

@ -187,7 +187,7 @@ procedure onSetBase(Body:PPM4CMDDRAWSETBASE);
var
addr:QWORD;
begin
addr:=QWORD(Body^.addressLo) or (QWORD(Body^.addressHi) shl 32);
addr:=QWORD(Body^.address);
Writeln(' baseIndex=0x',HexStr(Body^.baseIndex,4));
Writeln(' address =0x',HexStr(addr,16));
@ -197,7 +197,7 @@ procedure onSetPredication(Body:PPM4CMDSETPREDICATION);
var
addr:QWORD;
begin
addr:=QWORD(Body^.startAddressLo) or (QWORD(Body^.startAddrHi) shl 32);
addr:=QWORD(Body^.startAddress);
Writeln(' startAddress=0x',HexStr(addr,16));
Writeln(' pred =',Body^.predicationBoolean);

View File

@ -23,7 +23,28 @@ uses
kern_proc;
function cpuset_setproc(new:Ptruint):Integer;
var
info:SYSTEM_INFO;
i,m,t,n:Integer;
begin
new:=new and $FF;
info.dwNumberOfProcessors:=1;
GetSystemInfo(info);
if (info.dwNumberOfProcessors<8) then
begin
//remap
m:=0;
for i:=0 to 7 do
begin
t:=(new shr i) and 1;
n:=(i mod info.dwNumberOfProcessors);
m:=m or (t shl n);
end;
new:=m;
end;
Result:=NtSetInformationProcess(NtCurrentProcess,
ProcessAffinityMask,
@new,

View File

@ -310,10 +310,31 @@ begin
end;
function cpuset_setaffinity(td:p_kthread;new:Ptruint):Integer;
var
info:SYSTEM_INFO;
i,m,t,n:Integer;
begin
if (td=nil) then Exit;
if (td^.td_handle=0) or (td^.td_handle=THandle(-1)) then Exit(-1);
new:=new and $FF;
info.dwNumberOfProcessors:=1;
GetSystemInfo(info);
if (info.dwNumberOfProcessors<8) then
begin
//remap
m:=0;
for i:=0 to 7 do
begin
t:=(new shr i) and 1;
n:=(i mod info.dwNumberOfProcessors);
m:=m or (t shl n);
end;
new:=m;
end;
td^.td_cpuset:=new;
Result:=NtSetInformationThread(td^.td_handle,ThreadAffinityMask,@new,SizeOf(Ptruint));
end;