This repository was archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
[QEUSTION]How does granary core work from a high-level insight? #23
Copy link
Copy link
Open
Description
Hi all,
With pgoodman's help 👍 , I get much more clear about wrappers, watchpoints.
But I still know little details about granary core.
So, I start from granary's entry to follow how granary going on.
In init_granary (https://github.com/Granary/granary/blob/master/module.c#L601):
- granary_run_initialisers(https://github.com/Granary/granary/blob/master/granary/x86/init.asm#L11) includes file "granary/gen/kernel_init.s", which is generated when build.
Could you tell me what's the purpose of that file? - when excuting command
sudo touch /dev/granary, granary_initialise be invoked, which do various initializing things(init_code_cache, cpu_state::init_early,run all static initializer functions,and client::init).(https://github.com/Granary/granary/blob/master/granary/init.cc#L76)
what's the meaning of static initializer function, what's the usages of them? - granary use module_notifier to link target modules together,and watch modules' state change through notify_module_state_change(https://github.com/Granary/granary/blob/master/granary/kernel/linux/module.cc#L94).When module coming,why should we set its text read only, and do dynamic_wrapper_of for exit funcs?
how granary work after this is even more harder for me(i.e. how to control and instrument target module's executions.).for example:
- do we split module code into bb based on direct cti only or both indirect and direct cti?
- what will be stored in code cache?
- when/where do we actually instruments module, only in
visit_app/host_instructions? - the last parameter ls in visit_app_instructions actually refer to what?
does it refer to instructions of a basic block in code cache?
granary::instrumentation_policy null_policy::visit_app_instructions(
granary::cpu_state_handle,
granary::basic_block_state &,
granary::instruction_list &
) throw() {
return granary::policy_for<null_policy>();
}
Thank you very much ;)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels