From 7e758f4d684199c90ec1bb9107908e506bf736cf Mon Sep 17 00:00:00 2001 From: johannst Date: Fri, 20 Dec 2024 22:36:06 +0000 Subject: deploy: 6cc2331c8ff8e7372cd6e9a339250a9d8b58a547 --- juicebox_asm/index.html | 2 +- juicebox_asm/struct.Asm.html | 13 ++++++++++--- juicebox_asm/struct.Runtime.html | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'juicebox_asm') diff --git a/juicebox_asm/index.html b/juicebox_asm/index.html index ae482cb..0009a33 100644 --- a/juicebox_asm/index.html +++ b/juicebox_asm/index.html @@ -1,4 +1,4 @@ -juicebox_asm - Rust

Crate juicebox_asm

source
Expand description

A simple x64 jit assembler with a minimal runtime to execute emitted code for fun.

+juicebox_asm - Rust

Crate juicebox_asm

source
Expand description

A simple x64 jit assembler with a minimal runtime to execute emitted code for fun.

The following is an fibonacci example implementation.

use juicebox_asm::{Asm, Reg64, Imm64, Label};
diff --git a/juicebox_asm/struct.Asm.html b/juicebox_asm/struct.Asm.html
index 19579f8..9f7c7e8 100644
--- a/juicebox_asm/struct.Asm.html
+++ b/juicebox_asm/struct.Asm.html
@@ -1,7 +1,14 @@
-Asm in juicebox_asm - Rust
juicebox_asm

Struct Asm

source
pub struct Asm { /* private fields */ }
Expand description

x64 jit assembler.

-

Implementations§

source§

impl Asm

source

pub fn new() -> Asm

Create a new x64 jit assembler.

+Asm in juicebox_asm - Rust
juicebox_asm

Struct Asm

source
pub struct Asm { /* private fields */ }
Expand description

x64 jit assembler.

+

Implementations§

source§

impl Asm

source

pub fn new() -> Asm

Create a new x64 jit assembler.

source

pub fn into_code(self) -> Vec<u8>

Consume the assembler and get the emitted code.

-
source

pub fn bind(&mut self, label: &mut Label)

Bind the Label to the current location.

+
source

pub fn disasm(&self)

Disassemble the code currently added to the runtime, using +ndisasm and print it to stdout. If +ndisasm is not available on the system this prints a warning and +becomes a nop.

+
§Panics
+

Panics if anything goes wrong with spawning, writing to or reading from +the ndisasm child process.

+
source

pub fn bind(&mut self, label: &mut Label)

Bind the Label to the current location.

source§

impl Asm

source

pub fn nop(&mut self)

Emit a nop instruction.

source§

impl Asm

source

pub fn ret(&mut self)

Emit a ret instruction.

Trait Implementations§

source§

impl Add<Mem16, Imm16> for Asm

source§

fn add(&mut self, op1: Mem16, op2: Imm16)

Emit an add instruction.
source§

impl Add<Mem16, Imm8> for Asm

source§

fn add(&mut self, op1: Mem16, op2: Imm8)

Emit an add instruction.
source§

impl Add<Mem16, Reg16> for Asm

source§

fn add(&mut self, op1: Mem16, op2: Reg16)

Emit an add instruction.
source§

impl Add<Mem32, Imm8> for Asm

source§

fn add(&mut self, op1: Mem32, op2: Imm8)

Emit an add instruction.
source§

impl Add<Mem64, Imm8> for Asm

source§

fn add(&mut self, op1: Mem64, op2: Imm8)

Emit an add instruction.
source§

impl Add<Mem64, Reg64> for Asm

source§

fn add(&mut self, op1: Mem64, op2: Reg64)

Emit an add instruction.
source§

impl Add<Mem8, Imm8> for Asm

source§

fn add(&mut self, op1: Mem8, op2: Imm8)

Emit an add instruction.
source§

impl Add<Reg32, Reg32> for Asm

source§

fn add(&mut self, op1: Reg32, op2: Reg32)

Emit an add instruction.
source§

impl Add<Reg64, Mem64> for Asm

source§

fn add(&mut self, op1: Reg64, op2: Mem64)

Emit an add instruction.
source§

impl Add<Reg64, Reg64> for Asm

source§

fn add(&mut self, op1: Reg64, op2: Reg64)

