liblisa-semantics-tool

Crates.ioliblisa-semantics-tool
lib.rsliblisa-semantics-tool
version0.1.1
sourcesrc
created_at2024-08-30 17:34:54.836409
updated_at2024-09-02 14:47:33.815608
descriptionA command-line tool that can query and manipulate libLISA's semantics.
homepagehttps://liblisa.nl/
repositoryhttps://github.com/liblisa/liblisa
max_upload_size
id1357954
size98,713
Jos (jxors)

documentation

https://docs.liblisa.nl/

README

The liblisa-semantics-tool

The liblisa-semantics-tool is a command-line program that can be used to query libLISA's semantics. It requires the raw semantics that can be downloaded from here.

Installation

Through cargo:

cargo +nightly install liblisa-semantics-tool

Usage

Run the tool with the --help flag to see all possible commands.

Semantics server

One of the main features of the liblisa-semantics-tool is the semantics server. This allows semantics to be queried programmatically via stdin and stdout. The semantics server instantiates semantics: it fills in the correct registers, flags and immediate values from parts in the encoding. If you were using the raw semantics directly, you would have to implement this instantiation yourself.

You can start the server with:

liblisa-semantics-tool server amd-3900x.json

It may take a while to build the lookup table. This process can be cached by passing the --cache lookup-table.cache flag. However, note that no verification is performed to ensure that the loaded cache matches the original semantics.

In order to query the semantics, provide an instruction in hexadecimal form followed by a newline to stdin. A JSON representation of the semantics will be printed to stdout.

The --debug flag enables printing of debugging information to stderr. The JSON schema will be printed to stderr when the binary starts. A human-readable representation of the queried semantics is also printed to stderr.

Other examples

Obtaining the JSON schema of the raw semantics:

liblisa-semantics-tool schema

General statistics of the semantics:

liblisa-semantics-tool get amd-3900x.json stats

Print a single encoding:

liblisa-semantics-tool get amd-3900x.json encoding 00d3

Print all encodings (Note: this prints over a million lines of text):

liblisa-semantics-tool get amd-3900x.json full-encodings

Print only the bitpatterns of all encodings:

liblisa-semantics-tool get amd-3900x.json bitpatterns

Building

Clone the repository and run:

cargo build --release --bin liblisa-semantics-tool
Commit count: 32

cargo fmt