Skip to content

Commit 37a8c94

Browse files
committedMar 4, 2024·
Applied some of the syntax recomandations from https://cdrdv2.intel.com/v1/dl/getContent/817241.
1 parent 02cbe6a commit 37a8c94

File tree

8 files changed

+2810
-2604
lines changed

8 files changed

+2810
-2604
lines changed
 

‎CHANGELOG.md

+22
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ All notable (user-facing) changes to this project will be documented in this fil
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77

8+
## [2.1.3] - 2024-03-04
9+
10+
### Changed
11+
- Aligned BDDISASM APX instructions syntax with some of the Intel recomandations (using the suffix notation for `NF` and `ZU` indications, using finite set notation for `DFV` operands).
12+
13+
### Disassembly differences
14+
- The `ZU` indication is appended as a mnemonic sufix, as per recomandations. However, in case of `SETcc` instructions, BDDISASM will append the `ZU` indication AFTER the condition code (similar to `CMPccXADD` and with initial `SETcc.ZU` specification).
15+
- The `DFV` (default flags value) operand obeys the finite set notation, but it is placed as the last operand of the instruction.
16+
17+
18+
## [2.1.2] - 2024-02-27
19+
20+
### Added
21+
- `Read` access for the `rIP` operand for the `SYSCALL` instruction.
22+
- `SCS`, `rCX`, `rDX` operands for the `SYSEXIT` instruction.
23+
24+
25+
## [2.1.1] - 2024-02-26
26+
27+
### Added
28+
- `Read` access for the `rIP` operand for some `CALL` instructions.
29+
830

931
## [2.1.0] - 2024-02-20
1032

‎bddisasm/bdx86_formatter.c

