aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-12-07 23:07:45 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-12-07 23:07:45 +0100
commitfc897ef4d6aca746f61ef7b0b2f815e96ae62380 (patch)
treed931a1a51e70f1f4d26bb0e09069a8a89526c917 /src
parentf4a9fdb3357ce1a2dfc12cbb0fee6b915bc810c4 (diff)
downloadjuicebox-asm-fc897ef4d6aca746f61ef7b0b2f815e96ae62380.tar.gz
juicebox-asm-fc897ef4d6aca746f61ef7b0b2f815e96ae62380.zip
insn: update doc
Diffstat (limited to 'src')
-rw-r--r--src/insn.rs9
-rw-r--r--src/insn/nop.rs1
-rw-r--r--src/insn/ret.rs1
3 files changed, 11 insertions, 0 deletions
diff --git a/src/insn.rs b/src/insn.rs
index e5a597e..c7e6e7e 100644
--- a/src/insn.rs
+++ b/src/insn.rs
@@ -12,16 +12,19 @@ mod nop;
mod ret;
mod test;
+/// Trait for [`add`](https://www.felixcloutier.com/x86/add) instruction kinds.
pub trait Add<T, U> {
/// Emit an add instruction.
fn add(&mut self, op1: T, op2: U);
}
+/// Trait for [`call`](https://www.felixcloutier.com/x86/call) instruction kinds.
pub trait Call<T> {
/// Emit a call instruction.
fn call(&mut self, op1: T);
}
+/// Trait for [`cmp`](https://www.felixcloutier.com/x86/cmp) instruction kinds.
pub trait Cmp<T, U> {
/// Emit a compare instruction.
///
@@ -30,31 +33,37 @@ pub trait Cmp<T, U> {
fn cmp(&mut self, op1: T, op2: U);
}
+/// Trait for [`dec`](https://www.felixcloutier.com/x86/dec) instruction kinds.
pub trait Dec<T> {
/// Emit a decrement instruction.
fn dec(&mut self, op1: T);
}
+/// Trait for [`jmp`](https://www.felixcloutier.com/x86/jmp) instruction kinds.
pub trait Jmp<T> {
/// Emit an unconditional jump instruction.
fn jmp(&mut self, op1: T);
}
+/// Trait for [`jnz`](https://www.felixcloutier.com/x86/jcc) instruction kinds.
pub trait Jnz<T> {
/// Emit a conditional jump if not zero instruction (`ZF = 0`).
fn jnz(&mut self, op1: T);
}
+/// Trait for [`jz`](https://www.felixcloutier.com/x86/jcc) instruction kinds.
pub trait Jz<T> {
/// Emit a conditional jump if zero instruction (`ZF = 1`).
fn jz(&mut self, op1: T);
}
+/// Trait for [`mov`](https://www.felixcloutier.com/x86/mov) instruction kinds.
pub trait Mov<T, U> {
/// Emit an move instruction.
fn mov(&mut self, op1: T, op2: U);
}
+/// Trait for [`test`](https://www.felixcloutier.com/x86/test) instruction kinds.
pub trait Test<T, U> {
/// Emit a logical compare instruction.
///
diff --git a/src/insn/nop.rs b/src/insn/nop.rs
index 82057db..f239039 100644
--- a/src/insn/nop.rs
+++ b/src/insn/nop.rs
@@ -1,6 +1,7 @@
use crate::Asm;
impl Asm {
+ /// Emit a [`nop`](https://www.felixcloutier.com/x86/nop) instruction.
pub fn nop(&mut self) {
self.emit(&[0x90]);
}
diff --git a/src/insn/ret.rs b/src/insn/ret.rs
index 74086d8..c5af571 100644
--- a/src/insn/ret.rs
+++ b/src/insn/ret.rs
@@ -1,6 +1,7 @@
use crate::Asm;
impl Asm {
+ /// Emit a [`ret`](https://www.felixcloutier.com/x86/ret) instruction.
pub fn ret(&mut self) {
self.emit(&[0xc3]);
}