arch/x86/include/asm/insn.h
Source file repositories/reference/linux-study-clean/arch/x86/include/asm/insn.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/include/asm/insn.h- Extension
.h- Size
- 9881 bytes
- Lines
- 345
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/byteorder.hasm/inat.h
Detected Declarations
struct insn_fieldstruct insn_fieldstruct insnenum insn_modefunction insn_field_setfunction insn_set_bytefunction insn_field_setfunction insn_set_bytefunction insn_get_attributefunction insn_is_rex2function insn_rex2_m_bitfunction insn_is_avx_or_xopfunction insn_is_evexfunction avx_insn_is_xopfunction insn_is_xopfunction insn_has_emulate_prefixfunction insn_vex_m_bitsfunction insn_vex_p_bitsfunction insn_vex_w_bitfunction insn_xop_map_bitsfunction insn_xop_p_bitsfunction insn_last_prefix_idfunction insn_offset_rex_prefixfunction insn_offset_vex_prefixfunction insn_offset_opcodefunction insn_offset_modrmfunction insn_offset_sibfunction insn_offset_displacementfunction insn_offset_immediatefunction instruction
Annotated Snippet
struct insn_field {
union {
insn_value_t value;
insn_byte_t bytes[4];
};
/* !0 if we've run insn_get_xxx() for this field */
unsigned char got;
unsigned char nbytes;
};
static inline void insn_field_set(struct insn_field *p, insn_value_t v,
unsigned char n)
{
p->value = v;
p->nbytes = n;
}
static inline void insn_set_byte(struct insn_field *p, unsigned char n,
insn_byte_t v)
{
p->bytes[n] = v;
}
#else
struct insn_field {
insn_value_t value;
union {
insn_value_t little;
insn_byte_t bytes[4];
};
/* !0 if we've run insn_get_xxx() for this field */
unsigned char got;
unsigned char nbytes;
};
static inline void insn_field_set(struct insn_field *p, insn_value_t v,
unsigned char n)
{
p->value = v;
p->little = __cpu_to_le32(v);
p->nbytes = n;
}
static inline void insn_set_byte(struct insn_field *p, unsigned char n,
insn_byte_t v)
{
p->bytes[n] = v;
p->value = __le32_to_cpu(p->little);
}
#endif
struct insn {
struct insn_field prefixes; /*
* Prefixes
* prefixes.bytes[3]: last prefix
*/
struct insn_field rex_prefix; /* REX prefix */
union {
struct insn_field vex_prefix; /* VEX prefix */
struct insn_field xop_prefix; /* XOP prefix */
};
struct insn_field opcode; /*
* opcode.bytes[0]: opcode1
* opcode.bytes[1]: opcode2
* opcode.bytes[2]: opcode3
*/
struct insn_field modrm;
struct insn_field sib;
struct insn_field displacement;
union {
struct insn_field immediate;
struct insn_field moffset1; /* for 64bit MOV */
struct insn_field immediate1; /* for 64bit imm or off16/32 */
};
union {
struct insn_field moffset2; /* for 64bit MOV */
struct insn_field immediate2; /* for 64bit imm or seg16 */
};
int emulate_prefix_size;
insn_attr_t attr;
unsigned char opnd_bytes;
unsigned char addr_bytes;
unsigned char length;
unsigned char x86_64;
const insn_byte_t *kaddr; /* kernel address of insn to analyze */
const insn_byte_t *end_kaddr; /* kernel address of last insn in buffer */
const insn_byte_t *next_byte;
Annotation
- Immediate include surface: `asm/byteorder.h`, `asm/inat.h`.
- Detected declarations: `struct insn_field`, `struct insn_field`, `struct insn`, `enum insn_mode`, `function insn_field_set`, `function insn_set_byte`, `function insn_field_set`, `function insn_set_byte`, `function insn_get_attribute`, `function insn_is_rex2`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.