Coder Social home page Coder Social logo

indigos33k3r / unicorn.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexaltea/unicorn.js

0.0 0.0 0.0 15.2 MB

Unicorn CPU emulator framework port for JavaScript

Home Page: https://alexaltea.github.io/unicorn.js/

JavaScript 35.56% Python 10.09% HTML 24.41% C 29.94%

unicorn.js's Introduction

Unicorn.js

Last Release

Port of the Unicorn CPU emulator framework for JavaScript. Powered by Emscripten.

Notes: Unicorn is a lightweight multi-architecture CPU emulator framework originally developed by Nguyen Anh Quynh, Dang Hoang Vu et al. and released under GPLv2 license. More information about contributors and license terms can be found in the files AUTHORS.TXT, CREDITS.TXT and COPYING inside the unicorn submodule of this repository.

Installation

To add Unicorn.js to your web application, include it with:

<script src="unicorn.min.js"></script>

or install it with the Bower command:

bower install unicornjs

Usage

var addr = 0x10000;
var code = [
  0x37, 0x00, 0xA0, 0xE3,  // mov r0, #0x37
  0x03, 0x10, 0x42, 0xE0,  // sub r1, r2, r3
];

// Initialize engine
var e = new uc.Unicorn(uc.ARCH_ARM, uc.MODE_ARM);

// Write registers and memory
e.reg_write_i32(uc.ARM_REG_R2, 0x456);
e.reg_write_i32(uc.ARM_REG_R3, 0x123);
e.mem_map(addr, 4*1024, uc.PROT_ALL);
e.mem_write(addr, code)

// Start emulator
var begin = addr;
var until = addr + code.length;
e.emu_start(begin, until, 0, 0);

// Read registers
var r0 = e.reg_read_i32(uc.ARM_REG_R0);  // 0x37
var r1 = e.reg_read_i32(uc.ARM_REG_R1);  // 0x333

Building

To build the Unicorn.js library, clone the master branch of this repository on a Linux machine, and do the following:

  1. Initialize the original Unicorn submodule: git submodule update --init.

  2. Install the latest Python 2.x (64-bit) and the Emscripten SDK 1.37.9+. Follow the respective instructions and make sure all environment variables are configured correctly.

  3. Install the development dependencies with: npm install.

  4. Finally, build the source with: grunt build.

unicorn.js's People

Contributors

alexaltea avatar typoon avatar 0xdec avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.