This commit is contained in:
Pavel 2024-01-12 23:49:24 +03:00
parent 801039b1d7
commit 08024178e3
5 changed files with 38 additions and 35 deletions

View File

@ -368,10 +368,7 @@ begin
end;
Result:=kern_dynlib_get_info(handle,1,@dst);
if (Result<>0) then
begin
Exit(ESRCH);
end;
if (Result<>0) then Exit;
Result:=copyout(@dst,info,SizeOf(SceKernelModuleInfo));
end;
@ -400,10 +397,7 @@ begin
end;
Result:=kern_dynlib_get_info(handle,0,@dst);
if (Result<>0) then
begin
Exit(ESRCH);
end;
if (Result<>0) then Exit;
Result:=copyout(@dst,info,SizeOf(SceKernelModuleInfo));
end;
@ -514,10 +508,7 @@ begin
end;
Result:=kern_dynlib_get_info_ex(handle,flags,@dst);
if (Result<>0) then
begin
Exit(ESRCH);
end;
if (Result<>0) then Exit;
Result:=copyout(@dst,info,SizeOf(SceKernelModuleInfoEx));
end;
@ -529,7 +520,7 @@ end;
function copyout_module_handle_list(pArray:PInteger;numArray:QWORD;flags:DWORD;pActualNum:PQWORD):Integer;
var
i,count:QWORD;
i,w,count:QWORD;
src:PInteger;
obj:p_lib_info;
begin
@ -542,6 +533,7 @@ begin
dynlibs_lock;
i:=0;
w:=0;
count:=dynlibs_info.obj_count;
if (((flags and 1)<>0) and (count > numArray)) then
@ -557,13 +549,14 @@ begin
begin
if ((flags and 1)<>0) or (obj^.rtld_flags.is_system=0) then
begin
if (numArray<=i) then
if (w>=numArray) then
begin
dynlibs_unlock;
FreeMem(src);
Exit(ENOMEM);
end;
src[i]:=obj^.id;
src[w]:=obj^.id;
Inc(w);
end;
//
Inc(i);
@ -577,11 +570,11 @@ begin
Writeln(StdErr,'copyout_module_handle_list:','WARNING: num<>dp^.obj_count');
end;
Result:=copyout(src,pArray,i*SizeOf(Integer));
Result:=copyout(src,pArray,w*SizeOf(Integer));
if (Result=0) then
begin
Result:=copyout(@i,pActualNum,8);
Result:=copyout(@w,pActualNum,8);
end;
FreeMem(src);

View File

@ -784,7 +784,7 @@ begin
dynlibs_info.tls_max :=1;
obj:=obj_new();
obj^.rtld_flags.mainprog:=1;
obj^.relocbase:=imgp^.reloc_base;
vms:=p_proc.p_vmspace;
@ -831,8 +831,7 @@ begin
obj_set_lib_path(obj,imgp^.execpath);
//*(byte *)&obj^.rtld_flags:=*(byte *)&obj^.rtld_flags | 1;
obj^.rtld_flags.mainprog:=1;
obj^.loaded:=4;
dynlibs_info.libprogram:=obj;
@ -856,14 +855,11 @@ begin
end;
end;
procedure null_init; assembler; nostackframe;
asm
//
end;
function dynlib_proc_initialize_step2(imgp:p_image_params):Integer;
var
obj,tail:p_lib_info;
init_proc_addr:Pointer;
fini_proc_addr:Pointer;
begin
Result:=0;
@ -892,6 +888,9 @@ begin
dynlibs_info.sym_zero.st_shndx:=SHN_UNDEF;
dynlibs_info.sym_zero.st_value:=-Int64(obj^.relocbase);
init_proc_addr:=obj^.fini_proc_addr;
fini_proc_addr:=obj^.init_proc_addr;
obj^.fini_proc_addr:=nil;
obj^.init_proc_addr:=nil;
@ -906,8 +905,8 @@ begin
tail,
dynlibs_info.init_proc_list);
obj^.init_proc_addr:=@null_init;//init_proc_addr;
obj^.fini_proc_addr:=@null_init;//fini_proc_addr;
obj^.init_proc_addr:=init_proc_addr;
obj^.fini_proc_addr:=fini_proc_addr;
///
end;

View File

@ -1151,7 +1151,7 @@ function is_system_path(path:pchar):Boolean;
begin
if (path=nil) then Exit(False);
if (path[0]<>'/') then Exit(False);
Result:=StrLComp(p_proc.p_randomized_path,@path[1],Length(p_proc.p_randomized_path))=0;
Result:=StrLComp(p_proc.p_randomized_path,@path[1],strlen(p_proc.p_randomized_path))=0;
end;
function dynlib_basename(path:pchar):pchar;

View File

@ -377,6 +377,7 @@ uses
vnode_if,
kern_proc,
kern_budget,
kern_authinfo,
kern_namedobj,
elf_nid_utils,
kern_jit,
@ -2018,13 +2019,22 @@ begin
end;
end;
budget:=p_proc.p_budget_ptype;
rtld_load_auth(imgp);
budget:=PTYPE_BIG_APP;
if ((PByte(@imgp^.authinfo.app_type)[7] and $f) - 4 < 4) then
begin
budget:=p_proc.p_budget_ptype;
end else
if is_system_path(path) then
begin
if not is_libc_or_fios(path) then
if is_libc_or_fios(path) then
begin
budget:=2;
budget:=p_proc.p_budget_ptype;
end else
begin
budget:=PTYPE_SYSTEM;
end;
end;
@ -2046,8 +2056,6 @@ begin
goto _fail_dealloc;
end;
rtld_load_auth(imgp);
new^.tls_size :=imgp^.tls_size;
new^.tls_align :=imgp^.tls_align;
new^.tls_init_size :=imgp^.tls_init_size;
@ -2062,7 +2070,7 @@ begin
end;
addr:=ET_DYN_LOAD_ADDR_USR;
if (budget=2) then
if (budget=PTYPE_SYSTEM) then
begin
addr:=ET_DYN_LOAD_ADDR_SYS;
end;
@ -2095,7 +2103,7 @@ begin
goto _fail_dealloc;
end;
if (budget=2) then
if (budget=PTYPE_SYSTEM) then
begin
new^.rtld_flags.is_system:=1;
end;
@ -2714,6 +2722,7 @@ begin
//reg lib
dynlibs_add_obj(Result);
//
Result^.rtld_flags.is_system:=1;
Result^.rtld_flags.internal:=1;
Result^.loaded:=1;

View File

@ -58,6 +58,8 @@ const
VM_MIN_GPU_ADDRESS =QWORD($10000000000);
VM_MAX_GPU_ADDRESS =QWORD($10180000000); //6GB
VM_DEFAULT_MAP_BASE =QWORD(0);
pageablemem=VM_MAXUSER_ADDRESS-VM_MINUSER_ADDRESS;
pmap_mem:array[0..3] of t_addr_range=(