Skip to content

Commit 287a742

Browse files
committed
scheduled commit
1 parent 558dc02 commit 287a742

File tree

8 files changed

+209
-1
lines changed

8 files changed

+209
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
macro invlpgb?
2+
db 0Fh,1,0FEh
3+
end macro
4+
macro tlbsync?
5+
db 0Fh,1,0FFh
6+
end macro
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
macro movbe? dest*,src*
2+
x86.parse_operand@dest dest
3+
x86.parse_operand@src src
4+
if @dest.size & @src.size & @src.size <> @dest.size
5+
err 'operand sizes do not match'
6+
end if
7+
if @dest.type = 'reg' & @src.type = 'mem' & @dest.size > 1
8+
x86.select_operand_prefix@src @dest.size
9+
x86.store_instruction@src <0Fh,38h,0F0h>,@dest.rm
10+
else if @dest.type = 'mem' & @src.type = 'reg' & @src.size > 1
11+
x86.select_operand_prefix@dest @src.size
12+
x86.store_instruction@dest <0Fh,38h,0F1h>,@src.rm
13+
else
14+
err 'invalid combination of operands'
15+
end if
16+
end macro
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
macro rdpkru?
2+
db 0Fh,1,0EEh
3+
end macro
4+
macro wrpkru?
5+
db 0Fh,1,0EFh
6+
end macro
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
macro rmpupdate?
2+
db 0F2h,0Fh,1,0FEh
3+
end macro
4+
macro pvalidate?
5+
db 0F2h,0Fh,1,0FFh
6+
end macro
7+
macro rmpadjust?
8+
db 0F3h,0Fh,1,0FEh
9+
end macro
10+
macro psmash?
11+
db 0F3h,0Fh,1,0FFh
12+
end macro
+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
if ~ defined x86.mode
2+
include 'cpu\x64.inc'
3+
end if
4+
5+
include 'cpu\ext\avx2.inc'
6+
include 'cpu\ext\adx.inc'
7+
include 'cpu\ext\aes.inc'
8+
include 'cpu\ext\bmi2.inc'
9+
include 'cpu\ext\f16c.inc'
10+
include 'cpu\ext\fma.inc'
11+
include 'cpu\ext\movbe.inc'
12+
include 'cpu\ext\pclmulqdq.inc'
13+
include 'cpu\ext\rdrand.inc'
14+
include 'cpu\ext\rdseed.inc'
15+
; RDTSCP forces all older instructions to retire before reading the time-stamp counter.
16+
include 'cpu\ext\rdtscp.inc' ; CPUID Fn8000_0001_EDX[RDTSCP] = 1
17+
18+
; MOVBE, CPUID.01H:ECX.MOVBE[bit 22]
19+
; PREFETCHW CLFLUSHOPT SHA CLZERO
20+
21+
calminstruction clzero? dest*
22+
call x86.parse_operand@dest, dest
23+
check @dest.type = 'reg' & @dest.rm = 0 & @dest.size <> 1
24+
jyes _prefix
25+
err 'operand must be rAX'
26+
exit
27+
_prefix:
28+
call x86.store_operand_prefix, @dest.size
29+
emit 1, 0Fh
30+
emit 1, 1
31+
emit 1, 0FCh
32+
end calminstruction
33+
34+
calminstruction mwaitx?
35+
emit 1, 0Fh
36+
emit 1, 1
37+
emit 1, 0FBh
38+
end calminstruction
39+
40+
calminstruction monitorx?
41+
emit 1, 0Fh
42+
emit 1, 1
43+
emit 1, 0FAh
44+
end calminstruction
45+
46+
47+
; SSE4a ; AMD-only, from K10, CPUID.80000001H:ECX.SSE4A[Bit 6] flag
48+
49+
macro extrq? dest*,src*,sel
50+
SSE.parse_operand @dest,dest
51+
if @dest.type = 'mmreg' & @dest.size = 16
52+
match ,sel ; 66 0F 79 /r
53+
SSE.parse_operand @src,src
54+
if @src.type = 'mmreg' & @src.size = 16
55+
@src.opcode_prefix = 66h
56+
x86.store_instruction <0Fh,79h>,@src,@dest.rm
57+
else
58+
err 'invalid combination of operands'
59+
end if
60+
else ; xmm,ib,ib ; 66 0F 78 /0 ib ib
61+
x86.parse_operand @aux1,src
62+
x86.parse_operand @aux2,sel
63+
if @aux1.type <> 'imm' | @aux1.size and not 1 \
64+
| @aux2.type <> 'imm' | @aux2.size and not 1
65+
err 'invalid combination of operands'
66+
else
67+
@dest.opcode_prefix = 66h
68+
x86.store_instruction <0Fh,78h>,@dest,0,2,(@aux2.imm shl 8) or @aux1.imm
69+
end if
70+
end match
71+
else
72+
err 'invalid combination of operands'
73+
end if
74+
end macro
75+
76+
macro insertq? dest*,src*,sel1,sel2
77+
SSE.parse_operand @dest,dest
78+
SSE.parse_operand @src,src
79+
if @dest.type = 'mmreg' & @src.type = 'mmreg'
80+
if (@dest.size or @src.size) <> 16
81+
err 'invalid operand size'
82+
end if
83+
match ,sel1 sel2
84+
@src.opcode_prefix = 0F2h
85+
x86.store_instruction <0Fh,79h>,@src,@dest.rm
86+
else
87+
x86.parse_operand @aux1,sel1
88+
x86.parse_operand @aux2,sel2
89+
if @aux1.type <> 'imm' | @aux1.size and not 1 \
90+
| @aux2.type <> 'imm' | @aux2.size and not 1
91+
err 'invalid combination of operands'
92+
else
93+
@src.opcode_prefix = 0F2h
94+
x86.store_instruction <0Fh,78h>,@src,@dest.rm,2,(@aux2.imm shl 8) or @aux1.imm
95+
end if
96+
end match
97+
else
98+
err 'invalid combination of operands'
99+
end if
100+
end macro
101+
102+
iterate instr, movntss,movntsd
103+
macro instr? dest*,src*
104+
SSE.parse_operand @dest,dest
105+
SSE.parse_operand @src,src
106+
if @dest.type = 'mem' & @dest.size = 4*% \
107+
& @src.type = 'mmreg' & @src.size = 16
108+
@dest.opcode_prefix = 0F4h - %
109+
x86.store_instruction <0Fh,2Bh>,@dest,@src.rm
110+
else
111+
err 'invalid combination of operands'
112+
end if
113+
end macro
114+
end iterate
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
; Zen3 adds the following instructions:
3+
4+
include 'ext\vaes.inc'
5+
6+
include 'ext\vpclmulqdq.inc'
7+
; alias mnemonics:
8+
iterate <instr,aux>, PCLMULLQLQDQ,0, PCLMULHQLQDQ,1, PCLMULLQHQDQ,10h, PCLMULHQHQDQ,11h
9+
macro instr? line&
10+
PCLMULQDQ line,aux
11+
end macro
12+
macro v#instr? line&
13+
VPCLMULQDQ line,aux
14+
end macro
15+
end iterate
16+
17+
; CET_SS - Control-flow Enforcement Technology / Shadow Stack:
18+
; CLRSSBSY, INCSSP, RDSSP, RSTORSSP, SAVEPREVSSP, SETSSBSY, WRSS, WRUSS
19+
include 'ext\cet_ss.inc'
20+
21+
; INVPCID - Invalidate TLB entry(s) in a specified PCID
22+
include 'ext\invpcid.inc'
23+
24+
; INVLPGB - Broadcast TLB flushing:
25+
; INVLPGB, TLBSYNC
26+
include 'ext\invlpgb.inc'
27+
28+
; PKU - Memory Protection Keys for Users:
29+
; RDPKRU, WRPKRU
30+
include 'ext\pku.inc'
31+
32+
; SEV-SNP - 3rd generation Secure Encrypted Virtualization - Secure Nested Paging:
33+
; PSMASH, PVALIDATE, RMPADJUST, RMPUPDATE
34+
include 'ext\sev_snp.inc'

