[XenAccess-devel] Exposing symbol map functions
Status: Beta
Brought to you by:
bdpayne
From: <hi...@cc...> - 2007-11-29 19:41:46
|
Here's a small patch that adds xa_symbol_to_address to the public API. It simply redirects to the appropriate symbol translation functions in the linux and windows layers. There are times when I want to know the address of a symbol without mapping it. -Jim Index: xa_util.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- xa_util.c (revision 99) +++ xa_util.c (working copy) @@ -163,6 +163,17 @@ } } +int xa_symbol_to_address ( + xa_instance_t* instance, char* sym, uint32_t* vaddr) +{ + if(XA_OS_LINUX =3D=3D instance->os_type) + return linux_system_map_symbol_to_address(instance, =20 sym, vaddr); + else if(XA_OS_WINDOWS =3D=3D instance->os_type) + return windows_symbol_to_address(instance, sym, vaddr); + else + return XA_FAILURE; +} + int xa_get_bit (unsigned long reg, int bit) { unsigned long mask =3D 1 << bit; Index: xenaccess.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- xenaccess.h (revision 99) +++ xenaccess.h (working copy) @@ -334,6 +334,16 @@ int xa_read_long_long_mach ( xa_instance_t *instance, uint32_t maddr, uint64_t *value); +/** + * Returns the address of a symbol. + * + * @param[in] instance XenAccess instance + * @param[in] sym Kernel symbol (must be exported) + * @param[out] vaddr The virtual address of the symbol + */ +int xa_symbol_to_address ( + xa_instance_t *instance, char* sym, uint32_t *vaddr); + /*----------------------------- * Linux-specific functionality */ |