kvisc/vm/in/MEM

111 lines
1.7 KiB
Plaintext

# The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
#---------------------------------------------------------------------------#
# Stack manipulation instructions #
#---------------------------------------------------------------------------#
#
# Unconditional jump with possible return (CALL)
#
# PUSH(EIP)
# JMP(EIP)
#
call 1
call 2
call 3
#
# Return to caller (RET)
#
# POP(EIP)
#
ret 0
ret 1
#
# Make new stack frame (ENTER)
#
# PUSH(EBP)
# EBP = ESP
# ESP = ESP - $1
#
enter 0
enter 1
enter 2
#
# Leave stack frame (LEAVE)
#
# ESP = EBP
# POP(EBP)
#
leave 0
#
# PUSH value onto stack
#
# ESP = ESP - 8
# *ESP = $1
#
push 1
push 2
push 3
#
# POP value from stack
#
# $1 = *ESP
# ESP = ESP + 8
#
pop 0
pop 1
pop 2
#---------------------------------------------------------------------------#
# Movement instructions #
#---------------------------------------------------------------------------#
nul 1
nul 2
#
# Load Effective Address (LEA) instruction
#
# $1 = ADDR($2)
#
# For instance:
# LEA EAX, [EBX + ECX * 2 + 4]
# will result in:
# EAX = EBX + ECX * 2 + 4
#
lea 2
#
# Move data (MOV/MOVU) instructions
#
# $1 = SignExtend($2) (MOV)
# $1 = ZeroExtend($2) (MOVU)
#
mov 2
movzx 2
#
# Move with sign-extension (MOVx) instruction
#
# $1 = SignExtend($2 & (2^(8 * sizeof(x)) - 1)
#
movb 2
movw 2
movd 2
#
# Exchange (XCHG) instruction
#
# $_ = $1
# $1 = $2
# $2 = $_
#
xchg 2