mirror of https://github.com/red-prig/fpPS4.git
This commit is contained in:
parent
565ea74292
commit
5fa0308809
|
@ -16,8 +16,6 @@ var
|
|||
debug_info:Boolean=False;
|
||||
|
||||
procedure pick(var ctx:t_jit_context2;preload:Pointer);
|
||||
procedure pick_locked_internal(var ctx:t_jit_context2);
|
||||
procedure pick_locked(var ctx:t_jit_context2);
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -1373,6 +1371,9 @@ begin
|
|||
Assert(false,'TODO: trigger in code analize');
|
||||
end;
|
||||
|
||||
function pick_locked_internal(var ctx:t_jit_context2):p_jit_dynamic_blob; forward;
|
||||
function pick_locked_normal (var ctx:t_jit_context2):p_jit_dynamic_blob; forward;
|
||||
|
||||
procedure pick(var ctx:t_jit_context2;preload:Pointer); [public, alias:'kern_jit_pick'];
|
||||
label
|
||||
_exit;
|
||||
|
@ -1385,6 +1386,8 @@ var
|
|||
lock___end:QWORD;
|
||||
|
||||
tobj:p_vm_track_object;
|
||||
|
||||
blob:p_jit_dynamic_blob;
|
||||
begin
|
||||
map:=p_proc.p_vmspace;
|
||||
|
||||
|
@ -1420,10 +1423,15 @@ begin
|
|||
|
||||
if (cmInternal in ctx.modes) then
|
||||
begin
|
||||
pick_locked_internal(ctx);
|
||||
blob:=pick_locked_internal(ctx);
|
||||
end else
|
||||
begin
|
||||
pick_locked(ctx); //blob.attach-> blob_track-> vm_map_track_insert
|
||||
blob:=pick_locked_normal(ctx);
|
||||
end;
|
||||
|
||||
if (blob<>nil) then
|
||||
begin
|
||||
blob^.attach; //blob.attach-> blob_track-> vm_map_track_insert
|
||||
end;
|
||||
|
||||
//restore non tracked (mirrors?)
|
||||
|
@ -1464,12 +1472,14 @@ begin
|
|||
//debug
|
||||
end;
|
||||
|
||||
procedure pick_locked_internal(var ctx:t_jit_context2);
|
||||
function pick_locked_internal(var ctx:t_jit_context2):p_jit_dynamic_blob;
|
||||
var
|
||||
node:t_jit_context2.p_export_point;
|
||||
|
||||
link_curr,link_next:t_jit_i_link;
|
||||
begin
|
||||
Result:=nil;
|
||||
|
||||
node:=ctx.export_list;
|
||||
|
||||
if (node=nil) then
|
||||
|
@ -1538,7 +1548,7 @@ begin
|
|||
|
||||
ctx.end_chunk(ctx.ptr_next);
|
||||
|
||||
build(ctx);
|
||||
Result:=build(ctx);
|
||||
|
||||
ctx.Free;
|
||||
end;
|
||||
|
@ -1546,7 +1556,7 @@ end;
|
|||
var
|
||||
_print_stat:Integer=0;
|
||||
|
||||
procedure pick_locked(var ctx:t_jit_context2);
|
||||
function pick_locked_normal(var ctx:t_jit_context2):p_jit_dynamic_blob;
|
||||
label
|
||||
_next,
|
||||
_build,
|
||||
|
@ -1571,6 +1581,8 @@ var
|
|||
|
||||
i:Integer;
|
||||
begin
|
||||
Result:=nil;
|
||||
|
||||
if (cmDontScanRipRel in ctx.modes) then
|
||||
begin
|
||||
//dont scan rip relative
|
||||
|
@ -1993,7 +2005,7 @@ begin
|
|||
op_set_r14_imm(ctx,Int64(ctx.ptr_curr));
|
||||
end;
|
||||
|
||||
build(ctx);
|
||||
Result:=build(ctx);
|
||||
|
||||
ctx.Free;
|
||||
|
||||
|
|
|
@ -190,7 +190,8 @@ type
|
|||
his_ro, //read only
|
||||
his_wo, //write only
|
||||
his_rw, //read-write
|
||||
his_align);
|
||||
his_align,
|
||||
his_bt);
|
||||
|
||||
t_op_desc=packed record
|
||||
mem_reg:t_op_type; //reg_reg
|
||||
|
@ -2449,6 +2450,7 @@ begin
|
|||
Assert(mem_size<>os0);
|
||||
|
||||
if ((his_ro in desc.hint) or (mem_size<>os32)) and
|
||||
(not (his_bt in desc.hint)) and
|
||||
(not (not_impl in desc.mem_reg.opt)) then
|
||||
begin
|
||||
i:=GetFrameOffset(ctx.din.Operand[1]);
|
||||
|
@ -2543,6 +2545,7 @@ begin
|
|||
cmp_opr:=cmp_reg(ctx.din.Operand[1],ctx.din.Operand[2]);
|
||||
|
||||
if ((his_ro in desc.hint) or (mem_size<>os32)) and
|
||||
(not (his_bt in desc.hint)) and
|
||||
(not (not_impl in desc.mem_reg.opt)) and
|
||||
(not cmp_opr) then
|
||||
begin
|
||||
|
@ -2621,8 +2624,8 @@ begin
|
|||
end else
|
||||
begin
|
||||
|
||||
if (his_ro in desc.hint) or
|
||||
(mem_size<>os32) then
|
||||
if ((his_ro in desc.hint) or (mem_size<>os32)) and
|
||||
(not (his_bt in desc.hint)) then
|
||||
begin
|
||||
i:=GetFrameOffset(ctx.din.Operand[1]);
|
||||
op_mi(ctx,desc,[r_thrd+i,mem_size],imm,imm_size);
|
||||
|
|
|
@ -132,8 +132,8 @@ type
|
|||
procedure alloc_base(_size:ptruint);
|
||||
procedure free_base;
|
||||
procedure attach_entry(node:p_jit_entry_point);
|
||||
procedure attach_entry;
|
||||
procedure attach_chunk;
|
||||
procedure attach_all_entry;
|
||||
procedure attach_all_chunk;
|
||||
procedure attach;
|
||||
function detach_entry(node:p_jit_entry_point):Boolean;
|
||||
procedure detach_all_entry;
|
||||
|
@ -172,7 +172,7 @@ function jmp_dispatcher(addr:Pointer;plt:p_jit_plt;from:Pointer):Pointer;
|
|||
|
||||
procedure blob_track(blob:p_jit_dynamic_blob);
|
||||
|
||||
procedure build(var ctx:t_jit_context2);
|
||||
function build(var ctx:t_jit_context2):p_jit_dynamic_blob;
|
||||
|
||||
procedure preload(addr:Pointer);
|
||||
|
||||
|
@ -907,7 +907,7 @@ begin
|
|||
build_chunk(ctx,blob,start,__end,count);
|
||||
end;
|
||||
|
||||
procedure build(var ctx:t_jit_context2);
|
||||
function build(var ctx:t_jit_context2):p_jit_dynamic_blob;
|
||||
var
|
||||
addr:Pointer;
|
||||
|
||||
|
@ -922,6 +922,8 @@ var
|
|||
//F:THandle;
|
||||
|
||||
begin
|
||||
Result:=nil;
|
||||
|
||||
if (ctx.builder.GetMemSize=0) then Exit;
|
||||
|
||||
blob:=new_blob(ctx.builder.GetMemSize);
|
||||
|
@ -998,7 +1000,9 @@ begin
|
|||
build_blob(ctx,blob,start,__end);
|
||||
end;
|
||||
|
||||
blob^.attach;
|
||||
//blob^.attach;
|
||||
|
||||
Result:=blob;
|
||||
end;
|
||||
|
||||
function fetch_entry(src:Pointer):p_jit_entry_point;
|
||||
|
@ -1461,7 +1465,7 @@ begin
|
|||
rw_wunlock(entry_hamt_lock);
|
||||
end;
|
||||
|
||||
procedure t_jit_dynamic_blob.attach_entry;
|
||||
procedure t_jit_dynamic_blob.attach_all_entry;
|
||||
var
|
||||
node,next:p_jit_entry_point;
|
||||
begin
|
||||
|
@ -1476,7 +1480,7 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure t_jit_dynamic_blob.attach_chunk;
|
||||
procedure t_jit_dynamic_blob.attach_all_chunk;
|
||||
//var
|
||||
// node,next:p_jcode_chunk;
|
||||
begin
|
||||
|
@ -1501,8 +1505,8 @@ end;
|
|||
|
||||
procedure t_jit_dynamic_blob.attach;
|
||||
begin
|
||||
attach_entry;
|
||||
attach_chunk;
|
||||
attach_all_entry;
|
||||
attach_all_chunk;
|
||||
end;
|
||||
|
||||
function t_jit_dynamic_blob.detach_entry(node:p_jit_entry_point):Boolean;
|
||||
|
@ -1637,6 +1641,8 @@ end;
|
|||
|
||||
function on_trigger(handle:Pointer;mode:T_TRIGGER_MODE):Integer;
|
||||
begin
|
||||
Result:=DO_NOTHING;
|
||||
|
||||
case mode of
|
||||
M_CPU_WRITE :;
|
||||
M_DMEM_WRITE:;
|
||||
|
|
|
@ -1020,7 +1020,7 @@ const
|
|||
reg_mem:(opt:[not_impl]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(op:$0FBA;index:4);
|
||||
hint:[his_ro];
|
||||
hint:[his_ro,his_bt];
|
||||
);
|
||||
|
||||
procedure op_bt(var ctx:t_jit_context2);
|
||||
|
@ -1040,7 +1040,7 @@ const
|
|||
reg_mem:(opt:[not_impl]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(op:$0FBA;index:7);
|
||||
hint:[his_rw];
|
||||
hint:[his_rw,his_bt];
|
||||
);
|
||||
|
||||
procedure op_btc(var ctx:t_jit_context2);
|
||||
|
@ -1060,7 +1060,7 @@ const
|
|||
reg_mem:(opt:[not_impl]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(op:$0FBA;index:5);
|
||||
hint:[his_rw];
|
||||
hint:[his_rw,his_bt];
|
||||
);
|
||||
|
||||
procedure op_bts(var ctx:t_jit_context2);
|
||||
|
@ -1080,7 +1080,7 @@ const
|
|||
reg_mem:(opt:[not_impl]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(op:$0FBA;index:6);
|
||||
hint:[his_rw];
|
||||
hint:[his_rw,his_bt];
|
||||
);
|
||||
|
||||
procedure op_btr(var ctx:t_jit_context2);
|
||||
|
|
Loading…
Reference in New Issue