A hastily cobbled together mess for starting development of Web Assembly IDE backend leveraging existing C code.

Compile via: gcc -ggdb -shared -Wl,-soname,libvm.so -o libvm.so -fPIC wrapper.c vm_instructions.c vm.h
Probably should use it to clean up a few things
This commit is contained in:
Jeremiah Orians 2016-07-20 20:36:46 -04:00
parent a8b228c61e
commit 7bffbe5b3d
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
2 changed files with 1906 additions and 0 deletions

View File

@ -0,0 +1,22 @@
import ctypes
vm = ctypes.CDLL('./libvm.so')
vm.initialize_lilith()
c_s = ctypes.create_string_buffer("foo".encode('ascii'))
vm.load_lilith(c_s)
vm.get_register.argtype = ctypes.c_uint
vm.get_register.restype = ctypes.c_uint
R0 = vm.get_register(3)
print( R0)
vm.get_byte.argtype = ctypes.c_uint
vm.get_byte.restype = ctypes.c_ubyte
for i in range(0, 20):
print(vm.get_byte(i))
vm.get_memory.restype = ctypes.c_char_p
print( (vm.get_memory()).decode('utf-8'))

1884
wrapper.c Normal file

File diff suppressed because it is too large Load Diff