All Projects → kframework → X86 64 Semantics

kframework / X86 64 Semantics

Licence: other
Semantics of x86-64 in K

Programming Languages

assembly
5116 projects

Labels

Projects that are alternatives of or similar to X86 64 Semantics

Cuteos
A 64-bit SMP-safe kernel for the PC architecture.
Stars: ✭ 51 (-52.78%)
Mutual labels:  x86-64
Chrysalisp
Parallel OS, with GUI, Terminal, OO Assembler, Class libraries, C-Script compiler, Lisp interpreter and more...
Stars: ✭ 1,205 (+1015.74%)
Mutual labels:  x86-64
Axel
Operating System
Stars: ✭ 96 (-11.11%)
Mutual labels:  x86-64
Mir
A light-weight JIT compiler based on MIR (Medium Internal Representation)
Stars: ✭ 1,075 (+895.37%)
Mutual labels:  x86-64
Wassm
Web framework for x86_64 nasm
Stars: ✭ 71 (-34.26%)
Mutual labels:  x86-64
Dgos
Operating System
Stars: ✭ 90 (-16.67%)
Mutual labels:  x86-64
Corefreq
CoreFreq is a CPU monitoring software designed for the 64-bits Processors.
Stars: ✭ 1,026 (+850%)
Mutual labels:  x86-64
Monkos
an experimental 64-bit operating system
Stars: ✭ 100 (-7.41%)
Mutual labels:  x86-64
Univdisasm
x86 Disassembler and Analyzer
Stars: ✭ 74 (-31.48%)
Mutual labels:  x86-64
Pyast64
Compile a subset of the Python AST to x64-64 assembler
Stars: ✭ 93 (-13.89%)
Mutual labels:  x86-64
Fasmg
flat assembler g - examples library
Stars: ✭ 56 (-48.15%)
Mutual labels:  x86-64
Jit Compiler
JIT compiler in Go
Stars: ✭ 70 (-35.19%)
Mutual labels:  x86-64
Evoasm.rb
An AIMGP (Automatic Induction of Machine code by Genetic Programming) engine
Stars: ✭ 91 (-15.74%)
Mutual labels:  x86-64
Dennix
Dennix is a unix-like hobbyist operating system written from scratch.
Stars: ✭ 53 (-50.93%)
Mutual labels:  x86-64
Nextcloudpi
📦 Build code for NextcloudPi: Raspberry Pi, Odroid, Rock64, Docker, curl installer...
Stars: ✭ 1,340 (+1140.74%)
Mutual labels:  x86-64
Binary Exploitation
Good to know, easy to forget information about binaries and their exploitation!
Stars: ✭ 47 (-56.48%)
Mutual labels:  x86-64
Neatcc
A small arm/x86(-64) C compiler
Stars: ✭ 86 (-20.37%)
Mutual labels:  x86-64
X64dbg
An open-source x64/x32 debugger for windows.
Stars: ✭ 37,825 (+34923.15%)
Mutual labels:  x86-64
Erika3
ERIKA Enterprise v3 RTOS
Stars: ✭ 98 (-9.26%)
Mutual labels:  x86-64
Ktf
Kernel Test Framework
Stars: ✭ 93 (-13.89%)
Mutual labels:  x86-64

X86-64 Semantics

The project presents the most complete and thoroughly tested formal semantics of x86-64 to date. Our semantics faithfully formalizes all the non-deprecated, sequential user-level instructions of the x86-64 Haswell instruction set architecture. This totals 3155 instruction variants, corresponding to 774 mnemonics. The semantics is fully executable and has been tested against more than 7,000 instruction-level test cases and the GCC torture test suite.

User Guide

Prerequisites

  • Download X86 semantics defined in K.
git clone https://github.com/kframework/X86-64-semantics.git
  • Download & Install K tool README

