mirror of
https://github.com/RPCSX/xed.git
synced 2026-01-31 01:05:17 +01:00
* compiled kit users must refer to "#include "xed/xed-interface.h"
and xed/ on any other public headers that they reference as part
of the kit or new /usr/local installs. Or they can change their
-I flag to include the xed/ path component. All the examples
use xed/ in the #include statements now.
* new knob --prefix=/usr/local (for example) that puts the
compiled library in /usr/local/lib and the headers in
/usr/local/include/xed .
* To install in /usr/local, one typically must sudo. If you do
the whole build at sudo, then it'll create root-owned files in
your build directory whic you might not want. So I suggest
first building as the local user and then sudo only for the
final install.
> ./mfile.py
> sudo ./mfile.py --prefix=/usr/local
* There is also a --prefix-lib-dir knob to specify something other
than "lib" for /usr/local/lib. Some systems use lib, lib32 or
lib64 and I don't know how to tell which is which so I give
users a knob so they can decide for themselves.
> ./mfile.py --host-cpu=ia32
> sudo ./mfile.py --prefix=/usr/local --prefix-lib-dir=lib32
> ./mfile.py --host-cpu=intel64
> sudo ./mfile.py --prefix=/usr/local --prefix-lib-dir=lib64
* added xed-util.h to xed-interface.h
* moved headers from include/public to include/public/xed
* genutil minor cleanup
Change-Id: I3786d2280f24ff8d7e075fa7a75d90f3b28dd8c3
94 lines
2.8 KiB
C
94 lines
2.8 KiB
C
/*BEGIN_LEGAL
|
|
|
|
Copyright (c) 2016 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 */
|
|
|
|
/// @file xed-tables.c
|
|
/// @brief a minimal example of accessing the XED internal tables
|
|
|
|
#include <stdio.h>
|
|
#include "xed/xed-interface.h"
|
|
|
|
|
|
void dump_operand(const xed_operand_t* op) {
|
|
printf("%s ", xed_operand_enum_t2str(xed_operand_name(op)));
|
|
printf("%s ",
|
|
xed_operand_visibility_enum_t2str(xed_operand_operand_visibility(op)));
|
|
printf("%s ", xed_operand_action_enum_t2str(xed_operand_rw(op)));
|
|
printf("%s ", xed_operand_type_enum_t2str(xed_operand_type(op)));
|
|
printf("%s ", xed_operand_element_xtype_enum_t2str(xed_operand_xtype(op)));
|
|
if (xed_operand_type(op) == XED_OPERAND_TYPE_NT_LOOKUP_FN)
|
|
printf("%s ",
|
|
xed_nonterminal_enum_t2str(xed_operand_nonterminal_name(op)));
|
|
if (xed_operand_type(op) == XED_OPERAND_TYPE_REG)
|
|
printf("%s ", xed_reg_enum_t2str(xed_operand_reg(op)));
|
|
}
|
|
|
|
|
|
void print_attributes(const xed_inst_t* xi) {
|
|
/* Walk the attributes. Generally, you'll know the one you want to
|
|
* query and just access that one directly. */
|
|
|
|
unsigned int i, nattributes = xed_attribute_max();
|
|
|
|
printf("ATTRIBUTES: ");
|
|
for(i=0;i<nattributes;i++) {
|
|
xed_attribute_enum_t attr = xed_attribute(i);
|
|
if (xed_inst_get_attribute(xi,attr))
|
|
printf("%s ", xed_attribute_enum_t2str(attr));
|
|
}
|
|
printf("\n");
|
|
}
|
|
|
|
|
|
void dump_inst(const xed_inst_t* p) {
|
|
unsigned int j;
|
|
printf("%s ", xed_iclass_enum_t2str(xed_inst_iclass(p)));
|
|
printf("%s ", xed_iform_enum_t2str(xed_inst_iform_enum(p)));
|
|
printf("%s ", xed_category_enum_t2str(xed_inst_category(p)));
|
|
printf("%s ", xed_extension_enum_t2str(xed_inst_extension(p)));
|
|
printf("%s ", xed_isa_set_enum_t2str(xed_inst_isa_set(p)));
|
|
print_attributes(p);
|
|
printf("%2u ", xed_inst_noperands(p));
|
|
printf("\n");
|
|
for(j=0;j<xed_inst_noperands(p);j++) {
|
|
printf("\t%u ", j);
|
|
dump_operand(xed_inst_operand(p,j));
|
|
printf("\n");
|
|
}
|
|
|
|
}
|
|
|
|
void dump_insts(void) {
|
|
int i;
|
|
for(i=0;i<XED_MAX_INST_TABLE_NODES;i++) {
|
|
printf("%d ", i);
|
|
dump_inst(xed_inst_table_base()+i);
|
|
}
|
|
}
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
// initialize the XED tables -- one time.
|
|
xed_tables_init();
|
|
|
|
dump_insts();
|
|
|
|
|
|
return 0;
|
|
(void) argc; (void) argv; //pacify compiler
|
|
}
|