[-]
[+]
|
Changed |
_service:tar_git:libhybris.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris.spec
^
|
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.40.tar.bz2/libhybris/hybris/common/Makefile.am
^
|
@@ -59,16 +59,6 @@
libhybris_common_la_CPPFLAGS += -DWANT_ADRENO_QUIRKS
endif
-if WANT_ARM_TRACING
-if WANT_ARCH_ARM
-# thumb mode not supported
-libhybris_common_la_CFLAGS += \
- -marm
-libhybris_common_la_CPPFLAGS += \
- -marm
-endif
-endif
-
if WANT_TRACE
libhybris_common_la_CPPFLAGS += -DDEBUG
endif
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.40.tar.bz2/libhybris/hybris/common/jb/dlfcn.c
^
|
@@ -23,6 +23,12 @@
#include "linker.h"
#include "linker_format.h"
+#ifdef WANT_ARM_TRACING
+#include "../wrappers.h"
+
+extern void *(*_create_wrapper)(const char *symbol, void *function, int wrapper_type);
+#endif
+
/* This file hijacks the symbols stubbed out in libdl.so. */
#define DL_SUCCESS 0
@@ -115,6 +121,15 @@
if(likely((bind == STB_GLOBAL) && (sym->st_shndx != 0))) {
unsigned ret = sym->st_value + found->base;
+#ifdef WANT_ARM_TRACING
+ switch(ELF32_ST_TYPE(sym->st_info))
+ {
+ case STT_FUNC:
+ case STT_GNU_IFUNC:
+ case STT_ARM_TFUNC:
+ ret = (void*)(_create_wrapper((char*)symbol, (void*)ret, WRAPPER_DYNHOOK));
+ }
+#endif
pthread_mutex_unlock(&dl_lock);
return (void*)ret;
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.40.tar.bz2/libhybris/hybris/common/jb/linker.c
^
|
@@ -51,6 +51,10 @@
#include "linker_environ.h"
#include "linker_format.h"
+#ifdef WANT_ARM_TRACING
+#include "../wrappers.h"
+#endif
+
#define ALLOW_SYMBOLS_FROM_MAIN 1
#define SO_MAX 128
@@ -81,6 +85,10 @@
* having a hard limit (64)
*/
+#ifdef WANT_ARM_TRACING
+void *(*_create_wrapper)(const char *symbol, void *function, int wrapper_type);
+#endif
+
static void* (*_get_hooked_symbol)(const char *symbol, const char *requester);
static int link_image(soinfo *si, unsigned wr_offset);
@@ -1377,8 +1385,21 @@
if (sym_addr != 0) {
INFO("HYBRIS: '%s' hooked symbol %s to %x\n", si->name,
sym_name, sym_addr);
+#ifdef WANT_ARM_TRACING
+ s = _do_lookup(si, sym_name, &base);
+ if(s != NULL) {
+ switch(ELF32_ST_TYPE(s->st_info))
+ {
+ case STT_FUNC:
+ case STT_GNU_IFUNC:
+ case STT_ARM_TFUNC:
+ sym_addr = (unsigned)_create_wrapper(sym_name, (void*)sym_addr, WRAPPER_HOOKED);
+ break;
+ }
+ }
+#endif
} else {
- s = _do_lookup(si, sym_name, &base);
+ s = _do_lookup(si, sym_name, &base);
}
if(sym_addr == 0) {
if(s == NULL) {
@@ -1447,7 +1468,22 @@
return -1;
}
#endif
+#ifdef WANT_ARM_TRACING
+ switch(ELF32_ST_TYPE(s->st_info))
+ {
+ case STT_FUNC:
+ case STT_GNU_IFUNC:
+ case STT_ARM_TFUNC:
+ sym_addr = (unsigned)_create_wrapper(sym_name,
+ (unsigned)(s->st_value + base), WRAPPER_UNHOOKED);
+ break;
+ default:
+ sym_addr = (unsigned)(s->st_value + base);
+ break;
+ }
+#else
sym_addr = (unsigned)(s->st_value + base);
+#endif
}
}
COUNT_RELOC(RELOC_SYMBOL);
@@ -2388,5 +2424,8 @@
#endif
(void) sdk_version;
_get_hooked_symbol = get_hooked_symbol;
+#ifdef WANT_ARM_TRACING
+ _create_wrapper = create_wrapper;
+#endif
_linker_enable_gdb_support = enable_linker_gdb_support;
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.40.tar.bz2/libhybris/hybris/common/wrapper_code.h
^
|
@@ -22,7 +22,10 @@
extern "C" {
#endif
-void wrapper_code_generic() __attribute__((naked,noinline));
+void wrapper_code_generic() __attribute__((naked,noinline)) __attribute__((target("arm")));
+#ifdef __arm__
+void wrapper_code_generic_thumb() __attribute__((naked,noinline)) __attribute__((target("thumb")));
+#endif
#ifdef __cplusplus
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.40.tar.bz2/libhybris/hybris/common/wrapper_code_generic_arm.c
^
|
@@ -137,3 +137,32 @@
);
#endif
}
+
+#ifdef __arm__
+void
+wrapper_code_generic_thumb()
+{
+ // we can never use r0-r11, neither the stack
+ asm volatile(
+ // preserve the registers
+ "push {r0-r11, lr}\n"
+
+ "ldr r0, tfun\n" // load the function pointer to r0
+ "ldr r1, tname\n" // load the address of the functions name to r1
+ "ldr r2, tstr\n" // load the string to print
+ "ldr r4, ttc\n" // load the address of trace_callback to r4
+ "blx r4\n" // call trace_callback
+
+ // restore the registers
+ "pop {r0-r11, lr}\n"
+ "ldr pc, tfun\n" // jump to function
+
+ // dummy instructions, this is where we locate our pointers
+ "tname: .word 0xFFFFFFFF\n" // name of function to call
+ "tfun: .word 0xFFFFFFFF\n" // function to call
+ "ttc: .word 0xFFFFFFFF\n" // address of trace_callback
+ "tstr: .word 0xFFFFFFFF\n" // the string being printed in trace_callback
+ );
+}
+#endif
+
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.40.tar.bz2/libhybris/hybris/common/wrappers.c
^
|
@@ -107,6 +107,15 @@
#endif
void *wrapper_addr = NULL;
int helper = 0;
+ int thumb_fixup = 0;
+
+#ifdef __arm__
+ if ((uint32_t)function & 1) {
+ // thumb
+ wrapper_code = (void*)((uint32_t)wrapper_code_generic_thumb & 0xFFFFFFFE);
+ thumb_fixup = 1;
+ }
+#endif
const char *msg = NULL;
@@ -176,7 +185,7 @@
register_wrapper(wrapper_addr, wrapper_size, symbol, wrapper_type);
- return (void*)wrapper_addr;
+ return (void*)wrapper_addr + thumb_fixup;
}
void release_all_wrappers()
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.40.tar.bz2/libhybris/hybris/egl/platforms/wayland/wayland_window.cpp
^
|
@@ -26,6 +26,7 @@
#include <android-config.h>
+#include <hardware/gralloc.h>
#include "wayland_window.h"
#include "wayland-egl-priv.h"
#include <assert.h>
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.40.tar.bz2/libhybris/hybris/gralloc/gralloc.c
^
|
@@ -1,3 +1,4 @@
+#include <android-config.h>
#include <stdlib.h>
#include <hardware/hardware.h>
@@ -12,7 +13,6 @@
#ifdef ANDROID_BUILD
#include "hybris-gralloc.h"
#else
-#include <android-config.h>
#include <hybris/gralloc/gralloc.h>
#include <hybris/common/binding.h>
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.40.tar.bz2/libhybris/hybris/include/hybris/gralloc/gralloc.h
^
|
@@ -5,13 +5,8 @@
extern "C" {
#endif
-// for usage definitions and so on
-#if HAS_GRALLOC1_HEADER
-#include <hardware/gralloc1.h>
-#endif
-#include <hardware/gralloc.h>
-
#include <cutils/native_handle.h>
+#include <system/window.h>
void hybris_gralloc_deinitialize(void);
void hybris_gralloc_initialize(int framebuffer);
|