System API (CPU & Disassembly)

The System API provides low-level functionality for CPU information, performance timing, and x64 instruction disassembly using Zydis. All functions listed here are available globally inside Lua scripts.


πŸ“Œ Available Functions

CPU Information

Function
Returns
Description

cpu_vendor()

string

CPU vendor (e.g. "AuthenticAMD" or "GenuineIntel").

cpu_brand()

string

Human-readable CPU model string.


Timing Functions

Function
Returns
Description

rdtsc()

uint64

Raw timestamp counter from the CPU. Fast but CPU-frequency dependent.

perf_time()

int64

High-resolution performance counter ticks from Windows.

perf_frequency()

int64

Number of performance counter ticks per second.

Useful for accurate microbenchmarking:

seconds = (perf_time_end - perf_time_start) / perf_frequency()

Disassembly (Zydis)

Function
Returns
Description

zydis_disasm(bytes_table, [runtime_rip])

table (array of instructions)

Disassembles multiple x64 instructions and returns detailed structured output.


Instruction Structure

zydis_disasm returns an array of disasm_instruction_t. Each instruction contains:


Operand Structure

Each operand is an operand_t table with a consistent schema:


πŸš€ Usage Examples

1. CPU Information


2. High-Resolution Timing


3. Disassemble Raw Bytes

You can disassemble any byte array:


4. Disassemble Memory From a Process

Works perfectly with your proc:rvm():


πŸ›  Example Output


πŸ“… Date & Time API

get_datetime()

Returns a table describing the local date and time.

get_timestamp()

Returns a Unix timestamp (UTC) β€” seconds since 1970-01-01.

Example

Last updated