1#![no_std]
10
11mod cpuid;
12mod decode;
13mod decoder;
14mod error;
15mod fast;
16mod generated;
17mod ild;
18mod isa;
19
20use core::fmt;
21
22pub use cpuid::{CpuidField, CpuidRegister};
23#[cfg(feature = "internal-reference")]
24#[doc(hidden)]
25pub use decode::decode_reference;
26pub use decode::flags::{Flag, FlagAction, FlagEffect, FlagSet, Flags};
27pub use decode::flow::{Condition, relative_target};
28pub use decode::format::Intel;
29pub use decode::operand::{Action, ElementBase, Memory, Operand, Value, Visibility};
30pub use decode::{Attributes, Encoding, Instruction, decode, decode_flow};
31pub use decoder::Decoder;
32pub use error::{DecodeError, Mode};
33pub use generated::form::{Attribute, Category, Extension, Form, IsaSet};
34pub use generated::mnemonic::Mnemonic;
35pub use generated::operand::{ElementType, OperandName, OperandWidth};
36pub use generated::register::{Register, RegisterClass};
37pub use ild::{MAX_LENGTH, decode_length};
38pub use isa::X86;
39
40pub const MAX_OPERANDS: usize = {
43 let mut most = 0;
44 let mut rest: &[decode::InstructionInfo] = &generated::form::INSTRUCTIONS;
45 while let [info, tail @ ..] = rest {
46 if info.operand_count as usize > most {
47 most = info.operand_count as usize;
48 }
49 rest = tail;
50 }
51 most
52};
53
54#[derive(Debug, Clone, Copy, PartialEq, Eq)]
56pub struct UnknownName;
57
58impl fmt::Display for UnknownName {
59 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
60 f.write_str("unknown name")
61 }
62}
63
64impl core::error::Error for UnknownName {}