mirror of
https://github.com/RPCSX/xed.git
synced 2026-01-31 01:05:17 +01:00
override-able chip mode operand settings
* allow setting operands based chip & feature settings. The xed-chi-modes-override.c file can be replaced in extended builds. Change-Id: I2452bd56372fb7cd78c0c61c6f03381e7406d532 (cherry picked from commit 872552242193cd0b50c8cc98f5b6f61e0c17cbbd)
This commit is contained in:
committed by
Mark Charney
parent
486661644c
commit
7248925e7d
@@ -400,12 +400,13 @@ def build_examples(env, work_queue):
|
||||
example,
|
||||
cc_shared_objs + [ link_libxed ]))
|
||||
# compile & link ild_examples
|
||||
for example in env.src_dir_join(ild_examples):
|
||||
example_exes.append(ex_compile_and_link(env_c,
|
||||
examples_dag,
|
||||
example,
|
||||
[ env['link_libild'] ]))
|
||||
|
||||
if os.path.exists(env['link_libild']):
|
||||
for example in env.src_dir_join(ild_examples):
|
||||
example_exes.append(ex_compile_and_link(env_c,
|
||||
examples_dag,
|
||||
example,
|
||||
[ env['link_libild'] ]))
|
||||
|
||||
# compile & link small_examples
|
||||
for example in env.src_dir_join(small_examples):
|
||||
example_exes.append(ex_compile_and_link(env_c,
|
||||
|
||||
29
include/private/xed-chip-modes-override.h
Normal file
29
include/private/xed-chip-modes-override.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*BEGIN_LEGAL
|
||||
|
||||
Copyright (c) 2017 Intel Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
END_LEGAL */
|
||||
|
||||
#if !defined(XED_CHIP_MODES_OVERRIDE)
|
||||
# define XED_CHIP_MODES_OVERRIDE
|
||||
|
||||
# include "xed-chip-enum.h"
|
||||
# include "xed-decoded-inst.h"
|
||||
# include "xed-chip-features.h"
|
||||
|
||||
void xed_chip_modes_override(xed_decoded_inst_t* xedd,
|
||||
xed_chip_enum_t chip,
|
||||
xed_chip_features_t* features);
|
||||
#endif
|
||||
32
src/xed-chip-modes-override.c
Normal file
32
src/xed-chip-modes-override.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/*BEGIN_LEGAL
|
||||
|
||||
Copyright (c) 2017 Intel Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
END_LEGAL */
|
||||
|
||||
/* this function is called by set_chip_modes in xed-chip-modes.c to add new
|
||||
* functionality in extended builds for setting modes that cannot be placed
|
||||
* in the public sources. */
|
||||
|
||||
#include "xed-chip-modes-override.h"
|
||||
void xed_chip_modes_override(xed_decoded_inst_t* xedd,
|
||||
xed_chip_enum_t chip,
|
||||
xed_chip_features_t* features)
|
||||
{
|
||||
// empty function
|
||||
(void) xedd; // pacify compiler
|
||||
(void) chip;
|
||||
(void) features;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*BEGIN_LEGAL
|
||||
|
||||
Copyright (c) 2016 Intel Corporation
|
||||
Copyright (c) 2017 Intel Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,8 @@ END_LEGAL */
|
||||
#include "xed-interface.h"
|
||||
#include "xed-isa-set.h"
|
||||
#include "xed-chip-features-private.h"
|
||||
|
||||
#include "xed-chip-modes-override.h"
|
||||
void
|
||||
set_chip_modes(xed_decoded_inst_t* xedd,
|
||||
xed_chip_enum_t chip,
|
||||
@@ -61,36 +63,39 @@ set_chip_modes(xed_decoded_inst_t* xedd,
|
||||
xed3_operand_set_modep55c(xedd,1);
|
||||
first_prefix = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (first_prefix)
|
||||
xed3_operand_set_mode_first_prefix(xedd,1);
|
||||
xed_chip_modes_override(xedd, chip, features); //replaceable function
|
||||
|
||||
if (first_prefix)
|
||||
xed3_operand_set_mode_first_prefix(xedd,1);
|
||||
|
||||
/* set the P4-ness for ISA-set rejection */
|
||||
p4 = 1;
|
||||
if (chip != XED_CHIP_INVALID)
|
||||
if ( xed_isa_set_is_valid_for_chip(XED_ISA_SET_PAUSE, chip) == 0 )
|
||||
p4 = 0;
|
||||
xed3_operand_set_p4(xedd,p4);
|
||||
/* set the P4-ness for ISA-set rejection */
|
||||
p4 = 1;
|
||||
if (chip != XED_CHIP_INVALID)
|
||||
if ( xed_isa_set_is_valid_for_chip(XED_ISA_SET_PAUSE, chip) == 0 )
|
||||
p4 = 0;
|
||||
xed3_operand_set_p4(xedd,p4);
|
||||
|
||||
|
||||
/* LZCNT / TZCNT show up on HSW. LZCNT has its own CPUID bit, TZCNT is on
|
||||
* BMI1. */
|
||||
lzcnt = 1;
|
||||
tzcnt = 1;
|
||||
if (chip != XED_CHIP_INVALID) {
|
||||
if ( xed_isa_set_is_valid_for_chip(XED_ISA_SET_LZCNT, chip) == 0 )
|
||||
lzcnt = 0;
|
||||
if ( xed_isa_set_is_valid_for_chip(XED_ISA_SET_BMI1, chip) == 0 )
|
||||
tzcnt = 0;
|
||||
}
|
||||
if (features) {
|
||||
lzcnt = xed_test_chip_features(features, XED_ISA_SET_LZCNT);
|
||||
tzcnt = xed_test_chip_features(features, XED_ISA_SET_BMI1);
|
||||
}
|
||||
xed3_operand_set_lzcnt(xedd,lzcnt);
|
||||
xed3_operand_set_tzcnt(xedd,tzcnt);
|
||||
/* LZCNT / TZCNT show up on HSW. LZCNT has its own CPUID bit, TZCNT is on
|
||||
* BMI1. */
|
||||
lzcnt = 1;
|
||||
tzcnt = 1;
|
||||
if (chip != XED_CHIP_INVALID) {
|
||||
if ( xed_isa_set_is_valid_for_chip(XED_ISA_SET_LZCNT, chip) == 0 )
|
||||
lzcnt = 0;
|
||||
if ( xed_isa_set_is_valid_for_chip(XED_ISA_SET_BMI1, chip) == 0 )
|
||||
tzcnt = 0;
|
||||
}
|
||||
if (features) {
|
||||
lzcnt = xed_test_chip_features(features, XED_ISA_SET_LZCNT);
|
||||
tzcnt = xed_test_chip_features(features, XED_ISA_SET_BMI1);
|
||||
}
|
||||
xed3_operand_set_lzcnt(xedd,lzcnt);
|
||||
xed3_operand_set_tzcnt(xedd,tzcnt);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# -*- python -*-
|
||||
#BEGIN_LEGAL
|
||||
#
|
||||
#Copyright (c) 2016 Intel Corporation
|
||||
#Copyright (c) 2017 Intel Corporation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -948,20 +948,22 @@ def _wk_show_errors_only():
|
||||
|
||||
def build_xed_ild_library(env, lib_env, lib_dag):
|
||||
# compile sources specific to ild
|
||||
xed_ild_sources = ['xed-init-ild.c', 'xed-ild-support.c']
|
||||
xed_ild_sources = ['xed-init-ild.c', 'xed-ild-support.c']
|
||||
ild_objs = lib_env.compile( lib_dag, xbc.src_dir_join(lib_env,
|
||||
xed_ild_sources))
|
||||
xed_ild_sources))
|
||||
# grab common sources compiled earlier
|
||||
ild_objs += xbc.build_dir_join(lib_env,
|
||||
lib_env.make_obj(['xed-ild.c',
|
||||
'xed-isa-set.c',
|
||||
'xed-chip-features.c',
|
||||
'xed-chip-features-table.c',
|
||||
'xed-chip-modes.c',
|
||||
'xed-ild-disp-l3.c',
|
||||
'xed-ild-eosz.c',
|
||||
'xed-ild-easz.c',
|
||||
'xed-ild-imm-l3.c']))
|
||||
common_sources = ['xed-ild.c',
|
||||
'xed-isa-set.c',
|
||||
'xed-chip-features.c',
|
||||
'xed-chip-features-table.c',
|
||||
'xed-chip-modes.c',
|
||||
'xed-chip-modes-override.c',
|
||||
'xed-ild-disp-l3.c',
|
||||
'xed-ild-eosz.c',
|
||||
'xed-ild-easz.c',
|
||||
'xed-ild-imm-l3.c']
|
||||
common_objs = lib_env.make_obj(common_sources)
|
||||
ild_objs += xbc.build_dir_join(lib_env, common_objs)
|
||||
|
||||
lib,dll = xbc.make_lib_dll(env,'xed-ild')
|
||||
|
||||
@@ -1412,7 +1414,7 @@ def build_libxed(env,work_queue):
|
||||
sources_to_remove.extend(['xed-init-ild.c',
|
||||
'xed-ild-support.c']) # stuff for standalone ild
|
||||
sources_to_remove = xbc.src_dir_join(env, sources_to_remove)
|
||||
|
||||
|
||||
generated_sources_to_remove = []
|
||||
if not env['decoder']:
|
||||
decoder_sources_to_remove = [
|
||||
@@ -1495,7 +1497,8 @@ def build_libxed(env,work_queue):
|
||||
|
||||
if okay and env['shared'] and not env['debug']:
|
||||
xbc.strip_file(env, env['shd_libxed'], '-x')
|
||||
xbc.strip_file(lib_env, env['shd_libild'], '-x')
|
||||
if os.path.exists(env['shd_libild']):
|
||||
xbc.strip_file(lib_env, env['shd_libild'], '-x')
|
||||
if not okay:
|
||||
xbc.cdie("Library build failed")
|
||||
if mbuild.verbose(2):
|
||||
|
||||
Reference in New Issue
Block a user