diff --git a/bindings/go/unicorn/uc.c b/bindings/go/unicorn/uc.c index d21e66fa..1f88c182 100644 --- a/bindings/go/unicorn/uc.c +++ b/bindings/go/unicorn/uc.c @@ -23,3 +23,7 @@ uc_err uc_reg_write_batch_helper(uc_engine *handle, int *regs, uint64_t *val_in, free(val_ref); return ret; } + +uc_err uc_ctl_set_cpu_model_helper(uc_engine *handle, int model) { + return uc_ctl_set_cpu_model(handle, model); +} diff --git a/bindings/go/unicorn/uc.h b/bindings/go/unicorn/uc.h index 06022346..f9bbfcf1 100644 --- a/bindings/go/unicorn/uc.h +++ b/bindings/go/unicorn/uc.h @@ -1,2 +1,3 @@ uc_err uc_reg_read_batch_helper(uc_engine *handle, int *regs, uint64_t *val_out, int count); uc_err uc_reg_write_batch_helper(uc_engine *handle, int *regs, uint64_t *val_in, int count); +uc_err uc_ctl_set_cpu_model_helper(uc_engine *handle, int model); diff --git a/bindings/go/unicorn/unicorn.go b/bindings/go/unicorn/unicorn.go index ba679e06..50b221ad 100644 --- a/bindings/go/unicorn/unicorn.go +++ b/bindings/go/unicorn/unicorn.go @@ -62,6 +62,7 @@ type Unicorn interface { Handle() *C.uc_engine RegWriteX86Msr(reg uint64, val uint64) error RegReadX86Msr(reg uint64) (uint64, error) + SetCPUModel(model int) error } type uc struct { @@ -233,3 +234,8 @@ func (u *uc) Query(queryType int) (uint64, error) { func (u *uc) Handle() *C.uc_engine { return u.handle } + +func (u *uc) SetCPUModel(model int) error { + ucerr := C.uc_ctl_set_cpu_model_helper(u.handle, C.int(model)) + return errReturn(ucerr) +}