Emit an add instruction.
source§

impl Call<Reg64> for Asm

source§

fn call(&mut self, op1: Reg64)

Emit a call instruction.
source§

impl Cmovnz<Reg64, Reg64> for Asm

source§

fn cmovnz(&mut self, op1: Reg64, op2: Reg64)

Emit a (conditional) move if not zero instruction. Read more
source§

impl Cmovz<Reg64, Reg64> for Asm

source§

fn cmovz(&mut self, op1: Reg64, op2: Reg64)

Emit a (conditional) move if zero instruction. Read more
source§

impl Cmp<Mem16, Imm16> for Asm

source§

fn cmp(&mut self, op1: Mem16, op2: Imm16)

Emit a compare instruction. Read more
source§

impl Cmp<Mem8, Imm8> for Asm

source§

fn cmp(&mut self, op1: Mem8, op2: Imm8)

Emit a compare instruction. Read more
source§

impl Cmp<Reg64, Reg64> for Asm

source§

fn cmp(&mut self, op1: Reg64, op2: Reg64)

Emit a compare instruction. Read more
source§

impl Dec<Mem16> for Asm

source§

fn dec(&mut self, op1: Mem16)

Emit a decrement instruction.
source§

impl Dec<Mem32> for Asm

source§

fn dec(&mut self, op1: Mem32)

Emit a decrement instruction.
source§

impl Dec<Mem64> for Asm

source§

fn dec(&mut self, op1: Mem64)

Emit a decrement instruction.
source§

impl Dec<Mem8> for Asm

source§

fn dec(&mut self, op1: Mem8)

Emit a decrement instruction.
source§

impl Dec<Reg32> for Asm

source§

fn dec(&mut self, op1: Reg32)

Emit a decrement instruction.
source§

impl Dec<Reg64> for Asm

source§

fn dec(&mut self, op1: Reg64)

Emit a decrement instruction.
source§

impl Inc<Mem16> for Asm

source§

fn inc(&mut self, op1: Mem16)

Emit a increment instruction.
source§

impl Inc<Mem32> for Asm

source§

fn inc(&mut self, op1: Mem32)

Emit a increment instruction.
source§

impl Inc<Mem64> for Asm

source§

fn inc(&mut self, op1: Mem64)

Emit a increment instruction.
source§

impl Inc<Mem8> for Asm

source§

fn inc(&mut self, op1: Mem8)

Emit a increment instruction.
source§

impl Inc<Reg32> for Asm

source§

fn inc(&mut self, op1: Reg32)

Emit a increment instruction.
source§

impl Inc<Reg64> for Asm

source§

fn inc(&mut self, op1: Reg64)

Emit a increment instruction.
source§

impl Jmp<&mut Label> for Asm

source§

fn jmp(&mut self, op1: &mut Label)

Emit an unconditional jump instruction.
source§

impl Jnz<&mut Label> for Asm

source§

fn jnz(&mut self, op1: &mut Label)

Emit a conditional jump if not zero instruction (ZF = 0).
source§

impl Jz<&mut Label> for Asm

source§

fn jz(&mut self, op1: &mut Label)

Emit a conditional jump if zero instruction (ZF = 1).
source§

impl Mov<Mem16, Imm16> for Asm

source§

fn mov(&mut self, op1: Mem16, op2: Imm16)

Emit an move instruction.
source§

impl Mov<Mem16, Reg16> for Asm

source§

fn mov(&mut self, op1: Mem16, op2: Reg16)

Emit an move instruction.
source§

impl Mov<Mem32, Reg32> for Asm

source§

fn mov(&mut self, op1: Mem32, op2: Reg32)

Emit an move instruction.
source§

impl Mov<Mem64, Reg64> for Asm

source§

fn mov(&mut self, op1: Mem64, op2: Reg64)

Emit an move instruction.
source§

impl Mov<Mem8, Reg8> for Asm

source§

fn mov(&mut self, op1: Mem8, op2: Reg8)

Emit an move instruction.
source§

impl Mov<Reg16, Imm16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Imm16)

Emit an move instruction.
source§

impl Mov<Reg16, Mem16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Mem16)

Emit an move instruction.
source§

impl Mov<Reg16, Reg16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Reg16)

Emit an move instruction.
source§

impl Mov<Reg32, Imm32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Imm32)

