main.cc (4167:ce5d0f62f13b) | main.cc (4941:595b53060bc1) |
---|---|
1/* 2 * Copyright (c) 2000-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 62 unchanged lines hidden (view full) --- 71/// Abort signal handler. 72void 73abortHandler(int sigtype) 74{ 75 ccprintf(cerr, "Program aborted at cycle %d\n", curTick); 76} 77 78int | 1/* 2 * Copyright (c) 2000-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 62 unchanged lines hidden (view full) --- 71/// Abort signal handler. 72void 73abortHandler(int sigtype) 74{ 75 ccprintf(cerr, "Program aborted at cycle %d\n", curTick); 76} 77 78int |
79python_main() 80{ 81 PyObject *module; 82 PyObject *dict; 83 PyObject *result; 84 85 module = PyImport_AddModule("__main__"); 86 if (module == NULL) 87 fatal("Could not import __main__"); 88 89 dict = PyModule_GetDict(module); 90 91 result = PyRun_String("import m5.main", Py_file_input, dict, dict); 92 if (!result) { 93 PyErr_Print(); 94 return 1; 95 } 96 Py_DECREF(result); 97 98 result = PyRun_String("m5.main.main()", Py_file_input, dict, dict); 99 if (!result) { 100 PyErr_Print(); 101 return 1; 102 } 103 Py_DECREF(result); 104 105 if (Py_FlushLine()) 106 PyErr_Clear(); 107 108 return 0; 109} 110 111int |
|
79main(int argc, char **argv) 80{ 81 signal(SIGFPE, SIG_IGN); // may occur on misspeculated paths 82 signal(SIGTRAP, SIG_IGN); 83 signal(SIGUSR1, dumpStatsHandler); // dump intermediate stats 84 signal(SIGUSR2, dumprstStatsHandler); // dump and reset stats 85 signal(SIGINT, exitNowHandler); // dump final stats and exit 86 signal(SIGABRT, abortHandler); --- 22 unchanged lines hidden (view full) --- 109 110 // initialize embedded Python interpreter 111 Py_Initialize(); 112 PySys_SetArgv(argc, argv); 113 114 // initialize SWIG modules 115 init_swig(); 116 | 112main(int argc, char **argv) 113{ 114 signal(SIGFPE, SIG_IGN); // may occur on misspeculated paths 115 signal(SIGTRAP, SIG_IGN); 116 signal(SIGUSR1, dumpStatsHandler); // dump intermediate stats 117 signal(SIGUSR2, dumprstStatsHandler); // dump and reset stats 118 signal(SIGINT, exitNowHandler); // dump final stats and exit 119 signal(SIGABRT, abortHandler); --- 22 unchanged lines hidden (view full) --- 142 143 // initialize embedded Python interpreter 144 Py_Initialize(); 145 PySys_SetArgv(argc, argv); 146 147 // initialize SWIG modules 148 init_swig(); 149 |
117 PyRun_SimpleString("import m5.main"); 118 PyRun_SimpleString("m5.main.main()"); | 150 int ret = python_main(); |
119 120 // clean up Python intepreter. 121 Py_Finalize(); | 151 152 // clean up Python intepreter. 153 Py_Finalize(); |
154 155 return ret; |
|
122} | 156} |