From c9a01bf094192594f3cae1c5ff5ab116f00ea635 Mon Sep 17 00:00:00 2001 From: "hp.com!davidm" Date: Wed, 21 Apr 2004 23:46:17 +0000 Subject: [PATCH] (MAX_FUNC_SIZE): New macro. (main): Use MAX_FUNC_SIZE instead of open-coding 256 bytes. (Logical change 1.210) --- tests/Gtest-dyn1.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/Gtest-dyn1.c b/tests/Gtest-dyn1.c index fa63a3c5..5e3f1a3f 100644 --- a/tests/Gtest-dyn1.c +++ b/tests/Gtest-dyn1.c @@ -34,6 +34,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#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]);