+32-10
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,14 @@ NdToText(
311311
// Store NF specifier, if NoFlags presetn.
312312
if (Instrux->HasNf)
313313
{
314-
res = nd_strcat_s(Buffer, BufferSize, "{NF}");
314+
res = nd_strcat_s(Buffer, BufferSize, "NF");
315315
RET_EQ(res, ND_NULL, ND_STATUS_BUFFER_OVERFLOW);
316316
}
317317

318318
// Store ZU specifier, if ZeroUpper present.
319319
if (Instrux->HasZu)
320320
{
321-
res = nd_strcat_s(Buffer, BufferSize, "{ZU}");
321+
res = nd_strcat_s(Buffer, BufferSize, "ZU");
322322
RET_EQ(res, ND_NULL, ND_STATUS_BUFFER_OVERFLOW);
323323
}
324324

@@ -710,17 +710,39 @@ NdToText(
710710

711711
case ND_OP_DFV:
712712
{
713-
status = NdSprintf(temp, sizeof(temp), "%c%c%c%c",
714-
pOp->Info.DefaultFlags.OF ? '1' : '0',
715-
pOp->Info.DefaultFlags.SF ? '1' : '0',
716-
pOp->Info.DefaultFlags.ZF ? '1' : '0',
717-
pOp->Info.DefaultFlags.CF ? '1' : '0');
718-
if (!ND_SUCCESS(status))
713+
ND_BOOL comma = ND_FALSE;
714+
715+
res = nd_strcat_s(Buffer, BufferSize, "{dfv=");
716+
RET_EQ(res, ND_NULL, ND_STATUS_BUFFER_OVERFLOW);
717+
718+
if (pOp->Info.DefaultFlags.OF)
719719
{
720-
return status;
720+
res = nd_strcat_s(Buffer, BufferSize, "OF");
721+
RET_EQ(res, ND_NULL, ND_STATUS_BUFFER_OVERFLOW);
722+
comma = ND_TRUE;
721723
}
722724

723-
res = nd_strcat_s(Buffer, BufferSize, temp);
725+
if (pOp->Info.DefaultFlags.SF)
726+
{
727+
res = nd_strcat_s(Buffer, BufferSize, comma ? ",SF" : "SF");
728+
RET_EQ(res, ND_NULL, ND_STATUS_BUFFER_OVERFLOW);
729+
comma = ND_TRUE;
730+
}
731+
732+
if (pOp->Info.DefaultFlags.ZF)
733+
{
734+
res = nd_strcat_s(Buffer, BufferSize, comma ? ",ZF" : "ZF");
735+
RET_EQ(res, ND_NULL, ND_STATUS_BUFFER_OVERFLOW);
736+
comma = ND_TRUE;
737+
}
738+
739+
if (pOp->Info.DefaultFlags.CF)
740+
{
741+
res = nd_strcat_s(Buffer, BufferSize, comma ? ",CF" : "CF");
742+
RET_EQ(res, ND_NULL, ND_STATUS_BUFFER_OVERFLOW);
743+
}
744+
745+
res = nd_strcat_s(Buffer, BufferSize, "}");
724746
RET_EQ(res, ND_NULL, ND_STATUS_BUFFER_OVERFLOW);
725747
}
726748
break;

‎bddisasm_test/x86/apx/apx1_64.result

+2,592-2,592
Large diffs are not rendered by default.

‎bddisasm_test/x86/apx/apx3_64.result

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
0000000000000000 626c8902813ebdbdbdbd CCMPC qword ptr [r22], 0xbdbdbdbd, {dfv=OF,SF,ZF}
2+
DSIZE: 64, ASIZE: 64, VLEN: -
3+
ISA Set: APX_F, Ins cat: APX, CET tracked: no
4+
CPUID leaf: 0x00000007, sub-leaf: 0x00000001, reg: edx, bit: 21
5+
EVEX Tuple Type: None
6+
Exception class: APX, exception type: APX-EVEX-CCMP
7+
FLAGS access
8+
CF: t,
9+
Valid modes
10+
R0: yes, R1: yes, R2: yes, R3: yes
11+
Real: no, V8086: no, Prot: yes, Compat: yes, Long: yes
12+
SMM on: yes, SMM off: yes, SGX on: yes, SGX off: yes, TSX on: yes, TSX off: yes
13+
VMXRoot: yes, VMXNonRoot: yes, VMXRoot SEAM: yes, VMXNonRoot SEAM: yes, VMX off: yes
14+
Valid prefixes
15+
REP: no, REPcc: no, LOCK: no
16+
HLE: no, XACQUIRE only: no, XRELEASE only: no
17+
BND: no, BHINT: no, DNT: no
18+
Operand: 0, Acc: R-, Type: Memory, Size: 8, RawSize: 8, Encoding: M,
19+
Segment: 3, Base: 22,
20+
Operand: 1, Acc: R-, Type: Immediate, Size: 4, RawSize: 4, Encoding: I
21+
Operand: 2, Acc: R-, Type: Default flags, Size: 0, RawSize: 0, Encoding: V
22+
Operand: 3, Acc: -W, Type: Register, Size: 8, RawSize: 8, Encoding: S, RegType: Flags, RegSize: 8, RegId: 0, RegCount: 1
23+
24+
000000000000000A 626c9902813ebdbdbdbd CCMPC qword ptr [r22], 0xbdbdbdbd, {dfv=OF,SF}
25+
DSIZE: 64, ASIZE: 64, VLEN: -
26+
ISA Set: APX_F, Ins cat: APX, CET tracked: no
27+
CPUID leaf: 0x00000007, sub-leaf: 0x00000001, reg: edx, bit: 21
28+
EVEX Tuple Type: None
29+
Exception class: APX, exception type: APX-EVEX-CCMP
30+
FLAGS access
31+
CF: t,
32+
Valid modes
33+
R0: yes, R1: yes, R2: yes, R3: yes
34+
Real: no, V8086: no, Prot: yes, Compat: yes, Long: yes
35+
SMM on: yes, SMM off: yes, SGX on: yes, SGX off: yes, TSX on: yes, TSX off: yes
36+
VMXRoot: yes, VMXNonRoot: yes, VMXRoot SEAM: yes, VMXNonRoot SEAM: yes, VMX off: yes
37+
Valid prefixes
38+
REP: no, REPcc: no, LOCK: no
39+
HLE: no, XACQUIRE only: no, XRELEASE only: no
40+
BND: no, BHINT: no, DNT: no
41+
Operand: 0, Acc: R-, Type: Memory, Size: 8, RawSize: 8, Encoding: M,
42+
Segment: 3, Base: 22,
43+
Operand: 1, Acc: R-, Type: Immediate, Size: 4, RawSize: 4, Encoding: I
44+
Operand: 2, Acc: R-, Type: Default flags, Size: 0, RawSize: 0, Encoding: V
45+
Operand: 3, Acc: -W, Type: Register, Size: 8, RawSize: 8, Encoding: S, RegType: Flags, RegSize: 8, RegId: 0, RegCount: 1
46+
47+
0000000000000014 626cc902813ebdbdbdbd CCMPC qword ptr [r22], 0xbdbdbdbd, {dfv=SF,ZF}
48+
DSIZE: 64, ASIZE: 64, VLEN: -
49+
ISA Set: APX_F, Ins cat: APX, CET tracked: no
50+
CPUID leaf: 0x00000007, sub-leaf: 0x00000001, reg: edx, bit: 21
51+
EVEX Tuple Type: None
52+
Exception class: APX, exception type: APX-EVEX-CCMP
53+
FLAGS access
54+
CF: t,
55+
Valid modes
56+
R0: yes, R1: yes, R2: yes, R3: yes
57+
Real: no, V8086: no, Prot: yes, Compat: yes, Long: yes
58+
SMM on: yes, SMM off: yes, SGX on: yes, SGX off: yes, TSX on: yes, TSX off: yes
59+
VMXRoot: yes, VMXNonRoot: yes, VMXRoot SEAM: yes, VMXNonRoot SEAM: yes, VMX off: yes
60+
Valid prefixes
61+
REP: no, REPcc: no, LOCK: no
62+
HLE: no, XACQUIRE only: no, XRELEASE only: no
63+
BND: no, BHINT: no, DNT: no
64+
Operand: 0, Acc: R-, Type: Memory, Size: 8, RawSize: 8, Encoding: M,
65+
Segment: 3, Base: 22,
66+
Operand: 1, Acc: R-, Type: Immediate, Size: 4, RawSize: 4, Encoding: I
67+
Operand: 2, Acc: R-, Type: Default flags, Size: 0, RawSize: 0, Encoding: V
68+
Operand: 3, Acc: -W, Type: Register, Size: 8, RawSize: 8, Encoding: S, RegType: Flags, RegSize: 8, RegId: 0, RegCount: 1
69+
70+
000000000000001E 626cd902813ebdbdbdbd CCMPC qword ptr [r22], 0xbdbdbdbd, {dfv=SF}
71+
DSIZE: 64, ASIZE: 64, VLEN: -
72+
ISA Set: APX_F, Ins cat: APX, CET tracked: no
73+
CPUID leaf: 0x00000007, sub-leaf: 0x00000001, reg: edx, bit: 21
74+
EVEX Tuple Type: None
75+
Exception class: APX, exception type: APX-EVEX-CCMP
76+
FLAGS access
77+
CF: t,
78+
Valid modes
79+
R0: yes, R1: yes, R2: yes, R3: yes
80+
Real: no, V8086: no, Prot: yes, Compat: yes, Long: yes
81+
SMM on: yes, SMM off: yes, SGX on: yes, SGX off: yes, TSX on: yes, TSX off: yes
82+
VMXRoot: yes, VMXNonRoot: yes, VMXRoot SEAM: yes, VMXNonRoot SEAM: yes, VMX off: yes
83+
Valid prefixes
84+
REP: no, REPcc: no, LOCK: no
85+
HLE: no, XACQUIRE only: no, XRELEASE only: no
86+
BND: no, BHINT: no, DNT: no
87+
Operand: 0, Acc: R-, Type: Memory, Size: 8, RawSize: 8, Encoding: M,
88+
Segment: 3, Base: 22,
89+
Operand: 1, Acc: R-, Type: Immediate, Size: 4, RawSize: 4, Encoding: I
90+
Operand: 2, Acc: R-, Type: Default flags, Size: 0, RawSize: 0, Encoding: V
91+
Operand: 3, Acc: -W, Type: Register, Size: 8, RawSize: 8, Encoding: S, RegType: Flags, RegSize: 8, RegId: 0, RegCount: 1
92+
93+
0000000000000028 626ce902813ebdbdbdbd CCMPC qword ptr [r22], 0xbdbdbdbd, {dfv=ZF}
94+
DSIZE: 64, ASIZE: 64, VLEN: -
95+
ISA Set: APX_F, Ins cat: APX, CET tracked: no
96+
CPUID leaf: 0x00000007, sub-leaf: 0x00000001, reg: edx, bit: 21
97+
EVEX Tuple Type: None
98+
Exception class: APX, exception type: APX-EVEX-CCMP
99+
FLAGS access
100+
CF: t,
101+
Valid modes
102+
R0: yes, R1: yes, R2: yes, R3: yes
103+
Real: no, V8086: no, Prot: yes, Compat: yes, Long: yes
104+
SMM on: yes, SMM off: yes, SGX on: yes, SGX off: yes, TSX on: yes, TSX off: yes
105+
VMXRoot: yes, VMXNonRoot: yes, VMXRoot SEAM: yes, VMXNonRoot SEAM: yes, VMX off: yes
106+
Valid prefixes
107+
REP: no, REPcc: no, LOCK: no
108+
HLE: no, XACQUIRE only: no, XRELEASE only: no
109+
BND: no, BHINT: no, DNT: no
110+
Operand: 0, Acc: R-, Type: Memory, Size: 8, RawSize: 8, Encoding: M,
111+
Segment: 3, Base: 22,
112+
Operand: 1, Acc: R-, Type: Immediate, Size: 4, RawSize: 4, Encoding: I
113+
Operand: 2, Acc: R-, Type: Default flags, Size: 0, RawSize: 0, Encoding: V
114+
Operand: 3, Acc: -W, Type: Register, Size: 8, RawSize: 8, Encoding: S, RegType: Flags, RegSize: 8, RegId: 0, RegCount: 1
115+
116+
0000000000000032 626cf102813ebdbdbdbd CCMPC qword ptr [r22], 0xbdbdbdbd, {dfv=CF}
117+
DSIZE: 64, ASIZE: 64, VLEN: -
118+
ISA Set: APX_F, Ins cat: APX, CET tracked: no
119+
CPUID leaf: 0x00000007, sub-leaf: 0x00000001, reg: edx, bit: 21
120+
EVEX Tuple Type: None
121+
Exception class: APX, exception type: APX-EVEX-CCMP
122+
FLAGS access
123+
CF: t,
124+
Valid modes
125+
R0: yes, R1: yes, R2: yes, R3: yes
126+
Real: no, V8086: no, Prot: yes, Compat: yes, Long: yes
127+
SMM on: yes, SMM off: yes, SGX on: yes, SGX off: yes, TSX on: yes, TSX off: yes
128+
VMXRoot: yes, VMXNonRoot: yes, VMXRoot SEAM: yes, VMXNonRoot SEAM: yes, VMX off: yes
129+
Valid prefixes
130+
REP: no, REPcc: no, LOCK: no
131+
HLE: no, XACQUIRE only: no, XRELEASE only: no
132+
BND: no, BHINT: no, DNT: no
133+
Operand: 0, Acc: R-, Type: Memory, Size: 8, RawSize: 8, Encoding: M,
134+
Segment: 3, Base: 22,
135+
Operand: 1, Acc: R-, Type: Immediate, Size: 4, RawSize: 4, Encoding: I
136+
Operand: 2, Acc: R-, Type: Default flags, Size: 0, RawSize: 0, Encoding: V
137+
Operand: 3, Acc: -W, Type: Register, Size: 8, RawSize: 8, Encoding: S, RegType: Flags, RegSize: 8, RegId: 0, RegCount: 1
138+
139+
000000000000003C 626c8102813ebdbdbdbd CCMPC qword ptr [r22], 0xbdbdbdbd, {dfv=OF,SF,ZF,CF}
140+
DSIZE: 64, ASIZE: 64, VLEN: -
141+
ISA Set: APX_F, Ins cat: APX, CET tracked: no
142+
CPUID leaf: 0x00000007, sub-leaf: 0x00000001, reg: edx, bit: 21
143+
EVEX Tuple Type: None
144+
Exception class: APX, exception type: APX-EVEX-CCMP
145+
FLAGS access
146+
CF: t,
147+
Valid modes
148+
R0: yes, R1: yes, R2: yes, R3: yes
149+
Real: no, V8086: no, Prot: yes, Compat: yes, Long: yes
150+
SMM on: yes, SMM off: yes, SGX on: yes, SGX off: yes, TSX on: yes, TSX off: yes
151+
VMXRoot: yes, VMXNonRoot: yes, VMXRoot SEAM: yes, VMXNonRoot SEAM: yes, VMX off: yes
152+
Valid prefixes
153+
REP: no, REPcc: no, LOCK: no
154+
HLE: no, XACQUIRE only: no, XRELEASE only: no
155+
BND: no, BHINT: no, DNT: no
156+
Operand: 0, Acc: R-, Type: Memory, Size: 8, RawSize: 8, Encoding: M,
157+
Segment: 3, Base: 22,
158+
Operand: 1, Acc: R-, Type: Immediate, Size: 4, RawSize: 4, Encoding: I
159+
Operand: 2, Acc: R-, Type: Default flags, Size: 0, RawSize: 0, Encoding: V
160+
Operand: 3, Acc: -W, Type: Register, Size: 8, RawSize: 8, Encoding: S, RegType: Flags, RegSize: 8, RegId: 0, RegCount: 1
161+

‎bddisasm_test/x86/apx/apx3_64.test

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bl��>����bl��>����bl��>����bl��>����bl��>����bl��>����bl��>����

‎bdshemu_test/x86/bdshemu_test_x86.zip

-72 Bytes
Binary file not shown.

‎bindings/pybddisasm/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from codecs import open
1313

1414
VERSION = (0, 3, 0)
15-
LIBRARY_VERSION = (2, 1, 2)
15+
LIBRARY_VERSION = (2, 1, 3)
1616
DIR_INCLUDE = '../../inc'
1717

1818
here = os.path.abspath(os.path.dirname(__file__))

‎inc/bddisasm_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#define DISASM_VERSION_MAJOR 2
99
#define DISASM_VERSION_MINOR 1
10-
#define DISASM_VERSION_REVISION 2
10+
#define DISASM_VERSION_REVISION 3
1111

1212
#define SHEMU_VERSION_MAJOR DISASM_VERSION_MAJOR
1313
#define SHEMU_VERSION_MINOR DISASM_VERSION_MINOR

0 commit comments

Comments
 (0)
Please sign in to comment.