tools/asmgmini.cmd

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
set this=C:\gwork\fasmg-umbrella
5+
rem Configure environment to build examples:
6+
set path=%this%\fasmg\core;%path%
7+
rem Order is important, FIFO search:
8+
set include=%this%;%this%\addon\packages\x64\include;%this%\fasmg\packages\x86\include
9+
10+
rem ----- rebuild asmgmini if changes to file are newer -----
11+
rem (datetime format based on locale, echo output to debug)
12+
set _executable_=10/10/2010 1:01:01 PM
13+
for /f "tokens=*" %%a in ('forfiles /p "asmgmini" /m "asmgmini.asm" /c "cmd /c echo @fdate @ftime" 2^>nul') do set _source_=%%a
14+
for /f "tokens=*" %%b in ('forfiles /p "..\tools" /m "asmgmini.exe" /c "cmd /c echo @fdate @ftime" 2^>nul') do set _executable_=%%b
15+
16+
if "!_source_!" gtr "!_executable_!" (
17+
fasmg asmgmini\asmgmini.asm asmgmini.exe
18+
fasmg ..\fasmg\core\source\windows\dll\fasmg.asm fasmg.dll
19+
)
20+
rem Start editor and close command window:
21+
start /B "" "asmgmini.exe"

tools/asmgmini/asmgmini.asm

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ assert WINDOW_LIMIT_WIDTH > BORDER_SIZE*3 + 2*32
4444
assert WINDOW_LIMIT_HEIGHT > BORDER_SIZE*2 + 32
4545

4646

47-
4847
format PE GUI 4.0
4948
entry start
5049

0 commit comments

Comments
 (0)