NOTE Due to polymorphic sort support, the syntax of machine integers aka MInt has changed a bit and the current x86-64 semantics is not responsive to that. Hence compiling x86-64 semantics using the master k will issue compilation error. Before the x86-64 semantics is ported to the new MInt syntax, it is recommended to

  • Either check out a revision 45a4243af6e4cd42a4212e5c7575e876898ec38b of of the master https://github.com/kframework/k.git branch. The commit hash is just before the aforementioned change.
  • Or use the forked repository of k, which is currently in use and hence recommended.

To compile the x86-64 semantics

cd X86-semantics/semantics
../scripts/kompile.pl --backend java

A simple test run -- Concrete execution of a binary (compiled from a C program)

../scripts/run-single-c-file.sh ../tests/program-tests/bubblesort/test.c java |& tee /tmp/run.log

Testing the semantics

Empowered by the fact that we can directly execute the semantics using the K framework, we validated our model by co-simulating it against a real machine. During co-simulation, we execute a machine program on the processor as well as on our K model and compare the execution results after every instruction. The co-simulation experiments are done in the following two phases:

  1. Instruction level validation: Testing individual instructions
  • Batch testing: All the tests in a directory are fired in parallel. The test-cases are specified in a file named filelist.txt
    cd tests/single-instruction-tests
    ./run-tests.sh --all [--jobs 5]
      // Which subsumes the following sequence of commands
      // ./run-tests.sh --cleankstate // Remove the old krun output logs.
      // ./run-tests.sh --cleanxstate // Remove the old gdb script output logs.
      // ./run-tests.sh --cleancstate //  Remove the old compare logs
      // ./run-tests.sh --kstate      // Collect the semantics of all the
                                      // instructions composing all the
                                      // test-cases, Compile the X86 semantics
                                      // using the collected instruction
                                      // semnatics, and Execute krun on each of
                                      // the test-case.
      // ./run-tests.sh --xstate      // Execute dn script and generate logs.
      // ./run-tests.sh --compare     // Compare the krun ad gdb script logs.
    
  • Individual testing: Running each test in isolation.
    cd tests/single-instruction-tests/adc
    make collect  // Collect semantic rules of all the instructions composing
                  // the test-case
    make kompile  // Compile the X86 semantics using the collected instruction
                  // semnatics.
    make cleanktest   //  Remove the old krun output logs.
    make cleanxstate  //  Remove the old gdb script output logs.
    make cleancstate  //  Remove the old compare logs
    make ktest        //  Execute krun on the test-case and generate krun logs.
    make xstate       //  Execute dn script and generate logs.
    make comapre      //  Compare the krun ad gdb script logs.
    
  1. Program level validation: Testing combination of instructions as a part of real-world programs.
cd tests/program-tests
./run-tests.sh --cleankstate
./run-tests.sh --kstate

Developer Guide

Dependency tree of Source Code

Directory structure

  • docs: Hosts miscellaneous documents.
  • program-verification: Hosts few applications of our formal semantics.
  • tests: Hosts test-cases for testing the semantics.
  • scripts: Hosts scripts used for compiling/executing/testing he semantics.
  • semantics: Hosts the semantics of individual instruction and execution environment.
    • Following are the K-definition files specifying the semantics of execution environment.
      • float-conversions.k
      • x86-builtin.k
      • x86-env-init.k
      • x86-flag-checks-syntax.k
      • x86-memory.k
      • x86-syntax.k
      • x86-abstract-semantics.k
      • x86-c-library.k
      • x86-fetch-execute.k
      • x86-mint-wrapper.k
      • x86-verification-lemmas.k
      • x86-abstract-syntax.k
      • x86-configuration.k
      • x86-flag-checks.k
      • x86-loader.k
      • x86-semantics.k
    • Following are the K-definition files specifying the semantics of individual instructions.
      • registerInstructions/*.k: Semantics of register only instructions
      • immediateInstructions/*.k: Semantics of immediate instructions
      • memoryInstructions/*.k: Semantics of memory instructions
      • systemInstructions/*.k: Semantics of system & control flow instructions.
      • extras/*.k: Semantics of instruction having multiple possible representations. For example, movabsq movabsq:Opcode Imm64:Imm, R2:R64 is semantically equivalent to movq Imm64, R2.
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].