instrs: Add support for undocumented instructions
Undocumented instruction are not decoded by default. - SALC: undocumented in any recent manual and unsupported by newer Intel CPUs. Including as listed by [1,2]. - Undocumented FPU instructions: see [2]. [1]: http://www.rcollins.org/secrets/opcodes/SALC.html [2]: https://github.com/xoreaxeaxeax/sandsifter/issues/33
This commit is contained in:
@@ -252,7 +252,7 @@ d3/6 MC GP GP8 - - SHL
|
||||
d3/7 MC GP GP8 - - SAR
|
||||
d4 I IMM - - - AAM ONLY32 SIZE_8
|
||||
d5 I IMM - - - AAD ONLY32 SIZE_8
|
||||
#d6 unused
|
||||
d6 NP - - - - SALC ONLY32 UNDOC
|
||||
d7 NP - - - - XLATB
|
||||
#d8-df FPU Escape
|
||||
e0 D IMM - - - LOOPNZ FORCE64 IMM_8
|
||||
@@ -1357,8 +1357,11 @@ db/0r M FPU - - - FCMOVNB
|
||||
db/1r M FPU - - - FCMOVNE
|
||||
db/2r M FPU - - - FCMOVNBE
|
||||
db/3r M FPU - - - FCMOVNU
|
||||
dbe0 NP - - - - FENI8087_NOP UNDOC
|
||||
dbe1 NP - - - - FDISI8087_NOP UNDOC
|
||||
dbe2 NP - - - - FCLEX
|
||||
dbe3 NP - - - - FINIT
|
||||
dbe4 NP - - - - FSETPM287_NOP UNDOC
|
||||
db/5r M FPU - - - FUCOMI
|
||||
db/6r M FPU - - - FCOMI
|
||||
dc/0m M MEM64 - - - FADD ENC_SEPSZ
|
||||
@@ -1371,6 +1374,8 @@ dc/6m M MEM64 - - - FDIV ENC_SEPSZ
|
||||
dc/7m M MEM64 - - - FDIVR ENC_SEPSZ
|
||||
dc/0r MA FPU FPU - - FADD
|
||||
dc/1r MA FPU FPU - - FMUL
|
||||
dc/2r MA FPU FPU - - FCOM UNDOC
|
||||
dc/3r MA FPU FPU - - FCOMP UNDOC
|
||||
dc/4r MA FPU FPU - - FSUBR
|
||||
dc/5r MA FPU FPU - - FSUB
|
||||
dc/6r MA FPU FPU - - FDIVR
|
||||
@@ -1410,6 +1415,7 @@ df/4m M FPU - - - FBLD
|
||||
df/5m M MEM64 - - - FILD ENC_SEPSZ
|
||||
df/6m M FPU - - - FBSTP
|
||||
df/7m M MEM64 - - - FISTP ENC_SEPSZ
|
||||
df/0r M FPU - - - FFREEP UNDOC
|
||||
# FSTSW AX
|
||||
dfe0 A GP16 - - - FSTSW
|
||||
df/5r AM FPU FPU - - FUCOMIP
|
||||
|
||||
@@ -35,6 +35,9 @@ endif
|
||||
if get_option('archmode') != 'only32'
|
||||
generate_args += ['--64']
|
||||
endif
|
||||
if get_option('with_undoc')
|
||||
generate_args += ['--with-undoc']
|
||||
endif
|
||||
|
||||
instr_data = custom_target('tables',
|
||||
command: [python3, '@INPUT0@', '@INPUT1@', '@OUTPUT@'] + generate_args,
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
option('archmode', type: 'combo', choices: ['both', 'only32', 'only64'])
|
||||
option('with_undoc', type: 'boolean', value: false)
|
||||
|
||||
@@ -471,7 +471,7 @@ def encode_table(entries):
|
||||
for opcode, desc in entries:
|
||||
if desc.mnemonic[:9] == "RESERVED_":
|
||||
continue
|
||||
if "ONLY32" in desc.flags or "UNDOC" in desc.flags:
|
||||
if "ONLY32" in desc.flags:
|
||||
continue
|
||||
|
||||
opsizes = {8} if "SIZE_8" in desc.flags else {16, 32, 64}
|
||||
@@ -615,6 +615,7 @@ if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--32", dest="modes", action="append_const", const=32)
|
||||
parser.add_argument("--64", dest="modes", action="append_const", const=64)
|
||||
parser.add_argument("--with-undoc", action="store_true")
|
||||
parser.add_argument("table", type=argparse.FileType('r'))
|
||||
parser.add_argument("decode_mnems", type=argparse.FileType('w'))
|
||||
parser.add_argument("decode_table", type=argparse.FileType('w'))
|
||||
@@ -625,8 +626,10 @@ if __name__ == "__main__":
|
||||
entries = []
|
||||
for line in args.table.read().splitlines():
|
||||
if not line or line[0] == "#": continue
|
||||
opcode_string, desc = tuple(line.split(maxsplit=1))
|
||||
entries.append((Opcode.parse(opcode_string), InstrDesc.parse(desc)))
|
||||
opcode_string, desc_string = tuple(line.split(maxsplit=1))
|
||||
opcode, desc = Opcode.parse(opcode_string), InstrDesc.parse(desc_string)
|
||||
if "UNDOC" not in desc.flags or args.with_undoc:
|
||||
entries.append((opcode, desc))
|
||||
|
||||
mnemonics = sorted({desc.mnemonic for _, desc in entries})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user