申请会员ID:老猫233【冒充他人作品申请】
1.申 请 I D:老猫2332.个人邮箱:a1483565753@163.com
3.技术文章:一个简陋的虚拟机
.586
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
.data
chCaption db 'Message', 0
chText db 'oh yeah!', 0
chUser32 db 'user32.dll', 0
chSrc db 0h, 08h ;这条相当于x86的push 0
dd 0h
db 7h, 0C0h ;相当于x86的mov eax, chCaption
dd chCaption
db 0h, 00h ;相当于x86的push chText
db 0h, 08h
dd chText
db 0h, 08h ;相当于x86的push 0
dd 0h
db 2h, 08h ;call MessageBox
dd 77d507eah
db 3h, 0h ;rent虚拟机退出
.code
opcode dd ?
start:
call here
here:
pop ebx
mov eax, here
sub ebx, eax
lea eax,
mov opcode, eax
;指定opcode
invoke LoadLibrary, offset chUser32
push eax
push esp
push ebp
push esi
push edi
push ebx
push ecx
push edx
pushfd
mov esi, opcode
lea edi,
lea ebp,
jmp Dispatch
db 0CCh
VNOT:
pop eax
not dword ptr
pushfd
pop
jmp Dispatch
VNEG:
pop eax
neg dword ptr
pushfd
pop
jmp Dispatch
VJMP:
pop eax
add esi,
jmp Dispatch
VCALL:
pop ecx
mov ecx,
call ecx
mov , eax
jmp Dispatch
db 0CCh
;以上是初始化工作,从这开始进入分配器
Dispatch:
xor eax, eax ;reset eax
mov al,
inc esi
mov edx, ;reset edx
mov al,
inc esi
test al, 80h ;;;比较单双操作数
jnz Double
test al, 40h ;这里开始是对单操作数指令的处理
jnz SingalAddr
cmp al, 08h
jz ImmiValue
lea ecx, ;push eax
push ecx ;操作寄存器
jmp edx
ImmiValue:
push esi ;push immi
add esi, 4
jmp edx
SingalAddr:
cmp al, 08h
jz ImmiAddr
mov ecx, ;push
push ecx ;操作寄存器中的地址
jmp edx
ImmiAddr:
mov eax, ;push
push eax
add esi, 4
jmp edx
Double: ;这里开始是对双操作数指令的处理
xor ecx, ecx
and al, 7Fh
test al, 40h
jnz HaveImmi
and al, 40h
mov cl,
inc esi
test cl, 80h
jnz FValue
lea eax, ;mov eax, ecx
push eax
lea ecx,
push ecx
jmp edx
FValue:
test cl, 40h ;mov eax,
jnz BValue
lea eax,
push eax
mov ecx,
push ecx
jmp edx
BValue:
mov eax, ;mov , ecx
push eax
mov ecx,
push ecx
jmp edx
HaveImmi:
and al, 0BFh
test al, 20h
jnz HaveAddr
lea ecx,
push ecx ;mov eax, immi
push esi
add esi, 4
jmp edx
HaveAddr:
test al, 10h
jnz ImmiBValue
and al, 0Fh ;mov eax,
lea ecx,
push ecx
push
add esi, 4
jmp edx
ImmiBValue:
and al, 0EFh ;mov , immi
mov ecx,
push ecx
push esi
add esi, 4
jmp edx
jmp edx
db 0CCh ;以上都是分配器程序
VMOV:
pop eax
pop ecx
mov eax,
mov , eax
jmp Dispatch
VLEA:
pop eax
pop ecx
mov , eax
jmp Dispatch
VRETN:
mov al,
lea esp,
mov edx,
lea esp,
jmp edx
VPUSH:
pop eax
push
jmp Dispatch
VPOP:
pop eax
pop
jmp Dispatch
VADD:
pop eax
pop ecx
add , eax
jmp Dispatch
VSUB:
pop eax
pop ecx
sub , eax
jmp Dispatch
ASM dd VPUSH
dd VPOP
dd VCALL
dd VRETN
dd VJMP
dd VNOT
dd VNEG
dd VMOV
dd VLEA
dd VADD
dd VSUB
end start 好像在哪见过?自己写的?也有些简单了,提供更多内容申请吧。 Hmily 发表于 2018-4-28 15:27
好像在哪见过?自己写的?也有些简单了,提供更多内容申请吧。
https://www.pediy.com/kssd/pediy12/97440.html 目测是直接复制过来的。
页:
[1]