unicorn/bindings/go
kj.xwings.l 038b4f3345
Removed hardcoded CP0C3_ULRI (#1098)
* activate CP0C3_ULRI for CONFIG3, mips

* updated with mips patches

* updated with mips patches

* remove hardcoded config3

* git ignore vscode

* fix spacing issue and turn on floating point

Backports most of commit 24f55a7973278f20f0de21b904851d99d4716263 from
unicorn. Ignores internal core modifications, as this would be
special-casing non-upstreamed behavior.
2019-08-08 20:08:57 -04:00
..
unicorn Removed hardcoded CP0C3_ULRI (#1098) 2019-08-08 20:08:57 -04:00
Makefile Make cleanup (#666) 2016-11-19 17:17:48 +08:00
README.md add Go README and sample.go 2015-10-13 19:41:55 -07:00
sample.go Go bindings: fix HookAdd in sample 2016-04-07 12:09:26 -07:00

To download/update the Unicorn Go bindings, run:

go get -u github.com/unicorn-engine/unicorn/bindings/go

A very basic usage example follows

(Does not handle most errors for brevity. Please see sample.go for a more hygenic example):

package main

import (
    "fmt"
    uc "github.com/unicorn-engine/unicorn/bindings/go/unicorn"
)

func main() {
    mu, _ := uc.NewUnicorn(uc.ARCH_X86, uc.MODE_32)
    // mov eax, 1234
    code := []byte{184, 210, 4, 0, 0}
    mu.MemMap(0x1000, 0x1000)
    mu.MemWrite(0x1000, code)
    if err := mu.Start(0x1000, 0x1000+uint64(len(code))); err != nil {
        panic(err)
    }
    eax, _ := mu.RegRead(uc.X86_REG_EAX)
    fmt.Printf("EAX is now: %d\n", eax)
}

An example program exercising far more Unicorn functionality and error handling can be found in sample.go.