mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-23 03:53:43 +01:00
(MAX_FUNC_SIZE): New macro.
(main): Use MAX_FUNC_SIZE instead of open-coding 256 bytes. (Logical change 1.210)
This commit is contained in:
parent
18617ecf2c
commit
c9a01bf094
1 changed files with 5 additions and 3 deletions
|
@ -34,6 +34,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|||
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define MAX_FUNC_SIZE 2048 /* max. size of cloned function */
|
||||
|
||||
#define panic(args...) \
|
||||
{ fprintf (stderr, args); exit (-1); }
|
||||
|
||||
|
@ -145,17 +147,17 @@ main (int argc, char *argv[])
|
|||
if (verbose)
|
||||
printf ("old code @ %p, new code @ %p\n", (void *) fdesc.code, mem);
|
||||
|
||||
memcpy (mem, (void *) fdesc.code, 256);
|
||||
memcpy (mem, (void *) fdesc.code, MAX_FUNC_SIZE);
|
||||
mprotect ((void *) ((long) mem & ~(getpagesize () - 1)),
|
||||
2*getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC);
|
||||
flush_cache (mem, 256);
|
||||
flush_cache (mem, MAX_FUNC_SIZE);
|
||||
|
||||
signal (SIGSEGV, sighandler);
|
||||
|
||||
/* register the new function: */
|
||||
region = alloca (_U_dyn_region_info_size (2));
|
||||
region->next = NULL;
|
||||
region->insn_count = 256;
|
||||
region->insn_count = 3 * (MAX_FUNC_SIZE / 16);
|
||||
region->op_count = 2;
|
||||
_U_dyn_op_alias (®ion->op[0], 0, -1, fdesc.code);
|
||||
_U_dyn_op_stop (®ion->op[1]);
|
||||
|
|
Loading…
Reference in a new issue