1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
kvisc/vm/in/MOV

98 lines
1.5 KiB
Plaintext
Raw Normal View History

2019-06-23 12:40:18 +02:00
# The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
#---------------------------------------------------------------------------#
# Movement instructions #
#---------------------------------------------------------------------------#
#
# Load Effective Address (LEA) instruction
#
# $1 = ADDR($2)
#
# For instance:
# LEA RAX, [RBX + RCX + 4]
# will result in:
# RAX = RBX + RCX + 4
#
# Preserves all flags
#
2019-07-04 20:33:49 +02:00
lea r m
2019-06-23 12:40:18 +02:00
#
2019-07-04 20:33:49 +02:00
# Movement with sign-extension (MOV) instruction
2019-06-23 12:40:18 +02:00
#
# $1 = $2
#
2019-07-04 20:33:49 +02:00
mov r rim
mov m ri
#
# Movement with sign-extension (MOVSXx) instruction
#
# $1 = SignExtend($2 & (2^(8 * sizeof(x)) - 1)
#
movsxb r r
movsxw r r
movsxl r r
2019-06-23 12:40:18 +02:00
#
# Movement with zero-extension (MOVZX) instruction
#
# $1 = ZeroExtend($2)
#
2019-07-04 20:33:49 +02:00
movzx r m
2019-06-23 12:40:18 +02:00
#
# Exchange (XCHG) instruction
#
# $_ = $1
# $1 = $2
# $2 = $_
#
2019-07-04 20:33:49 +02:00
xchg r rm
2019-06-23 12:40:18 +02:00
#
# Compare-and-exchange (CMPXCHG) instruction
#
# IF ($1 == RAX) THEN
# $1 = $2
# ZF = 1
# ELSE
# RAX = $1
# ZF = 0
# FI
#
# Preserves CF, OF and SF
#
2019-07-04 20:33:49 +02:00
cmpxchg rm r
#
# 3-operand rotation (ROTd)
#
# $3 -> $2 -> $1 -> $3 (KROTL)
# $1 -> $2 -> $3 -> $1 (KROTR)
#
rotr rm r r
rotl rm r r
2019-06-23 12:40:18 +02:00
#
# Load argument #N (LDARG)
#
2019-07-09 19:51:03 +02:00
# $1 = AX$2
2019-06-23 12:40:18 +02:00
#
# Throws:
# #ILL if $2 ≥ 16
#
2019-07-05 14:06:14 +02:00
ldarg r r
2019-06-23 12:40:18 +02:00
#
# Get code/data offset (GCO/GCD)
#
# $1 = CR1 (GCO)
# $1 = CR2 (GCD)
#
2019-07-04 20:33:49 +02:00
gco r
gcd r
2019-06-23 12:40:18 +02:00