aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/wasm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bruiser/wasm.c13
-rw-r--r--bruiser/wasm.h1
-rwxr-xr-xbruiser/wasm/parse.py7
-rw-r--r--bruiser/wasmtablegen.json2
4 files changed, 6 insertions, 17 deletions
diff --git a/bruiser/wasm.c b/bruiser/wasm.c
index c517269..689083a 100644
--- a/bruiser/wasm.c
+++ b/bruiser/wasm.c
@@ -22,20 +22,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*
#include "./lua-5.3.4/src/lauxlib.h"
#include "./lua-5.3.4/src/lualib.h"
#include "./wasm.h"
+#include <Python.h>
/**********************************************************************************************************************/
-static Wasm_Module* convert_wasm_module(lua_State* ls, int index) {
- Wasm_Module* dummy = lua_touserdata(ls, index);
- if (dummy == NULL) {printf("convert_wasm_module: bad userdata.\n");}
- return dummy;
-}
-static Wasm_Module* check_wasm_module(lua_State* ls, int index) {
- Wasm_Module* dummy;
- luaL_checktype(ls, index, LUA_TUSERDATA);
- dummy = (Wasm_Module*)luaL_checkudata(ls, index, "wasm_module");
- if (dummy == NULL) {printf("check_wasm_module: bad userdata.\n");}
- return dummy;
-}
#pragma weak main
int main(int argc, char** argv) {
diff --git a/bruiser/wasm.h b/bruiser/wasm.h
index 5c21c99..7a716ba 100644
--- a/bruiser/wasm.h
+++ b/bruiser/wasm.h
@@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*
#include "./lua-5.3.4/src/lua.h"
#include "./lua-5.3.4/src/lauxlib.h"
#include "./lua-5.3.4/src/lualib.h"
+//#include <Python.h>
#ifdef __cplusplus
extern "C" {
diff --git a/bruiser/wasm/parse.py b/bruiser/wasm/parse.py
index 424a2b6..9d7140d 100755
--- a/bruiser/wasm/parse.py
+++ b/bruiser/wasm/parse.py
@@ -25,14 +25,12 @@ class ParsedStruct:
self.version_number = int()
self.section_list = []
-
# like the above. currently unused
class ParsedStructV2:
def __init__(self, version_number, section_list):
self.version_number = version_number
self.section_list = section_list
-
# @DEVI-Deprecated-convert a bytearray to int
def Conver2Int(little_endian, size, bytelist):
modifier = size - 1
@@ -971,6 +969,7 @@ def premain(argparser):
if argparser.args.wasm:
for file_path in argparser.args.wasm:
module = interpreter.parse(file_path)
+ print(type(module))
interpreter.appendmodule(module)
if argparser.args.dbg or argparser.args.dbgsection:
interpreter.dump_sections(module, argparser.args.dbgsection)
@@ -988,8 +987,8 @@ def premain(argparser):
DumpLinearMems(ms.Linear_Memory, argparser.getMEMDUMP())
if argparser.args.run:
vm.run()
- # merklizer = Merklizer(ms.Linear_Memory[0][0:512], module)
- # treelength, hashtree = merklizer.run()
+ #merklizer = Merklizer(ms.Linear_Memory[0][0:512], module)
+ #treelength, hashtree = merklizer.run()
if argparser.args.interactive:
variables = globals().copy()
diff --git a/bruiser/wasmtablegen.json b/bruiser/wasmtablegen.json
index 38fe5a7..cb7899c 100644
--- a/bruiser/wasmtablegen.json
+++ b/bruiser/wasmtablegen.json
@@ -15,7 +15,7 @@
"W_Import_Section_Entry":
{"field_name":["module_length", "module_str", "field_len", "field_str", "kind", "type"], "field_type":["varuint32", "char*", "varuint32", "char*", "enum external_kind_t", "void*"], "lua_type": ["integer", "string", "integer", "string", "integer", "lightuserdata"], "methods": ["convert", "check", "push_self", "push_args", "new"]},
"W_Import_Section":
- {"field_name":["count", "entries"], "field_type":["varuint32","W_Import_Section**"], "lua_type":["integer", "lightuserdata"], "methods":["convert", "check", "push_self", "push_args", "new"]},
+ {"field_name":["count", "entries"], "field_type":["varuint32","W_Import_Section_Entry**"], "lua_type":["integer", "lightuserdata"], "methods":["convert", "check", "push_self", "push_args", "new"]},
"W_Function_Section":
{"field_name":["count", "types"], "field_type":["varuint32", "varuint32*"], "lua_type":["integer", "lightuserdata"], "methods":["convert", "check", "push_self", "push_args", "new"]},
"W_Table_Section":