Skip to content

Basic assembler which (currently) supports most x64 instructions, including the AVX and AVX-512 extensions.

License

Notifications You must be signed in to change notification settings

Goubermouche/baremetal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

baremetal Tests (ubuntu-latest)

Basic x64 assembler which currently supports the majority of x64 instructions, including pretty much all extensions as specified by the Intel® 64 and IA-32 Architectures Software Developer’s Manual. Additionally, it also supports out-of-order definition with optimal instruction selection (pretty much 1-to-1 with Nasm), as well as labels, and memory defines.

Getting up and running

Get started by running:

# clone the repository
$ git clone https://github.com/Goubermouche/baremetal.git --recursive
$ cd baremetal

# generate build files using premake5 (see premake5 targets for more info)
$ premake5 gmake  

# compile the project using gmake and run tests
$ make
$ ./output/bin/test_runner/test_runner

You can find some basic examples in the test directory.

Project structure

- source       # assembler source directory
  |- assembler # source code for the assembler implementation
  `- tests     # test runners and test cases
- tools        # utilities used for managing the instruction database and tests
  `- scripts   # implementations of the utility programs

To achieve overall correctness, the project utilizes a variety of tests, some of which may need to be regenerated once breaking changes to the instruction database are introduced.

Important

baremetal invokes Nasm when generating encoding tests, depending on the number of instructions the test generation process may take up to 30 minutes.

The following commands are intended to be used to aid the developer when manipulating the instruction database:

./tools/regenerate.sh        # invokes the table_generator and convert_db scripts
./tools/test_generator.sh    # generates a series of instruction tests based off of the contents of ./tools/scripts/db.json
./tools/list_instructions.sh # lists statistics about the current instruction set

./tools/table_generator.sh   # regenerates database tables used by the main baremetal project 
./tools/convert_db.sh        # converts ./tools/scripts/asmjit_db.json into the format used by baremetal

Planned

  • Executable/binary emission
  • Optional type prefixes
  • Better support for memory operands with SSE registers
  • Better error checking

Acknowledgements

  • The original instruction database has been ported from the AsmJit project, although it has been slightly modified.
  • Massive thanks to Martins, ratchetfreak, codaaaaaa, and others from the HMN for guiding me through the pitfalls of x86/64.

About

Basic assembler which (currently) supports most x64 instructions, including the AVX and AVX-512 extensions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages