From fc897ef4d6aca746f61ef7b0b2f815e96ae62380 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Thu, 7 Dec 2023 23:07:45 +0100 Subject: insn: update doc --- src/insn.rs | 9 +++++++++ src/insn/nop.rs | 1 + src/insn/ret.rs | 1 + 3 files changed, 11 insertions(+) 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 { /// 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 { /// Emit a call instruction. fn call(&mut self, op1: T); } +/// Trait for [`cmp`](https://www.felixcloutier.com/x86/cmp) instruction kinds. pub trait Cmp { /// Emit a compare instruction. /// @@ -30,31 +33,37 @@ pub trait Cmp { fn cmp(&mut self, op1: T, op2: U); } +/// Trait for [`dec`](https://www.felixcloutier.com/x86/dec) instruction kinds. pub trait Dec { /// Emit a decrement instruction. fn dec(&mut self, op1: T); } +/// Trait for [`jmp`](https://www.felixcloutier.com/x86/jmp) instruction kinds. pub trait Jmp { /// 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 { /// 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 { /// 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 { /// 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 { /// 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]); } -- cgit v1.2.3