Conversation
|
LGTM. |
Shall I rebase this to current dev to rerun the CI or is there anything else blocking the merge? |
| uc_err uc_hook_set_user_data(uc_hook hh, void *user_data) | ||
| { | ||
| struct hook *hook = (struct hook *)hh; | ||
| if (hook->type == UC_HOOK_BLOCK || hook->type == UC_HOOK_CODE) { |
There was a problem hiding this comment.
Wait why do we exclude these two types?
There was a problem hiding this comment.
Because the callbacks are directly called by the tb with the user_data pointer written to the tb. It would require to rebuild the tb to allow change the user_data.
There was a problem hiding this comment.
Oh that's correct. Can we inline the pointer to the hook struct in the tb instead? In that case, the modification to uc_hook would take effect as well.
There was a problem hiding this comment.
No because there is no wrapper function in unicorn for these hooks. The cb function is directly called. I could write a wrapper function which just use the hook_struct. This might affect performance which I would like to avoid in the block case.
There was a problem hiding this comment.
Oh okay, I see. I forgot the inline optimization.
A wrapper would hurt performance quite a lot. Spare me some time to think about if we have better ways.
There was a problem hiding this comment.
What could be done is only allow to change the user_data of code/block hooks while unicorn isn't running and then clear the affected tb cache. This would only affect performance when you change the user data.
There was a problem hiding this comment.
A I missed that I have designed the API without an uc_engine, so I can't test if the emulation is running. So I would say it's ok to just disallow changing user data for these hooks. What do you think?
This allows to change the user_data for hooks. This way it's simpler to adopt the hooks for current needs. I.e. change the page table entries for the tlb hook.
fd9fa29 to
dca893c
Compare
This allows to change the user_data for hooks. This way it's simpler to adopt the hooks for current needs. I.e. change the page table entries for the tlb hook.