about summary refs log tree commit diff homepage
path: root/lib/Core
diff options
context:
space:
mode:
authorPavel <operasfantom@gmail.com>2022-03-29 12:03:02 +0400
committerCristian Cadar <c.cadar@imperial.ac.uk>2022-07-24 15:40:15 +0100
commitc9de012b07426435b8bd3bb29082fbceddf403a3 (patch)
tree98a388118509085e7e62f5f2361f19fd3fa46870 /lib/Core
parent64dfbcd7073e0286e8c0145e1750f9fe3abc7565 (diff)
downloadklee-c9de012b07426435b8bd3bb29082fbceddf403a3.tar.gz
Support arguments of width 128, 256 and 512 bits for external calls
Diffstat (limited to 'lib/Core')
-rw-r--r--lib/Core/Executor.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 42405982..6fad8830 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -3810,11 +3810,13 @@ void Executor::callExternalFunction(ExecutionState &state,
   }
 
   // normal external function handling path
-  // allocate 128 bits for each argument (+return value) to support fp80's;
+  // allocate 512 bits for each argument (+return value) to support
+  // fp80's and SIMD vectors as parameters for external calls;
   // we could iterate through all the arguments first and determine the exact
   // size we need, but this is faster, and the memory usage isn't significant.
-  uint64_t *args = (uint64_t*) alloca(2*sizeof(*args) * (arguments.size() + 1));
-  memset(args, 0, 2 * sizeof(*args) * (arguments.size() + 1));
+  size_t allocatedBytes = Expr::MaxWidth / 8 * (arguments.size() + 1);
+  uint64_t *args = (uint64_t*) alloca(allocatedBytes);
+  memset(args, 0, allocatedBytes);
   unsigned wordIndex = 2;
   for (std::vector<ref<Expr> >::iterator ai = arguments.begin(), 
        ae = arguments.end(); ai!=ae; ++ai) {