syscall_emul: standardized file descriptor name and add return checks.
[gem5.git] / src / sim / init.hh
index b0f29bf300cbd7a02c253f6819e544e75d1718a9..766cb43654250c148575ce200951d5981fcf51ad 100644 (file)
 #ifndef __SIM_INIT_HH__
 #define __SIM_INIT_HH__
 
+#include <Python.h>
+
 /*
  * Data structure describing an embedded python file.
  */
-struct EmbeddedPyModule
+#include <list>
+
+#include <inttypes.h>
+
+#ifndef PyObject_HEAD
+struct _object;
+typedef _object PyObject;
+#endif
+
+struct EmbeddedPython
 {
     const char *filename;
+    const char *abspath;
     const char *modpath;
-    const char *code;
-    const char *code_end;
+    const uint8_t *code;
     int zlen;
-    int mlen;
+    int len;
+
+    EmbeddedPython(const char *filename, const char *abspath,
+                   const char *modpath, const uint8_t *code, int zlen, int len);
+
+    PyObject *getCode() const;
+    bool addModule() const;
+
+    static EmbeddedPython *importer;
+    static PyObject *importerModule;
+    static std::list<EmbeddedPython *> &getList();
+    static int initAll();
 };
 
-extern const EmbeddedPyModule embeddedPyImporter;
-extern const EmbeddedPyModule embeddedPyModules[];
+struct EmbeddedSwig
+{
+    void (*initFunc)();
+
+    EmbeddedSwig(void (*init_func)());
+
+    static std::list<EmbeddedSwig *> &getList();
+    static void initAll();
+};
 
-void initSignals();
 int initM5Python();
 int m5Main(int argc, char **argv);
+PyMODINIT_FUNC initm5(void);
 
 #endif // __SIM_INIT_HH__