osom_encoders_x86_64/encoders/push.rs
1//! This module contains the encoders for the `push` instruction group.
2#![allow(unused_imports)]
3
4// ** This file is automatically generated from x86.yaml schema. Do not modify! **
5
6use crate::models::{
7 EncodedX86_64Instruction, GPR, GPROrMemory, Immediate8, Immediate16, Immediate32, Immediate64, Memory, Offset,
8 Scale, Size,
9};
10
11/// Push 64-bit register or memory onto the stack.
12///
13/// # Safety
14///
15/// It is the caller's responsibility to ensure that the operands are valid.
16/// Otherwise the behavior is undefined.
17#[inline]
18pub const unsafe fn encode_rm64(rm64: GPROrMemory) -> EncodedX86_64Instruction {
19 unsafe { crate::partial_encoders::m::encode_gpr_or_memory([0xFF], 0x06, rm64, false, false) }
20}
21
22/// Push 64-bit register onto the stack.
23///
24/// # Safety
25///
26/// It is the caller's responsibility to ensure that the operands are valid.
27/// Otherwise the behavior is undefined.
28#[inline]
29pub const unsafe fn encode_reg64(reg64: GPR) -> EncodedX86_64Instruction {
30 unsafe { crate::partial_encoders::o::encode([0x50], reg64) }
31}
32
33/// Push 8-bit immediate onto the stack (sign-extended).
34///
35/// # Safety
36///
37/// It is the caller's responsibility to ensure that the operands are valid.
38/// Otherwise the behavior is undefined.
39#[inline]
40pub const unsafe fn encode_imm8(imm8: Immediate8) -> EncodedX86_64Instruction {
41 unsafe { crate::partial_encoders::i::encode_imm8([0x6A], imm8) }
42}
43
44/// Push 16-bit immediate onto the stack (sign-extended).
45///
46/// # Safety
47///
48/// It is the caller's responsibility to ensure that the operands are valid.
49/// Otherwise the behavior is undefined.
50#[inline]
51pub const unsafe fn encode_imm16(imm16: Immediate16) -> EncodedX86_64Instruction {
52 unsafe { crate::partial_encoders::i::encode_imm16_oso([0x68], imm16) }
53}
54
55/// Push 32-bit immediate onto the stack (sign-extended).
56///
57/// # Safety
58///
59/// It is the caller's responsibility to ensure that the operands are valid.
60/// Otherwise the behavior is undefined.
61#[inline]
62pub const unsafe fn encode_imm32(imm32: Immediate32) -> EncodedX86_64Instruction {
63 unsafe { crate::partial_encoders::i::encode_imm32([0x68], imm32) }
64}