Emit an move instruction.
source§

impl Mov<Reg32, Mem32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Mem32)

Emit an move instruction.
source§

impl Mov<Reg32, Reg32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Reg32)

Emit an move instruction.
source§

impl Mov<Reg64, Imm64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Imm64)

Emit an move instruction.
source§

impl Mov<Reg64, Mem64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Mem64)

Emit an move instruction.
source§

impl Mov<Reg64, Reg64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Reg64)

Emit an move instruction.
source§

impl Mov<Reg8, Imm8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Imm8)

Emit an move instruction.
source§

impl Mov<Reg8, Mem8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Mem8)

Emit an move instruction.
source§

impl Mov<Reg8, Reg8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Reg8)

Emit an move instruction.
source§

impl Pop<Reg16> for Asm

source§

fn pop(&mut self, op1: Reg16)

Emit a pop instruction.
source§

impl Pop<Reg64> for Asm

source§

fn pop(&mut self, op1: Reg64)

Emit a pop instruction.
source§

impl Push<Reg16> for Asm

source§

fn push(&mut self, op1: Reg16)

Emit a push instruction.
source§

impl Push<Reg64> for Asm

source§

fn push(&mut self, op1: Reg64)

Emit a push instruction.
source§

impl Sub<Mem8, Imm8> for Asm

source§

fn sub(&mut self, op1: Mem8, op2: Imm8)

Emit an sub instruction.
source§

impl Sub<Reg64, Reg64> for Asm

source§

fn sub(&mut self, op1: Reg64, op2: Reg64)

Emit an sub instruction.
source§

impl Test<Mem16, Imm16> for Asm

source§

fn test(&mut self, op1: Mem16, op2: Imm16)

Emit a logical compare instruction. Read more
source§

impl Test<Reg32, Reg32> for Asm

source§

fn test(&mut self, op1: Reg32, op2: Reg32)

Emit a logical compare instruction. Read more
source§

impl Test<Reg64, Reg64> for Asm

source§

fn test(&mut self, op1: Reg64, op2: Reg64)

Emit a logical compare instruction. Read more
source§

impl Xor<Reg64, Reg64> for Asm

source§

fn xor(&mut self, op1: Reg64, op2: Reg64)

Emit a xor instruction.

Auto Trait Implementations§

§

impl Freeze for Asm

§

impl RefUnwindSafe for Asm

§

impl Send for Asm

§

impl Sync for Asm

§

impl Unpin for Asm

§

impl UnwindSafe for Asm

Blanket Implementations§

source§

impl<T> Any for T
where diff --git a/juicebox_asm/struct.Runtime.html b/juicebox_asm/struct.Runtime.html index 5734451..be0cb19 100644 --- a/juicebox_asm/struct.Runtime.html +++ b/juicebox_asm/struct.Runtime.html @@ -1,5 +1,5 @@ Runtime in juicebox_asm - Rust
juicebox_asm

Struct Runtime

source
pub struct Runtime { /* private fields */ }
Expand description

A simple mmaped runtime with executable pages.

-

Implementations§

source§

impl Runtime

source

pub fn new() -> Runtime

Create a new Runtime.

+

Implementations§

source§

impl Runtime

source

pub fn new() -> Runtime

Create a new Runtime.

§Panics

Panics if the mmap call fails.

source

pub fn with_profile() -> Runtime

Create a new Runtime which also generates static perf metat data.

@@ -21,14 +21,14 @@ pointer is only valid until the let nop = unsafe { rt.add_code::<extern "C" fn()>(&code) }; nop();

-
source

pub fn disasm(&self)

Disassemble the code currently added to the runtime, using +

source

pub fn disasm(&self)

Disassemble the code currently added to the runtime, using ndisasm and print it to stdout. If ndisasm is not available on the system this prints a warning and becomes a nop.

§Panics

Panics if anything goes wrong with spawning, writing to or reading from the ndisasm child process.

-

Trait Implementations§

source§

impl Drop for Runtime

source§

fn drop(&mut self)

Unmaps the code page. This invalidates all the function pointer returned by +

Trait Implementations§

source§

impl Drop for Runtime

source§

fn drop(&mut self)

Unmaps the code page. This invalidates all the function pointer returned by Runtime::add_code.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where -- cgit v1.2.3