From 4596dbda513821613557f6cb0a03b42453ff9dae Mon Sep 17 00:00:00 2001 From: "BITDEFENDER\\vlutas" Date: Sat, 10 Sep 2022 23:15:00 +0300 Subject: [PATCH] Add copyright info when auto-generating files. --- bddisasm/bdhelpers.c | 4 ++++ bddisasm/include/instructions.h | 5 +++++ bddisasm/include/mnemonics.h | 4 ++++ bddisasm/include/table_evex.h | 4 ++++ bddisasm/include/table_root.h | 4 ++++ bddisasm/include/table_vex.h | 4 ++++ bddisasm/include/table_xop.h | 4 ++++ inc/constants.h | 5 +++++ inc/cpuidflags.h | 4 ++++ isagenerator/generate_tables.py | 24 ++++++++++++++++++------ 10 files changed, 56 insertions(+), 6 deletions(-) diff --git a/bddisasm/bdhelpers.c b/bddisasm/bdhelpers.c index 2ec0565..69627c1 100644 --- a/bddisasm/bdhelpers.c +++ b/bddisasm/bdhelpers.c @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2020 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ #include "include/nd_crt.h" #include "../inc/bddisasm.h" diff --git a/bddisasm/include/instructions.h b/bddisasm/include/instructions.h index 2e958dc..d36b1cb 100644 --- a/bddisasm/include/instructions.h +++ b/bddisasm/include/instructions.h @@ -1,3 +1,8 @@ +/* + * Copyright (c) 2020 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ + // // This file was auto-generated by generate_tables.py from defs.dat. DO NOT MODIFY! // diff --git a/bddisasm/include/mnemonics.h b/bddisasm/include/mnemonics.h index c619646..59d0d79 100644 --- a/bddisasm/include/mnemonics.h +++ b/bddisasm/include/mnemonics.h @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2020 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef MNEMONICS_H #define MNEMONICS_H diff --git a/bddisasm/include/table_evex.h b/bddisasm/include/table_evex.h index 868b43c..ca8b3ac 100644 --- a/bddisasm/include/table_evex.h +++ b/bddisasm/include/table_evex.h @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2020 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef TABLE_EVEX_H #define TABLE_EVEX_H diff --git a/bddisasm/include/table_root.h b/bddisasm/include/table_root.h index a1d0ca0..f32c6a7 100644 --- a/bddisasm/include/table_root.h +++ b/bddisasm/include/table_root.h @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2020 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef TABLE_ROOT_H #define TABLE_ROOT_H diff --git a/bddisasm/include/table_vex.h b/bddisasm/include/table_vex.h index 66ba995..64e7b9b 100644 --- a/bddisasm/include/table_vex.h +++ b/bddisasm/include/table_vex.h @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2020 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef TABLE_VEX_H #define TABLE_VEX_H diff --git a/bddisasm/include/table_xop.h b/bddisasm/include/table_xop.h index 7a07c81..511747c 100644 --- a/bddisasm/include/table_xop.h +++ b/bddisasm/include/table_xop.h @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2020 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef TABLE_XOP_H #define TABLE_XOP_H diff --git a/inc/constants.h b/inc/constants.h index df0c062..ca1389c 100644 --- a/inc/constants.h +++ b/inc/constants.h @@ -1,3 +1,8 @@ +/* + * Copyright (c) 2020 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ + // // This file was auto-generated by generate_tables.py from defs.dat. DO NOT MODIFY! // diff --git a/inc/cpuidflags.h b/inc/cpuidflags.h index dd330ff..94c4005 100644 --- a/inc/cpuidflags.h +++ b/inc/cpuidflags.h @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2020 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef CPUID_FLAGS_H #define CPUID_FLAGS_H diff --git a/isagenerator/generate_tables.py b/isagenerator/generate_tables.py index 6d195ac..ce4ad5f 100644 --- a/isagenerator/generate_tables.py +++ b/isagenerator/generate_tables.py @@ -10,6 +10,16 @@ import copy import glob import disasmlib +header = '''/* + * Copyright (c) 2020 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ + +// +// This file was auto-generated by generate_tables.py. DO NOT MODIFY! +// + +''' flags = { 'MODRM' : 'ND_FLAG_MODRM', @@ -1011,6 +1021,7 @@ def generate_translations2(instructions): #dump_hash_tree2(hash_st) print('Writing the table_root.h file...') f = open(r'../bddisasm/include/table_root.h', 'wt') + f.write(header) f.write("#ifndef TABLE_ROOT_H\n") f.write("#define TABLE_ROOT_H\n\n") dump_translation_tree_c(hash_st, 'gRootTable', f) @@ -1020,6 +1031,7 @@ def generate_translations2(instructions): #dump_hash_tree2(hash_vex) print('Writing the table_vex.h file...') f = open(r'../bddisasm/include/table_vex.h', 'wt') + f.write(header) f.write("#ifndef TABLE_VEX_H\n") f.write("#define TABLE_VEX_H\n\n") dump_translation_tree_c(hash_vex, 'gVexTable', f) @@ -1029,6 +1041,7 @@ def generate_translations2(instructions): #dump_hash_tree2(hash_xop) print('Writing the table_xop.h file...') f = open(r'../bddisasm/include/table_xop.h', 'wt') + f.write(header) f.write("#ifndef TABLE_XOP_H\n") f.write("#define TABLE_XOP_H\n\n") dump_translation_tree_c(hash_xop, 'gXopTable', f) @@ -1038,6 +1051,7 @@ def generate_translations2(instructions): #dump_hash_tree2(hash_evex) print('Writing the table_evex.h file...') f = open(r'../bddisasm/include/table_evex.h', 'wt') + f.write(header) f.write("#ifndef TABLE_EVEX_H\n") f.write("#define TABLE_EVEX_H\n\n") dump_translation_tree_c(hash_evex, 'gEvexTable', f) @@ -1078,6 +1092,7 @@ def generate_constants2(instructions): def dump_mnemonics(mnemonics, prefixes, fname): f = open(fname, 'wt') + f.write(header) f.write('#ifndef MNEMONICS_H\n') f.write('#define MNEMONICS_H\n') f.write('\n') @@ -1113,9 +1128,7 @@ def dump_mnemonics(mnemonics, prefixes, fname): def dump_constants(constants, prefixes, constants_sets, constants_types, fname): f = open(fname, 'wt') - f.write('//\n') - f.write('// This file was auto-generated by generate_tables.py from defs.dat. DO NOT MODIFY!\n') - f.write('//\n\n') + f.write(header) f.write('#ifndef CONSTANTS_H\n') f.write('#define CONSTANTS_H\n\n') f.write('\n') @@ -1161,9 +1174,7 @@ def dump_tree(translations, level = 0): def generate_master_table(instructions, fname): f = open(fname, 'wt') - f.write('//\n') - f.write('// This file was auto-generated by generate_tables.py from defs.dat. DO NOT MODIFY!\n') - f.write('//\n\n') + f.write(header) f.write('#ifndef INSTRUCTIONS_H\n') f.write('#define INSTRUCTIONS_H\n') f.write('\n') @@ -1242,6 +1253,7 @@ def dump_translation_tree_c(t, hname, f): def generate_features(features, fname): f = open(fname, 'wt') + f.write(header) f.write('#ifndef CPUID_FLAGS_H\n') f.write('#define CPUID_FLAGS_H\n')