From 13a4c303d42f36fa578d7e069c4851b578447db2 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Mon, 16 Dec 2024 12:58:12 +0800 Subject: [PATCH] selftest: allocate initial stack memory --- slothy/helper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slothy/helper.py b/slothy/helper.py index 6788b492..0c3e4b8f 100644 --- a/slothy/helper.py +++ b/slothy/helper.py @@ -1314,8 +1314,8 @@ def run_code(code, txt=None): # If we expect a function return, put a valid address in the LR # that serves as the marker to terminate emulation mu.reg_write(config.arch.RegisterType.unicorn_link_register(), CODE_END) - # Setup stack - mu.reg_write(config.arch.RegisterType.unicorn_stack_pointer(), STACK_TOP) + # Setup stack and allocate allocate initial stack memory + mu.reg_write(config.arch.RegisterType.unicorn_stack_pointer(), STACK_TOP - config.selftest_default_memory_size) # Copy code into emulator mu.mem_map(CODE_BASE, CODE_SZ) mu.mem_write(CODE_BASE, objcode)