init.hh revision 8946:fb6c89334b86
12SN/A/*
21762SN/A * Copyright (c) 2008 The Hewlett-Packard Development Company
35502Snate@binkert.org * All rights reserved.
42SN/A *
52SN/A * Redistribution and use in source and binary forms, with or without
62SN/A * modification, are permitted provided that the following conditions are
72SN/A * met: redistributions of source code must retain the above copyright
82SN/A * notice, this list of conditions and the following disclaimer;
92SN/A * redistributions in binary form must reproduce the above copyright
102SN/A * notice, this list of conditions and the following disclaimer in the
112SN/A * documentation and/or other materials provided with the distribution;
122SN/A * neither the name of the copyright holders nor the names of its
132SN/A * contributors may be used to endorse or promote products derived from
142SN/A * this software without specific prior written permission.
152SN/A *
162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272SN/A *
282665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert
292665Ssaidi@eecs.umich.edu */
302665Ssaidi@eecs.umich.edu
312665Ssaidi@eecs.umich.edu#ifndef __SIM_INIT_HH__
322SN/A#define __SIM_INIT_HH__
332SN/A
345501Snate@binkert.org/*
352SN/A * Data structure describing an embedded python file.
362SN/A */
372SN/A#include <list>
382SN/A
395502Snate@binkert.org#include <inttypes.h>
405501Snate@binkert.org
415501Snate@binkert.org#ifndef PyObject_HEAD
421717SN/Astruct _object;
435501Snate@binkert.orgtypedef _object PyObject;
4456SN/A#endif
452SN/A
462SN/Astruct EmbeddedPython
472SN/A{
482SN/A    const char *filename;
492SN/A    const char *abspath;
502SN/A    const char *modpath;
512SN/A    const uint8_t *code;
522SN/A    int zlen;
532SN/A    int len;
545605Snate@binkert.org
552SN/A    EmbeddedPython(const char *filename, const char *abspath,
564017Sstever@eecs.umich.edu                   const char *modpath, const uint8_t *code, int zlen, int len);
574016Sstever@eecs.umich.edu
584017Sstever@eecs.umich.edu    PyObject *getCode() const;
594016Sstever@eecs.umich.edu    bool addModule() const;
605768Snate@binkert.org
615768Snate@binkert.org    static EmbeddedPython *importer;
625774Snate@binkert.org    static PyObject *importerModule;
637059Snate@binkert.org    static std::list<EmbeddedPython *> &getList();
645768Snate@binkert.org    static int initAll();
655768Snate@binkert.org};
665768Snate@binkert.org
675768Snate@binkert.orgstruct EmbeddedSwig
685768Snate@binkert.org{
695768Snate@binkert.org    void (*initFunc)();
705768Snate@binkert.org
715768Snate@binkert.org    EmbeddedSwig(void (*init_func)());
725768Snate@binkert.org
735768Snate@binkert.org    static std::list<EmbeddedSwig *> &getList();
745768Snate@binkert.org    static void initAll();
755768Snate@binkert.org};
765768Snate@binkert.org
775602Snate@binkert.orgvoid initSignals();
785602Snate@binkert.orgint initM5Python();
795502Snate@binkert.orgint m5Main(int argc, char **argv);
805503Snate@binkert.org
815502Snate@binkert.org#endif // __SIM_INIT_HH__
825502Snate@binkert.org