From: Leonid Astakhov Date: Thu, 23 Jun 2011 04:58:12 +0000 (+0400) Subject: DEX Profile transfer X-Git-Tag: Tizen_SDK_2.3~854 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=454e7a2acaedcf587070d278aa1620ff5d7ab236;p=kernel%2Fswap-modules.git DEX Profile transfer --- diff --git a/driver/device_driver.c b/driver/device_driver.c index 767a0a0..f57273c 100644 --- a/driver/device_driver.c +++ b/driver/device_driver.c @@ -470,6 +470,7 @@ static int device_ioctl (struct inode *inode UNUSED, struct file *file UNUSED, u case EC_IOCTL_ATTACH: result = ec_user_attach (); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) + DPRINTF("EC_IOCTL_ATTACH calling notification chain"); blocking_notifier_call_chain(&inperfa_notifier_list, EC_IOCTL_ATTACH, (void*)NULL); #endif DPRINTF("Attach Probes"); @@ -494,6 +495,7 @@ static int device_ioctl (struct inode *inode UNUSED, struct file *file UNUSED, u result = 0; DPRINTF("Stop and Detach Probes"); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) + DPRINTF("EC_IOCTL_STOP_AND_DETACH calling notification chain"); blocking_notifier_call_chain(&inperfa_notifier_list, EC_IOCTL_STOP_AND_DETACH, (void*)&gl_nNotifyTgid); #endif break; diff --git a/driver/storage.c b/driver/storage.c index be0b86e..0fc67f4 100644 --- a/driver/storage.c +++ b/driver/storage.c @@ -28,6 +28,7 @@ char *p_buffer = NULL; inst_us_proc_t us_proc_info; +inst_dex_proc_t dex_proc_info; char *deps; char *bundle; unsigned int inst_pid = 0; @@ -38,6 +39,7 @@ int paused = 0; /* a state after a stop condition (events are not collected) */ struct timeval last_attach_time = {0, 0}; EXPORT_SYMBOL_GPL(us_proc_info); +EXPORT_SYMBOL_GPL(dex_proc_info); int (*mec_post_event)(char *data, unsigned long len) = NULL; unsigned copy_into_cyclic_buffer (char *buffer, unsigned dst_offset, char *src, unsigned size) @@ -816,6 +818,7 @@ int link_bundle() int i, j, l, k; int len; us_proc_lib_t *d_lib, *pd_lib; + dex_proc_ip_t *dex_proc; ioctl_usr_space_lib_t s_lib; ioctl_usr_space_vtp_t *s_vtp; us_proc_vtp_t *mvtp; @@ -1175,6 +1178,81 @@ int link_bundle() } } + // ================================================================================ + // DEX Probes + // ================================================================================ + len = *(u_int32_t *)p; /* App path len */ + p += sizeof(u_int32_t); + + if ( len == 0 ) + { + dex_proc_info.path = NULL; + } + else + { + dex_proc_info.path = p; + DPRINTF("dex path = %s", dex_proc_info.path); + p += len; + + dex_proc_info.ips_count = *(u_int32_t *)p; + DPRINTF("nr of dex probes = %d", dex_proc_info.ips_count); + p += sizeof(u_int32_t); + + dex_proc_info.p_ips = + kmalloc(dex_proc_info.ips_count * sizeof(dex_proc_ip_t), GFP_KERNEL); + + if (!dex_proc_info.p_ips) + { + EPRINTF("Cannot alloc dex probes!"); + return -1; + } + + memset(dex_proc_info.p_ips, 0, + dex_proc_info.ips_count * sizeof(dex_proc_ip_t)); + + for (i = 0; i < dex_proc_info.ips_count; i++) + { + dex_proc = &dex_proc_info.p_ips[i]; + + // fill up dex proc + + dex_proc->addr = *(u_int32_t *)p; + p += sizeof(u_int32_t); + + dex_proc->inst_type = *(u_int32_t *)p; + p += sizeof(u_int32_t); + + // name + lib_name_len = *(u_int32_t *)p; + p += sizeof(u_int32_t); + dex_proc->name = (char *)p; + p += lib_name_len; + + // class name + lib_name_len = *(u_int32_t *)p; + p += sizeof(u_int32_t); + dex_proc->class_name = (char *)p; + p += lib_name_len; + + // method name + lib_name_len = *(u_int32_t *)p; + p += sizeof(u_int32_t); + dex_proc->method_name = (char *)p; + p += lib_name_len; + + // prototype + lib_name_len = *(u_int32_t *)p; + p += sizeof(u_int32_t); + dex_proc->prototype = (char *)p; + p += lib_name_len; + } + + } + // ================================================================================ + // END OF DEX Probes + // ================================================================================ + + /* Conds */ /* first, delete all the conds */ list_for_each_entry_safe(c, c_tmp, &cond_list.list, list) { diff --git a/driver/storage.h b/driver/storage.h index f299889..c3250e5 100644 --- a/driver/storage.h +++ b/driver/storage.h @@ -179,6 +179,26 @@ typedef struct us_proc_lib_t *p_libs; } inst_us_proc_t; +typedef struct +{ + unsigned int addr; + unsigned int inst_type; + char *name; + char *class_name; + char *method_name; + char *prototype; + +}dex_proc_ip_t; + +typedef struct +{ + char *path; + unsigned ips_count; + dex_proc_ip_t *p_ips; + +}inst_dex_proc_t; + + struct cond { /* cond data itself */ struct event_tmpl tmpl; @@ -196,6 +216,6 @@ extern struct cond cond_list; #define ET_FIELD_ISSET(flags, field) ((flags & field) != 0) extern inst_us_proc_t us_proc_info; - +extern inst_dex_proc_t dex_proc_info; #endif /* !defined(__STORAGE_H__) */