Giter Site home page Giter Site logo

asmtk's Introduction

AsmJit

AsmJit is a lightweight library for machine code generation written in C++ language.

See asmjit.com page for more details, examples, and documentation.

Documentation

Contributing

Breaking Changes

Breaking the API is sometimes inevitable, what to do?

Project Organization

  • / - Project root
    • src - Source code
      • asmjit - Source code and headers (always point include path in here)
        • core - Core API, backend independent except relocations
        • arm - ARM specific API, used only by ARM and AArch64 backends
        • x86 - X86 specific API, used only by X86 and X64 backends
    • test - Unit and integration tests (don't embed in your project)
    • tools - Tools used for configuring, documenting, and generating files

Ports

  • 32-bit ARM/Thumb port (work in progress)
  • RISC-V port (not in progress, help welcome)

Support

Notable Donors List:

Authors & Maintainers

asmtk's People

Contributors

acidicoala avatar jdpatdiscord avatar justanotheranonymoususer avatar kobalicek avatar mrexodia avatar steverman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asmtk's Issues

Syntax is not fully compatible

"push [ecx]" needs to be changed to "push dword [ecx]" to be compiled,

In addition, if "AsmParser:: parse" has errors in multiple lines of code, you need to delete them one line at a time to eliminate the errors. No line number or error location is returned.

Labels problem

int main( int argc , char** argv )
{
	CodeInfo ci( ArchInfo::kTypeX64 );
	CodeHolder code;
	code.init( ci );

	X86Assembler a( &code );
	AsmParser p( &a );

	Error err = p.parse(
		"call label0\n" // label god
		"nop\n"
		"ret\n"
		"label0:\n"
		"call label1\n" // label error
		"nop\n"
		"ret\n"
		"label1:\n"
		"nop\n"
		"ret\n"
	);

	if ( err )
	{
		printf( "ERROR: %08x (%s)\n" , err , DebugUtils::errorAsString( err ) );
		getchar();
		return 0;
	}

	code.sync();

	CodeBuffer& buffer = code.getSectionEntry( 0 )->getBuffer();
	dumpCode( buffer.getData() , buffer.getLength() );

	printf( "code: %p\n" , buffer.getData() );
	printf( "getLabelsCount: %i\n" , code.getLabelsCount() );
}

output:
E80200000090C3E80404040490C390C3
getCodeSize: 16
getLabelsCount: 3

000002E950F0E9A0     | E8 02 00 00 00                          | call 2E950F0E9A7                             |
000002E950F0E9A5     | 90                                      | nop                                          |
000002E950F0E9A6     | C3                                      | ret                                          |
000002E950F0E9A7     | E8 04 04 04 04                          | call 2E954F4EDB0                             |
000002E950F0E9AC     | 90                                      | nop                                          |
000002E950F0E9AD     | C3                                      | ret                                          |
000002E950F0E9AE     | 90                                      | nop                                          |
000002E950F0E9AF     | C3                                      | ret                                          |

X64 MOV RSP,8 why mov esp,8

x64dbg
// XED
00007FFC9220063A | 48:C7C4 08000000 | mov rsp,8 |
//ASMJIT
00007FFC92200641 | BC 08000000 | mov esp,8 |

push register not working!

sentences like push eax , or pushad not parse but push 0x11111111 works fine.
it say "Invalid instruction" error.
can someone help me??

MSVC compiler warnings

Getting the following warnings when building on 64 bit MSVC:

asmtk\asmparser.cpp(1075,9): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data
asmtk\asmparser.cpp(1152,39): warning C4267: 'initializing': conversion from 'size_t' to 'uint32_t', possible loss of data

That's these 2 lines:

ASMJIT_PROPAGATE(_emitter->embed(db.data(), db.size()));

uint32_t size = tmp.size;

"db" instruction: 0000001b (InvalidInstruction)

Hi, there is an error when using the "db" command. How do I use the "db" command correctly, thank you

This is my code:

#include <iostream>
#include <asmjit/asmjit.h>
#include <asmtk/asmtk.h>

using namespace asmjit;
using namespace asmtk;

int main(int argc, char* argv[]) {
  Environment env = hostEnvironment();
  CodeHolder code;
  code.init(env);

  x86::Assembler a(&code);
  AsmParser p(&a);

  Error err = p.parse(
    "main:\n"
    "db 0x90 0x90 0x90 0x90 0x90\n"
  );

  if (err) {
    printf("ERROR: %08x (%s)\n", err, DebugUtils::errorAsString(err));
    return 1;
  }

  printf("%p\n", a.bufferData());
  getchar();
  return 0;
}

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.