From 4b0162342b304ac12d10afac18c1c8656ec2493d Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 4 Apr 2020 00:55:41 -0700 Subject: [PATCH] util: Convert the m5 utility to C++. This will make it possible to use the googletest unit testing framework, and will let us use c++ mechanisms to simplify and streamline the code. Change-Id: I8ab358de47ce6b5c2d601cc0b9f2a694b2037a9b Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27548 Tested-by: kokoro Reviewed-by: Gabe Black Reviewed-by: Daniel Carvalho Maintainer: Gabe Black --- util/m5/SConstruct | 2 ++ util/m5/src/SConscript | 20 +++++++++---------- .../{addr_call_type.c => addr_call_type.cc} | 11 ++++++---- .../{addr_call_type.h => addr_call_type.hh} | 10 +++++----- util/m5/src/{args.c => args.cc} | 8 ++++---- util/m5/src/{args.h => args.hh} | 14 ++++++------- util/m5/src/arm/SConsopts | 2 +- util/m5/src/{call_type.c => call_type.cc} | 12 +++++------ util/m5/src/{call_type.h => call_type.hh} | 10 +++++----- util/m5/src/{commands.c => commands.cc} | 19 +++++++++--------- util/m5/src/{commands.h => commands.hh} | 18 ++++++++--------- .../{dispatch_table.h => dispatch_table.hh} | 12 +++++------ .../{inst_call_type.c => inst_call_type.cc} | 6 +++--- .../{inst_call_type.h => inst_call_type.hh} | 10 +++++----- util/m5/src/{lua_gem5Op.c => lua_gem5Op.cc} | 14 ++++++++++--- util/m5/src/{m5.c => m5.cc} | 12 +++++------ util/m5/src/m5_mmap.h | 10 ++++++++-- .../{semi_call_type.c => semi_call_type.cc} | 9 ++++++--- .../{semi_call_type.h => semi_call_type.hh} | 10 +++++----- util/m5/src/sparc/SConsopts | 2 +- util/m5/src/thumb/SConsopts | 2 +- util/m5/src/{usage.c => usage.cc} | 12 +++++------ util/m5/src/{usage.h => usage.hh} | 6 +++--- util/m5/src/x86/SConsopts | 3 ++- 24 files changed, 129 insertions(+), 105 deletions(-) rename util/m5/src/{addr_call_type.c => addr_call_type.cc} (95%) rename util/m5/src/{addr_call_type.h => addr_call_type.hh} (92%) rename util/m5/src/{args.c => args.cc} (97%) rename util/m5/src/{args.h => args.hh} (95%) rename util/m5/src/{call_type.c => call_type.cc} (93%) rename util/m5/src/{call_type.h => call_type.hh} (92%) rename util/m5/src/{commands.c => commands.cc} (97%) rename util/m5/src/{commands.h => commands.hh} (91%) rename util/m5/src/{dispatch_table.h => dispatch_table.hh} (91%) rename util/m5/src/{inst_call_type.c => inst_call_type.cc} (95%) rename util/m5/src/{inst_call_type.h => inst_call_type.hh} (91%) rename util/m5/src/{lua_gem5Op.c => lua_gem5Op.cc} (97%) rename util/m5/src/{m5.c => m5.cc} (95%) rename util/m5/src/{semi_call_type.c => semi_call_type.cc} (93%) rename util/m5/src/{semi_call_type.h => semi_call_type.hh} (91%) rename util/m5/src/{usage.c => usage.cc} (95%) rename util/m5/src/{usage.h => usage.hh} (97%) diff --git a/util/m5/SConstruct b/util/m5/SConstruct index 48073d24f..8ff6aeabf 100644 --- a/util/m5/SConstruct +++ b/util/m5/SConstruct @@ -38,6 +38,7 @@ def abspath(d): return os.path.abspath(str(d)) # Universal settings. +main.Append(CXXFLAGS=[ '-O2' ]) main.Append(CCFLAGS=[ '-O2' ]) main.Append(CPPPATH=[ common_include ]) @@ -45,6 +46,7 @@ main.Append(CPPPATH=[ common_include ]) main['ENV']['PATH'] = os.environ['PATH'] main['CC'] = '${CROSS_COMPILE}gcc' +main['CXX'] = '${CROSS_COMPILE}g++' main['AS'] = '${CROSS_COMPILE}as' main['LD'] = '${CROSS_COMPILE}ld' main['AR'] = '${CROSS_COMPILE}ar' diff --git a/util/m5/src/SConscript b/util/m5/src/SConscript index 6e5cd6cda..0961f2f5d 100644 --- a/util/m5/src/SConscript +++ b/util/m5/src/SConscript @@ -28,15 +28,15 @@ import os Import('*') # Raw source files. -args = 'args.c' -call_type = 'call_type.c' -commands = 'commands.c' -m5 = 'm5.c' +args = 'args.cc' +call_type = 'call_type.cc' +commands = 'commands.cc' +m5 = 'm5.cc' m5_mmap = 'm5_mmap.c' -usage = 'usage.c' +usage = 'usage.cc' jni = 'jni_gem5Op.c' -lua = 'lua_gem5Op.c' +lua = 'lua_gem5Op.cc' all_call_types = list(env['CALL_TYPE'].values()) call_types = list([ ct for ct in all_call_types if ct.enabled ]) @@ -52,11 +52,11 @@ static_env = env.Clone() static_env.Append(LINKFLAGS=[ '-no-pie', '-static' ]) for ct in all_call_types: - static_env.Append(CFLAGS='-DENABLE_CT_%s=%d' % + static_env.Append(CXXFLAGS='-DENABLE_CT_%s=%d' % (ct.name, 1 if ct.enabled else 0)) - static_env.Append(CFLAGS='-DDEFAULT_CT_%s=%d' % + static_env.Append(CXXFLAGS='-DDEFAULT_CT_%s=%d' % (ct.name, 1 if ct.default else 0)) -static_env.Append(CFLAGS='-DDEFAULT_CALL_TYPE=%s' % default_call_type.name) +static_env.Append(CXXFLAGS='-DDEFAULT_CALL_TYPE=%s' % default_call_type.name) # # The m5 library for use in other C/C++ programs. @@ -67,7 +67,7 @@ libm5 = static_env.StaticLibrary('out/m5', [ m5_mmap ] + m5ops) # # The m5 stand alone command line utility. # -ct_support = list([ File('%s_call_type.c' % ct.name) for ct in call_types ]) +ct_support = list([ File('%s_call_type.cc' % ct.name) for ct in call_types ]) m5_bin = static_env.Program('out/m5', ct_support + [ args, call_type, commands, m5, m5_mmap, libm5, usage ]) diff --git a/util/m5/src/addr_call_type.c b/util/m5/src/addr_call_type.cc similarity index 95% rename from util/m5/src/addr_call_type.c rename to util/m5/src/addr_call_type.cc index 6c6ebe22c..cdf5e5d7f 100644 --- a/util/m5/src/addr_call_type.c +++ b/util/m5/src/addr_call_type.cc @@ -25,18 +25,21 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include -#include "addr_call_type.h" -#include "args.h" +#include "addr_call_type.hh" +#include "args.hh" #include "m5_mmap.h" +extern "C" +{ #define M5OP(name, func) __typeof__(name) M5OP_MERGE_TOKENS(name, _addr); M5OP_FOREACH #undef M5OP +} static DispatchTable addr_dispatch = { -#define M5OP(name, func) .name = &M5OP_MERGE_TOKENS(name, _addr), +#define M5OP(name, func) .name = &::M5OP_MERGE_TOKENS(name, _addr), M5OP_FOREACH #undef M5OP }; diff --git a/util/m5/src/addr_call_type.h b/util/m5/src/addr_call_type.hh similarity index 92% rename from util/m5/src/addr_call_type.h rename to util/m5/src/addr_call_type.hh index 33fdf02b3..a327fd64e 100644 --- a/util/m5/src/addr_call_type.h +++ b/util/m5/src/addr_call_type.hh @@ -25,14 +25,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __ADDR_CALL_TYPE_H__ -#define __ADDR_CALL_TYPE_H__ +#ifndef __ADDR_CALL_TYPE_HH__ +#define __ADDR_CALL_TYPE_HH__ -#include "args.h" -#include "dispatch_table.h" +#include "args.hh" +#include "dispatch_table.hh" // Returns 0 if not detected, 1 if detected successfully, and -1 on error. int addr_call_type_detect(Args *args); DispatchTable *addr_call_type_init(); -#endif // __ADDR_CALL_TYPE_H__ +#endif // __ADDR_CALL_TYPE_HH__ diff --git a/util/m5/src/args.c b/util/m5/src/args.cc similarity index 97% rename from util/m5/src/args.c rename to util/m5/src/args.cc index 68753e9f7..96689b802 100644 --- a/util/m5/src/args.c +++ b/util/m5/src/args.cc @@ -38,11 +38,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include +#include +#include +#include -#include "args.h" +#include "args.hh" int parse_int_args(Args *args, uint64_t ints[], int len) diff --git a/util/m5/src/args.h b/util/m5/src/args.hh similarity index 95% rename from util/m5/src/args.h rename to util/m5/src/args.hh index 911db7786..3fc22a295 100644 --- a/util/m5/src/args.h +++ b/util/m5/src/args.hh @@ -38,17 +38,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __ARGS_H__ -#define __ARGS_H__ +#ifndef __ARGS_HH__ +#define __ARGS_HH__ -#include -#include +#include +#include -typedef struct Args +struct Args { int argc; const char **argv; -} Args; +}; static inline const char * pop_arg(Args *args) @@ -62,4 +62,4 @@ pop_arg(Args *args) int parse_int_args(Args *args, uint64_t ints[], int len); int pack_arg_into_regs(Args *args, uint64_t regs[], int num_regs); -#endif // __ARGS_H__ +#endif // __ARGS_HH__ diff --git a/util/m5/src/arm/SConsopts b/util/m5/src/arm/SConsopts index e2517580f..8956b2e2e 100644 --- a/util/m5/src/arm/SConsopts +++ b/util/m5/src/arm/SConsopts @@ -27,6 +27,6 @@ Import('*') env['VARIANT'] = 'arm' get_variant_opt('CROSS_COMPILE', 'arm-linux-gnueabihf-') -env.Append(CFLAGS='-march=armv7-a') +env.Append(CXXFLAGS='-march=armv7-a') env['CALL_TYPE']['inst'].impl('m5op.S', default=True) diff --git a/util/m5/src/call_type.c b/util/m5/src/call_type.cc similarity index 93% rename from util/m5/src/call_type.c rename to util/m5/src/call_type.cc index 5792f07a0..96b886933 100644 --- a/util/m5/src/call_type.c +++ b/util/m5/src/call_type.cc @@ -25,18 +25,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "args.h" -#include "call_type.h" -#include "usage.h" +#include "args.hh" +#include "call_type.hh" +#include "usage.hh" #if ENABLE_CT_addr -#include "addr_call_type.h" +#include "addr_call_type.hh" #endif #if ENABLE_CT_inst -#include "inst_call_type.h" +#include "inst_call_type.hh" #endif #if ENABLE_CT_semi -#include "semi_call_type.h" +#include "semi_call_type.hh" #endif #define default_call_type_init() \ diff --git a/util/m5/src/call_type.h b/util/m5/src/call_type.hh similarity index 92% rename from util/m5/src/call_type.h rename to util/m5/src/call_type.hh index 7166670d3..92cd9c960 100644 --- a/util/m5/src/call_type.h +++ b/util/m5/src/call_type.hh @@ -25,12 +25,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __CALL_TYPE_H__ -#define __CALL_TYPE_H__ +#ifndef __CALL_TYPE_HH__ +#define __CALL_TYPE_HH__ -#include "args.h" -#include "dispatch_table.h" +#include "args.hh" +#include "dispatch_table.hh" DispatchTable *init_call_type(Args *args); -#endif // __CALL_TYPE_H__ +#endif // __CALL_TYPE_HH__ diff --git a/util/m5/src/commands.c b/util/m5/src/commands.cc similarity index 97% rename from util/m5/src/commands.c rename to util/m5/src/commands.cc index 8dd459c29..9cd43c0ce 100644 --- a/util/m5/src/commands.c +++ b/util/m5/src/commands.cc @@ -28,15 +28,16 @@ #include #include -#include -#include -#include -#include #include -#include "args.h" -#include "commands.h" -#include "usage.h" +#include +#include +#include +#include + +#include "args.hh" +#include "commands.hh" +#include "usage.hh" static int read_file(DispatchTable *dt, int dest_fid) @@ -213,10 +214,10 @@ do_initparam(DispatchTable *dt, Args *args) if (!pack_arg_into_regs(args, key_str, 2)) usage(); uint64_t val = (*dt->m5_init_param)(key_str[0], key_str[1]); - printf("%"PRIu64, val); + std::cout << val; } -struct CommandInfo command_table[] = { +CommandInfo command_table[] = { { "addsymbol", do_addsymbol, "
// Adds a " "symbol with address \"address\" " "to gem5's symbol table" }, diff --git a/util/m5/src/commands.h b/util/m5/src/commands.hh similarity index 91% rename from util/m5/src/commands.h rename to util/m5/src/commands.hh index 5d489ba81..05b54f642 100644 --- a/util/m5/src/commands.h +++ b/util/m5/src/commands.hh @@ -26,22 +26,22 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __COMMANDS_H__ -#define __COMMANDS_H__ +#ifndef __COMMANDS_HH__ +#define __COMMANDS_HH__ -#include "args.h" -#include "dispatch_table.h" +#include "args.hh" +#include "dispatch_table.hh" -typedef struct CommandInfo +struct CommandInfo { // The name of the command. - char *name; + const char *name; // A function which processes command line arguments and passes them to // the underlying function through the dispatch table. void (*func)(DispatchTable *dt, Args *args); // Help text for this command. - char *usage; -} CommandInfo; + const char *usage; +}; // The commands themselves. extern CommandInfo command_table[]; @@ -49,4 +49,4 @@ extern CommandInfo command_table[]; // The number of commands. extern int num_commands; -#endif // __COMMANDS_H__ +#endif // __COMMANDS_HH__ diff --git a/util/m5/src/dispatch_table.h b/util/m5/src/dispatch_table.hh similarity index 91% rename from util/m5/src/dispatch_table.h rename to util/m5/src/dispatch_table.hh index c9f1906b4..fdac0540d 100644 --- a/util/m5/src/dispatch_table.h +++ b/util/m5/src/dispatch_table.hh @@ -25,8 +25,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __DISPATCH_TABLE_H__ -#define __DISPATCH_TABLE_H__ +#ifndef __DISPATCH_TABLE_HH__ +#define __DISPATCH_TABLE_HH__ #include #include @@ -37,11 +37,11 @@ * functions. They can then be passed to a consumer which knows which function * it wants, but not exactly how/where it's implemented. */ -typedef struct DispatchTable +struct DispatchTable { -#define M5OP(name, func) __typeof__(&name) name; +#define M5OP(name, func) __typeof__(&::name) name; M5OP_FOREACH #undef M5OP -} DispatchTable; +}; -#endif // __DISPATCH_TABLE_H__ +#endif // __DISPATCH_TABLE_HH__ diff --git a/util/m5/src/inst_call_type.c b/util/m5/src/inst_call_type.cc similarity index 95% rename from util/m5/src/inst_call_type.c rename to util/m5/src/inst_call_type.cc index 98c1db271..5fbd756d9 100644 --- a/util/m5/src/inst_call_type.c +++ b/util/m5/src/inst_call_type.cc @@ -25,12 +25,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include -#include "inst_call_type.h" +#include "inst_call_type.hh" static DispatchTable inst_dispatch = { -#define M5OP(name, func) .name = &name, +#define M5OP(name, func) .name = &::name, M5OP_FOREACH #undef M5OP }; diff --git a/util/m5/src/inst_call_type.h b/util/m5/src/inst_call_type.hh similarity index 91% rename from util/m5/src/inst_call_type.h rename to util/m5/src/inst_call_type.hh index 549a3dcd8..a0d76fe69 100644 --- a/util/m5/src/inst_call_type.h +++ b/util/m5/src/inst_call_type.hh @@ -25,13 +25,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __INST_CALL_TYPE_H__ -#define __INST_CALL_TYPE_H__ +#ifndef __INST_CALL_TYPE_HH__ +#define __INST_CALL_TYPE_HH__ -#include "args.h" -#include "dispatch_table.h" +#include "args.hh" +#include "dispatch_table.hh" int inst_call_type_detect(Args *args); DispatchTable *inst_call_type_init(); -#endif // __INST_CALL_TYPE_H__ +#endif // __INST_CALL_TYPE_HH__ diff --git a/util/m5/src/lua_gem5Op.c b/util/m5/src/lua_gem5Op.cc similarity index 97% rename from util/m5/src/lua_gem5Op.c rename to util/m5/src/lua_gem5Op.cc index 89aec1432..3c8b20454 100644 --- a/util/m5/src/lua_gem5Op.c +++ b/util/m5/src/lua_gem5Op.cc @@ -26,11 +26,12 @@ */ -#include #include #include #include -#include + +#include +#include #include @@ -158,7 +159,7 @@ do_read_file(lua_State *L) { uint64_t len = lua_tointeger(L, 1); uint64_t offset = lua_tointeger(L, 2); - char *buf = malloc(len); + char *buf = (char *)malloc(len); uint64_t readlen = m5_read_file(buf, len, offset); lua_pushlstring(L, buf, readlen); return 1; @@ -239,6 +240,13 @@ do_work_end(lua_State *L) return 0; } +extern "C" +{ + +int luaopen_gem5OpLua(lua_State *); + +} + int luaopen_gem5OpLua(lua_State *L) { diff --git a/util/m5/src/m5.c b/util/m5/src/m5.cc similarity index 95% rename from util/m5/src/m5.c rename to util/m5/src/m5.cc index e4b187f5a..8a4833748 100644 --- a/util/m5/src/m5.c +++ b/util/m5/src/m5.cc @@ -38,13 +38,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include +#include -#include "args.h" -#include "call_type.h" -#include "commands.h" -#include "usage.h" +#include "args.hh" +#include "call_type.hh" +#include "commands.hh" +#include "usage.hh" int main(int argc, const char *argv[]) diff --git a/util/m5/src/m5_mmap.h b/util/m5/src/m5_mmap.h index 552b400d0..d7fe19b3d 100644 --- a/util/m5/src/m5_mmap.h +++ b/util/m5/src/m5_mmap.h @@ -41,13 +41,19 @@ #ifndef __UTIL_M5_MMAP_H__ #define __UTIL_M5_MMAP_H__ -#include #include -#include + +#ifdef __cplusplus +extern "C" { +#endif extern void *m5_mem; extern uint64_t m5op_addr; void map_m5_mem(); +#ifdef __cplusplus +} #endif + +#endif // __UTIL_M5_MMAP_H__ diff --git a/util/m5/src/semi_call_type.c b/util/m5/src/semi_call_type.cc similarity index 93% rename from util/m5/src/semi_call_type.c rename to util/m5/src/semi_call_type.cc index d57e34805..85057c241 100644 --- a/util/m5/src/semi_call_type.c +++ b/util/m5/src/semi_call_type.cc @@ -25,16 +25,19 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include -#include "semi_call_type.h" +#include "semi_call_type.hh" +extern "C" +{ #define M5OP(name, func) __typeof__(name) M5OP_MERGE_TOKENS(name, _semi); M5OP_FOREACH #undef M5OP +} static DispatchTable semi_dispatch = { -#define M5OP(name, func) .name = &M5OP_MERGE_TOKENS(name, _semi), +#define M5OP(name, func) .name = &::M5OP_MERGE_TOKENS(name, _semi), M5OP_FOREACH #undef M5OP }; diff --git a/util/m5/src/semi_call_type.h b/util/m5/src/semi_call_type.hh similarity index 91% rename from util/m5/src/semi_call_type.h rename to util/m5/src/semi_call_type.hh index 111ae218c..73081dd7e 100644 --- a/util/m5/src/semi_call_type.h +++ b/util/m5/src/semi_call_type.hh @@ -25,13 +25,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __SEMI_CALL_TYPE_H__ -#define __SEMI_CALL_TYPE_H__ +#ifndef __SEMI_CALL_TYPE_HH__ +#define __SEMI_CALL_TYPE_HH__ -#include "args.h" -#include "dispatch_table.h" +#include "args.hh" +#include "dispatch_table.hh" int semi_call_type_detect(Args *args); DispatchTable *semi_call_type_init(); -#endif // __SEMI_CALL_TYPE_H__ +#endif // __SEMI_CALL_TYPE_HH__ diff --git a/util/m5/src/sparc/SConsopts b/util/m5/src/sparc/SConsopts index aa6f4be21..d55ff7abf 100644 --- a/util/m5/src/sparc/SConsopts +++ b/util/m5/src/sparc/SConsopts @@ -27,6 +27,6 @@ Import('*') env['VARIANT'] = 'sparc' get_variant_opt('CROSS_COMPILE', 'sparc64-linux-gnu-') -env.Append(CFLAGS='-m64') +env.Append(CXXFLAGS='-m64') env['CALL_TYPE']['inst'].impl('m5op.S', default=True) diff --git a/util/m5/src/thumb/SConsopts b/util/m5/src/thumb/SConsopts index e0b0245eb..55860d1e5 100644 --- a/util/m5/src/thumb/SConsopts +++ b/util/m5/src/thumb/SConsopts @@ -27,6 +27,6 @@ Import('*') env['VARIANT'] = 'thumb' get_variant_opt('CROSS_COMPILE', 'arm-linux-gnueabihf-') -env.Append(CFLAGS=[ '-mthumb', '-march=armv7' ]) +env.Append(CXXFLAGS=[ '-mthumb', '-march=armv7' ]) env['CALL_TYPE']['inst'].impl('m5op.S', default=True) diff --git a/util/m5/src/usage.c b/util/m5/src/usage.cc similarity index 95% rename from util/m5/src/usage.c rename to util/m5/src/usage.cc index 822d9f0a7..620d8cd2e 100644 --- a/util/m5/src/usage.c +++ b/util/m5/src/usage.cc @@ -38,12 +38,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include +#include +#include +#include -#include "commands.h" -#include "usage.h" +#include "commands.hh" +#include "usage.hh" const char *progname = "{progname}"; @@ -63,7 +63,7 @@ usage() DEFAULT_CT_addr ? " (default)" : ""); fprintf(stderr, " Use the address based invocation method.\n"); # if defined(M5OP_ADDR) - fprintf(stderr, " The default address is %#"PRIx64".\n", + fprintf(stderr, " The default address is %#" PRIx64 ".\n", (uint64_t)M5OP_ADDR); # endif # endif diff --git a/util/m5/src/usage.h b/util/m5/src/usage.hh similarity index 97% rename from util/m5/src/usage.h rename to util/m5/src/usage.hh index d1e148d83..b1023eab2 100644 --- a/util/m5/src/usage.h +++ b/util/m5/src/usage.hh @@ -38,11 +38,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __USAGE_H__ -#define __USAGE_H__ +#ifndef __USAGE_HH__ +#define __USAGE_HH__ extern const char *progname; void usage(); -#endif // __USAGE_H__ +#endif // __USAGE_HH__ diff --git a/util/m5/src/x86/SConsopts b/util/m5/src/x86/SConsopts index 8763f293b..47572ab0a 100644 --- a/util/m5/src/x86/SConsopts +++ b/util/m5/src/x86/SConsopts @@ -27,7 +27,8 @@ Import('*') env['VARIANT'] = 'x86' get_variant_opt('CROSS_COMPILE', '') -env.Append(CFLAGS='-DM5OP_ADDR=0xFFFF0000') +env.Append(CXXFLAGS='-DM5OP_ADDR=0xFFFF0000') +env.Append(CCFLAGS='-DM5OP_ADDR=0xFFFF0000') env['CALL_TYPE']['inst'].impl('m5op.S') env['CALL_TYPE']['addr'].impl('m5op_addr.S', default=True) -- 2.30.2