-
Notifications
You must be signed in to change notification settings - Fork 47
/
vdebug.asm
155 lines (115 loc) · 1.65 KB
/
vdebug.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
FORMAT MZ
HEAP 0
include 'config.asm'
include 'struct.asm'
; stack
segment STACK16
USE16
dw 128 dup(0)
stre:
; data
segment DATA16
USE16
run db 0
psp dw 0
mypsp dw 0
if VDEBUG = 0
m1 db "Virtualization Debugger, (C) Chourdakis Michael - Set VDEBUG=1 to config.asm.",0x0D,0x0A,"$"
else
m1 db "Virtualization Debugger, (C) Chourdakis Michael.",0x0D,0x0A,"$"
end if
prg db "d:\debuggee.exe",0x0
dismposcount dd 0
dismpos dd 0
bbb LoadX 0,0,0,0,0,0,0
include 'vdebug64.asm'
include "reqdmmi.asm"
; main
segment CODE16
USE16
back16:
; End
cli
mov ax,STACK16
mov ss,ax
mov eax,stre
mov esp,eax
sti
mov ax,DATA16
mov ds,ax
mov es,ax
; Set the PSP
mov ah,0x50
mov bx,[mypsp]
int 0x21
mov ax,0x4C00
int 0x21
start16:
mov ax,STACK16
mov ss,ax
mov eax,stre
mov esp,eax
mov ax,DATA16
mov ds,ax
mov es,ax
mov ax,0x0900
mov dx,m1
int 0x21
if VDEBUG = 0
mov ax,0x4C00
int 0x21
end if
mov ah,0x62
int 0x21
mov [mypsp],bx
mov eax,1
cpuid
bt ecx,5
jc VMX_Supported
mov ax,0x4C00
int 0x21
VMX_Supported:
RequireDMMI
; dism pos
mov ax,0x1401
xor ecx,ecx
xor edx,edx
int 0xF0
;break
mov word [es:dismpos],si
mov word [es:dismpos + 2],ds
shr esi,16
mov word [es:dismposcount],si
mov word [es:dismposcount + 2],ds
mov ax,DATA16
mov ds,ax
; Load executable
mov bx,bbb
mov dx,prg
mov ax,0x4B01
int 0x21
jc endx
BackExecutable:
mov ax,DATA16
mov ds,ax
cmp [run],1
je endx2
mov [run],1
mov ah,0x62
int 0x21
mov [psp],bx
; Enter Long
xor ecx,ecx
mov cx,CODE64
shl ecx,4
add ecx,start64
mov ax,0x0902
int 0xF0
endx2:
vmcall
endx:
; End
mov ax,0x4C00
int 0x21
SEGMENT ENDS
entry CODE16:start16