aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--causes.csv1
-rw-r--r--encoding.h5
-rwxr-xr-xparse.py17
3 files changed, 17 insertions, 6 deletions
diff --git a/causes.csv b/causes.csv
index 0fda1a4..42e51c3 100644
--- a/causes.csv
+++ b/causes.csv
@@ -13,6 +13,7 @@
0x0C, "fetch page fault"
0x0D, "load page fault"
0x0F, "store page fault"
+0x10, "double trap"
0x12, "software check fault"
0x13, "hardware error fault"
0x14, "fetch guest page fault"
diff --git a/encoding.h b/encoding.h
index 8ea8852..63d5901 100644
--- a/encoding.h
+++ b/encoding.h
@@ -101,6 +101,9 @@
#define DCSR_CAUSE_STEP 4
#define DCSR_CAUSE_HALT 5
#define DCSR_CAUSE_GROUP 6
+#define DCSR_CAUSE_EXTCAUSE 7
+
+#define DCSR_EXTCAUSE_CRITERR 0
#define MCONTROL_TYPE(xlen) (0xfULL<<((xlen)-4))
#define MCONTROL_DMODE(xlen) (1ULL<<((xlen)-5))
@@ -108,7 +111,7 @@
#define MCONTROL_SELECT (1<<19)
#define MCONTROL_TIMING (1<<18)
-#define MCONTROL_ACTION (0x3f<<12)
+#define MCONTROL_ACTION (0xf<<12)
#define MCONTROL_CHAIN (1<<11)
#define MCONTROL_MATCH (0xf<<7)
#define MCONTROL_M (1<<6)
diff --git a/parse.py b/parse.py
index 4553e06..ffbefff 100755
--- a/parse.py
+++ b/parse.py
@@ -127,7 +127,7 @@ def process_enc_line(line, ext):
# the name of the instruction
single_dict['encoding'] = "".join(encoding)
single_dict['variable_fields'] = args
- single_dict['extension'] = [ext.split('/')[-1]]
+ single_dict['extension'] = [os.path.basename(ext)]
single_dict['match']=hex(int(match,2))
single_dict['mask']=hex(int(mask,2))
@@ -235,7 +235,7 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
# call process_enc_line to get the data about the current
# instruction
(name, single_dict) = process_enc_line(line, f)
- ext_name = f.split("/")[-1]
+ ext_name = os.path.basename(f)
# if an instruction has already been added to the filtered
# instruction dictionary throw an error saying the given
@@ -315,7 +315,7 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
# extension. Else throw error.
found = False
for oline in open(ext_file):
- if not re.findall(f'^\s*{orig_inst}\s+',oline):
+ if not re.findall(f'^\\s*{orig_inst}\\s+',oline):
continue
else:
found = True
@@ -336,6 +336,13 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
if name not in instr_dict:
instr_dict[name] = single_dict
logging.debug(f' including pseudo_ops:{name}')
+ else:
+ # if a pseudo instruction has already been added to the filtered
+ # instruction dictionary but the extension is not in the current
+ # list, add it
+ ext_name = single_dict['extension']
+ if ext_name not in instr_dict[name]['extension']:
+ instr_dict[name]['extension'].extend(ext_name)
else:
logging.debug(f' Skipping pseudo_op {pseudo_inst} since original instruction {orig_inst} already selected in list')
@@ -382,7 +389,7 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
# extension. Else throw error.
found = False
for oline in open(ext_file):
- if not re.findall(f'^\s*{reg_instr}\s+',oline):
+ if not re.findall(f'^\\s*{reg_instr}\\s+',oline):
continue
else:
found = True
@@ -403,7 +410,7 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
var = instr_dict[name]["extension"]
if instr_dict[name]['encoding'] != single_dict['encoding']:
err_msg = f'imported instruction : {name} in '
- err_msg += f'{f.split("/")[-1]} is already '
+ err_msg += f'{os.path.basename(f)} is already '
err_msg += f'added from {var} but each have different encodings for the same instruction'
logging.error(err_msg)
raise SystemExit(1)