Skip to content

Commit e7726c3

Browse files
committed
fix enc2 for ud0 modrm varying core/atom implementations
1 parent 7561f54 commit e7726c3

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

pysrc/enc2gen.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -5155,6 +5155,12 @@ def xed_mode_removal(env,ii):
51555155
return True
51565156
if 'CET=0' in ii.pattern:
51575157
return True
5158+
if env.short_ud0:
5159+
if 'MODE_SHORT_UD0=0' in ii.pattern: # long UD0
5160+
return True # skip
5161+
else: # long ud0
5162+
if 'MODE_SHORT_UD0=1' in ii.pattern: # short UD0
5163+
return True # skip
51585164
return False
51595165

51605166

@@ -5331,12 +5337,13 @@ def gather_stats(db):
53315337

53325338
# object used for the env we pass to the generator
53335339
class enc_env_t(object):
5334-
def __init__(self, mode, asz, width_info_dict, test_checked_interface=False):
5340+
def __init__(self, mode, asz, width_info_dict, test_checked_interface=False, short_ud0=False):
53355341
self.mode = mode
53365342
self.asz = asz
53375343
self.function_names = {}
53385344
self.test_checked_interface = test_checked_interface
53395345
self.tests_per_form = 1
5346+
self.short_ud0 = short_ud0
53405347
# dictionary by oc2 of the various memop bit widths.
53415348
self.width_info_dict = width_info_dict
53425349
def __str__(self):
@@ -5404,6 +5411,12 @@ def emit_encode_functions(args,
54045411
def work():
54055412

54065413
arg_parser = argparse.ArgumentParser(description="Create XED encoder2")
5414+
arg_parser.add_argument('-short-ud0',
5415+
help='Encode 2-byte UD0 (default is long UD0 as implemented on modern Intel Core processors. Intel Atom processors implement short 2-byte UD0)',
5416+
dest='short_ud0',
5417+
action='store_true',
5418+
default=False)
5419+
54075420
arg_parser.add_argument('-m64',
54085421
help='64b mode (default)',
54095422
dest='modes', action='append_const', const=64)
@@ -5509,7 +5522,8 @@ def prune_asz_list_for_mode(mode,alist):
55095522
#extra_headers = ['xed/xed-encode-direct.h']
55105523
for mode in args.modes:
55115524
for asz in prune_asz_list_for_mode(mode,args.asz_list):
5512-
env = enc_env_t(mode, asz, width_info_dict)
5525+
env = enc_env_t(mode, asz, width_info_dict,
5526+
short_ud0=args.short_ud0)
55135527
enc2test.set_test_gen_counters(env)
55145528
env.tests_per_form = 1
55155529
env.test_checked_interface = args.chk

0 commit comments

Comments
 (0)