All Projects → evoasm → kasm

evoasm / kasm

Licence: MPL-2.0 license
Assembler library for Kotlin

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to kasm

Rappel
A linux-based assembly REPL for x86, amd64, armv7, and armv8
Stars: ✭ 818 (+1945%)
Mutual labels:  x64, x86-64, asm, x86
Asm Cli
Interactive shell of assembly language(X86/X64) based on unicorn and keystone
Stars: ✭ 211 (+427.5%)
Mutual labels:  x64, x86-64, asm, x86
Asm Cli Rust
interative assembly shell written in rust
Stars: ✭ 133 (+232.5%)
Mutual labels:  x64, asm, x86
The holy book of x86
A simple guide to x86 architecture, assembly, memory management, paging, segmentation, SMM, BIOS....
Stars: ✭ 577 (+1342.5%)
Mutual labels:  x86-64, asm, x86
Reloaded.Assembler
Minimal .NET wrapper around the simple, easy to use Flat Assembler written by Tomasz Grysztar. Supports both x64 and x86 development.
Stars: ✭ 17 (-57.5%)
Mutual labels:  x64, x86-64, x86
oberon-07-compiler
Oberon-07 compiler for x64 (Windows, Linux), x86 (Windows, Linux, KolibriOS), MSP430x{1,2}xx, STM32 Cortex-M3
Stars: ✭ 45 (+12.5%)
Mutual labels:  x64, x86-64, x86
X64dbg
An open-source x64/x32 debugger for windows.
Stars: ✭ 37,825 (+94462.5%)
Mutual labels:  x64, x86-64, x86
Capstone.NET
.NET Core and .NET Framework binding for the Capstone Disassembly Framework
Stars: ✭ 108 (+170%)
Mutual labels:  x64, x86-64, x86
profiler-api
The portable version of JetBrains profiler API for .NET Framework / .NET Core / .NET / .NET Standard / Mono
Stars: ✭ 21 (-47.5%)
Mutual labels:  x64, x86-64, x86
Labeless
Labeless is a multipurpose IDA Pro plugin system for labels/comments synchronization with a debugger backend, with complex memory dumping and interactive Python scripting capabilities.
Stars: ✭ 378 (+845%)
Mutual labels:  x64, x86-64, x86
Asm
Assembly Tutorial for DOS
Stars: ✭ 125 (+212.5%)
Mutual labels:  x64, x86-64, x86
Beelzebub
The Lord of Flies - A hobby operating system
Stars: ✭ 24 (-40%)
Mutual labels:  x64, x86-64, x86
X86 Bare Metal Examples
Dozens of minimal operating systems to learn x86 system programming. Tested on Ubuntu 17.10 host in QEMU 2.10 and real hardware. Userland cheat at: https://github.com/cirosantilli/linux-kernel-module-cheat#userland-assembly ARM baremetal setup at: https://github.com/cirosantilli/linux-kernel-module-cheat#baremetal-setup 学习x86系统编程的数十个最小操作系统。 已在QE…
Stars: ✭ 3,985 (+9862.5%)
Mutual labels:  x64, x86-64, x86
Distorm
Powerful Disassembler Library For x86/AMD64
Stars: ✭ 829 (+1972.5%)
Mutual labels:  x64, x86-64, x86
8086-cheatsheet
8086 Microprocessor Cheat sheet with Programs
Stars: ✭ 81 (+102.5%)
Mutual labels:  x64, asm, x86
Xray 16
Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World. Join OpenXRay! ;)
Stars: ✭ 1,806 (+4415%)
Mutual labels:  x64, x86
Dbgchild
Debug Child Process Tool (auto attach)
Stars: ✭ 145 (+262.5%)
Mutual labels:  x64, x86
Xray 15
X-Ray Engine 1.5 expansion. Original version was used in S.T.A.L.K.E.R.: Clear Sky.
Stars: ✭ 151 (+277.5%)
Mutual labels:  x64, x86
APISearch-Plugin-x86
APISearch Plugin (x86) - A Plugin For x64dbg
Stars: ✭ 46 (+15%)
Mutual labels:  asm, x86
DbgChild
Debug Child Process Tool (auto attach)
Stars: ✭ 221 (+452.5%)
Mutual labels:  x64, x86

Kasm

Kasm is a runtime assembler library for Kotlin. It allows to assemble and execute machine code at runtime.

Features

  • x86-64 up to AVX2
  • Allows save code execution, handling segmentation faults and zero divisions etc.
  • Support for automatic CPU feature detection (see CpuId)
  • Contains a Kotlin DSL (see Assembler)
  • Supports disassembling (through Capstone)
  • Full control over encoding (see EncodingOptions):
    • Encode with or without SIB (if possible)
    • Force REX prefix
    • Use long or short VEX prefix
    • Set unused bits in Mod.RM/REX/VEX
    • Legacy prefix order

Installation

$ git clone --recursive https://github.com/evoasm/kasm

The project does currently come without any build files. It is recommended that you import the project into IntelliJ IDEA.

Requirements

  • Kotlin/JVM
  • Capstone for disassembling (optional).
  • POSIX-compliant OS (Linux and Mac OS X should both work).
  • CMake (see below, optional)

If you want support for code execution and disassembling (through Capstone) you must build the corresponding native modules

$ cd kasm-native/lib
$ mkdir build
$ cd build
$ cmake ..

Shared libraries are output to kasm-native/lib. If you get a UnsatisfiedLinkError exception add -Djava.library.path=../kasm-native/lib to your VM options.

Examples

Assembler

val buffer = NativeBuffer(1024)
  
Assembler(buffer).emitStackFrame {
  mov(RBX, 0)
  mov(RAX, 0)
  divRdxRax(RBX)
}
  
buffer.execute() // will throw kasm.ZeroDivisionException
Assembler(buffer).emitStackFrame {
  mov(RBX, AddressExpression(0x0))
}
  
buffer.execute() // will throw kasm.SegmentationFaultException

Instruction

val buffer = NativeBuffer(1024)
  
// add eax, [ebx]
AddR32Rm32.encode(buffer, EAX, AddressExpression32(EBX))
  
// add [ebx], eax
AddRmR32.encode(buffer, AddressExpression32(EBX), EAX)

CpuId

println(CpuId.features) // [SEP, CLFSH, DS, ACPI, SSE, SSE2, SS, ...

EncodingOptions

AddRm32Imm32.encode(buffer, EAX, 0x10, options = EncodingOptions(rexX = 0x0, forceRex = true))
println(buffer.toByteString()) //40 81 C0 10 00 00 00
  
AddRm32Imm32.encode(buffer, EAX, 0x10, options = EncodingOptions(rexX = 0x1, forceRex = true))
println(buffer.toByteString()) //42 81 C0 10 00 00 00

License

MPL-2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].