1
0
Fork 0

Create asm.py

This commit is contained in:
Ariel 2024-02-11 16:02:26 +08:00 committed by GitHub
parent bed945a17f
commit 91bc014b66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

14
asm.py Normal file
View File

@ -0,0 +1,14 @@
import time
from ctypes import *
import mmap
buf=mmap.mmap(-1,mmap.PAGESIZE,prot=mmap.PROT_READ|mmap.PROT_WRITE|mmap.PROT_EXEC)
def compile_asm_raw(s,ftype):
buf.write(s)
return ftype(addressof(c_void_p.from_buffer(buf)))
#https://gcc.godbolt.org/
#https://defuse.ca/online-x86-assembler.htm
#order: edi,esi,edx,ecx,r8d
asm_solve=compile_asm_raw(b"", CFUNCTYPE(c_void_p, POINTER(c_int), c_int, c_int, POINTER(c_int)))