diff options
author | Damjan Marion <damarion@cisco.com> | 2021-10-31 19:06:20 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-11-02 04:42:21 +0000 |
commit | 97475fdebf6e55cbcce4807f1bbd8493d9d13c20 (patch) | |
tree | 55e1921a23a1c4bda01755baf4f4705c46c55c1c /src/vppinfra | |
parent | 26abb607149315054b6d41de09f262890384ac3d (diff) |
vppinfra: fix calljmp test
Change-Id: Id1b380880c6509d983727f6fb57e7db97e66655a
Type: fix
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r-- | src/vppinfra/test_longjmp.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/vppinfra/test_longjmp.c b/src/vppinfra/test_longjmp.c index 01debe2ac37..50dc24b48b0 100644 --- a/src/vppinfra/test_longjmp.c +++ b/src/vppinfra/test_longjmp.c @@ -82,27 +82,25 @@ test_longjmp_main (unformat_input_t * input) static uword f3 (uword arg) { - uword i, j, array[10]; - - for (i = 0; i < ARRAY_LEN (array); i++) - array[i] = arg + i; - - j = 0; - for (i = 0; i < ARRAY_LEN (array); i++) - j ^= array[i]; - - return j; + return (uword) __builtin_frame_address (0); } static void test_calljmp (unformat_input_t * input) { - static u8 stack[32 * 1024] __attribute__ ((aligned (16))); - uword v; + u8 stack[4096] __attribute__ ((aligned (16))) = {}; + uword start, end, v; + + start = pointer_to_uword (stack); + end = start + ARRAY_LEN (stack); + + v = f3 (0); + if (!(v < start || v > end)) + clib_panic ("something went wrong in the calljmp test"); v = clib_calljmp (f3, 0, stack + sizeof (stack)); - ASSERT (v == f3 (0)); - if_verbose ("calljump ok"); + if_verbose ("calljump %s", + v >= start && v < (end - sizeof (uword)) ? "ok" : "fail"); } #ifdef CLIB_UNIX |