-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamd64.asm
104 lines (83 loc) · 1.06 KB
/
amd64.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
.DATA
.CODE
;
;
;Get Selector
RegGetCs PROC
mov rax,cs
ret
RegGetCs ENDP
RegGetDs PROC
mov rax,cs
ret
RegGetDs ENDP
RegGetEs PROC
mov rax,es
ret
RegGetEs ENDP
RegGetSs PROC
mov rax,ss
ret
RegGetSs ENDP
GetTrSelector PROC
str rax
ret
GetTrSelector ENDP
RegGetFs PROC
mov rax, fs
ret
RegGetFs ENDP
RegGetGs PROC
mov rax,gs
ret
RegGetGS ENDP
; Get IDT/GDT
GetIdtBase PROC
LOCAL idtr[10]:BYTE
sidt idtr
mov rax, QWORD PTR idtr[2]
ret
GetIdtBase ENDP
GetGdtBase PROC
LOCAL gdtr[10]:BYTE
sgdt gdtr
mov rax, QWORD PTR gdtr[2]
ret
GetGdtBase ENDP
GetGdtLimit PROC
LOCAL gdtr[10]:BYTE
sgdt gdtr
mov ax, WORD PTR gdtr[0]
ret
GetGdtLimit ENDP
GetIdtLimit PROC
LOCAL idtr[10]:BYTE
sidt idtr
mov ax, WORD PTR idtr[0]
ret
GetIdtLimit ENDP
;VmLauch Handler
;ExithandlerPoint PROC
; xor rax,rax
; int 3
;ExithandlerPoint ENDP
Asm_vmcall PROC
;mov ax,es
;mov es,ax
;mov ax,ds
;mov ds,ax
;mov ax,fs
;mov fs,ax
;mov ax,gs
;mov gs,ax
;mov ax,ss
;mov ss,ax
vmcall
ret
Asm_vmcall ENDP
RegGetRflags PROC
pushfq
pop rax
ret
RegGetRflags ENDP
END