Hi Reid,
Thank you for the feedback. I followed your advice and kept trying to
understand the core of DR.
Now, I know a lot more, but I still have some doubts that I could not
answer myself.
Perhaps, you could help me again with one of them.
This one is about DR options.
In function emit_indirect_branch_lookup (core/x86/emit_utils.c:5228 at
rev. 1815) there is one small section of code that is not reached due
to my runtime configuration (inline_ibl_head == false). Here it is:
code snippet (core/x86/emit_utils.c:5395)
if (inline_ibl_head) {
compare_tag = INSTR_CREATE_cmp(dcontext,
OPND_CREATE_MEMPTR(REG_XCX,
HASHLOOKUP_TAG_OFFS),
opnd_create_reg(REG_XBX));
APP(&ilist, compare_tag);
/* TODO: check whether the static predictor can help here */
/* P4OG:2-18 "Use prefix 3E (DS) for taken and 2E (CS) for
not taken cbr" (DS == PREFIX_DATA) */
APP(&ilist,
INSTR_CREATE_jcc(dcontext, OP_jne_short,
opnd_create_instr(next_fragment_nochasing)));
append_ibl_found(dcontext, &ilist, ibl_code, patch,
HASHLOOKUP_START_PC_OFFS, true,
only_spill_state_in_tls,
target_trace_table ?
DYNAMO_OPTION(trace_single_restore_prefix) :
DYNAMO_OPTION(bb_single_restore_prefix),
NULL);
} else ...
I believe that this code is some sort of implementation of what people
usually refer to as inline caching (or software indirect branch
prediction), and I would like to use it. Is my understanding correct?
I tracked the uses and definitions of the variable inline_ibl_head and
it can be set by some of DR runtime options. If, for instance, I use
the following options, the variable inline_ibl_head becomes true:
-indirect_stubs -thread_private -no_coarse_units
But if I use these options, DR crashes while emitting the lookup routine, in
<Application /home/gabriel/msc/dynamorio/trunk/test/loadandjump
(18569) DynamoRIO usage error : encode_cti error: target beyond 8-bit
reach>
<Usage error: encode_cti error: target beyond 8-bit reach
(/home/gabriel/msc/dynamorio/trunk/core/x86/encode.c, line 2175)
version 4.0.0, custom build
-no_shared_bbs -no_shared_traces -thread_private -indirect_stubs
-no_atomic_inlined_linking -inline_trace_ibl
-no_shared_trace_ibl_routine -no_finite_bb_cache
-no_finite_trace_cache
Am I choosing the wrong options?
How could I use DR options to enable inline_ibl_head to be true, and
the emission of the code?
I mean, if that is even possible.
Kind regards,
Gabriel
----------
Call stack:
#0 encode_with_patch_list (dcontext=0xffffffffffffffff,
patch=0x40029070, ilist=0x7fffffffdb00,
start_pc=0x4002aec0)
at /home/gabriel/msc/dynamorio/trunk/core/x86/emit_utils.c:2320
#1 0x000000007123845f in emit_indirect_branch_lookup
(dcontext=0xffffffffffffffff, code=0x40029000,
pc=0x4002aec0 ,
fcache_return_pc=0x4002ad80 "eH\211<%\030",
target_trace_table=true, inline_ibl_head=true, ibl_code=0x40029010)
at /home/gabriel/msc/dynamorio/trunk/core/x86/emit_utils.c:5980
#2 0x00000000712053f0 in emit_ibl_routine_and_template
(dcontext=0xffffffffffffffff, code=0x40029000,
pc=0x4002aec0 ,
fcache_return_pc=0x4002ad80 "eH\211<%\030",
target_trace_table=true, inline_ibl_head=true, thread_shared=true,
branch_type=IBL_RETURN, source_type=IBL_TRACE_PRIVATE,
ibl_code=0x40029010) at
/home/gabriel/msc/dynamorio/trunk/core/x86/arch.c:780
#3 0x00000000712057ed in emit_ibl_routines
(dcontext=0xffffffffffffffff, code=0x40029000,
pc=0x4002ae92 ,
fcache_return_pc=0x4002ad80 "eH\211<%\030",
source_fragment_type=IBL_TRACE_PRIVATE, thread_shared=true,
target_trace_table=true, ibl_code_routines=0x40029010)
at /home/gabriel/msc/dynamorio/trunk/core/x86/arch.c:853
#4 0x0000000071204d31 in shared_gencode_init
(gencode_mode=GENCODE_X64) at
/home/gabriel/msc/dynamorio/trunk/core/x86/arch.c:377
#5 0x000000007120518c in arch_init () at
/home/gabriel/msc/dynamorio/trunk/core/x86/arch.c:599
#6 0x0000000071088501 in dynamorio_app_init () at
/home/gabriel/msc/dynamorio/trunk/core/dynamo.c:508
#7 0x00007ffff7bd3b01 in _init (argc=1, argv=0x7fffffffe978,
envp=0x7fffffffe988) at
/home/gabriel/msc/dynamorio/trunk/core/linux/preload.c:189
#8 0x00007ffff7debd25 in ?? () from /lib64/ld-linux-x86-64.so.2
#9 0x00007ffff7dddb2a in ?? () from /lib64/ld-linux-x86-64.so.2
#10 0x0000000000000001 in ?? ()
#11 0x00007fffffffeba6 in ?? ()
#12 0x0000000000000000 in ?? ()
> --
> You received this message because you are subscribed to the Google Groups
> "DynamoRIO Users" group.
> To post to this group, send email to
dynamor...@googlegroups.com.
> To unsubscribe from this group, send email to
>
dynamorio-use...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/dynamorio-users?hl=en.