summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConscript24
-rw-r--r--arch/SConscript3
-rw-r--r--arch/alpha/SConscript1
-rw-r--r--arch/alpha/ev5.cc36
-rw-r--r--arch/alpha/faults.cc54
-rw-r--r--arch/alpha/faults.hh38
-rw-r--r--arch/alpha/isa_traits.hh1
-rw-r--r--arch/alpha/process.cc61
-rw-r--r--arch/alpha/process.hh48
-rw-r--r--arch/alpha/system.cc2
-rw-r--r--arch/mips/process.cc56
-rw-r--r--arch/mips/process.hh45
-rw-r--r--arch/sparc/SConscript8
-rw-r--r--arch/sparc/linux_process.cc451
-rw-r--r--arch/sparc/linux_process.hh58
-rw-r--r--arch/sparc/process.cc56
-rw-r--r--arch/sparc/process.hh45
-rw-r--r--base/loader/elf_object.cc49
-rw-r--r--base/loader/object_file.hh11
-rw-r--r--cpu/exec_context.cc12
-rw-r--r--cpu/exec_context.hh9
-rw-r--r--cpu/o3/alpha_cpu_impl.hh9
-rw-r--r--cpu/ozone/cpu.hh2
-rw-r--r--cpu/simple/cpu.cc4
-rw-r--r--cpu/simple/cpu.hh2
-rw-r--r--kern/tru64/tru64.hh5
-rw-r--r--sim/faults.cc10
-rw-r--r--sim/faults.hh33
-rw-r--r--sim/process.cc28
29 files changed, 976 insertions, 185 deletions
diff --git a/SConscript b/SConscript
index f58d78798..efcb2baf6 100644
--- a/SConscript
+++ b/SConscript
@@ -303,29 +303,6 @@ syscall_emulation_sources = Split('''
sim/syscall_emul.cc
''')
-# The following stuff (targetarch code and global define of THE_ISA)
-# are legacy things that assume we're only compiling one ISA at a
-# time. These will have to go away if we want to build a binary that
-# supports multiple ISAs.
-
-#targetarch_files = Split('''
-# alpha_linux_process.hh
-# alpha_memory.hh
-# alpha_tru64_process.hh
-# aout_machdep.h
-# arguments.hh
-# ecoff_machdep.h
-# ev5.hh
-# faults.hh
-# stacktrace.hh
-# vtophys.hh
-# ''')
-
-# Set up bridging headers to the architecture specific versions
-#for f in targetarch_files:
-# env.Command('targetarch/' + f, 'arch/%s/%s' % (env['TARGET_ISA'], f),
-# '''echo '#include "arch/%s/%s"' > $TARGET''' % (env['TARGET_ISA'], f))
-
# Add a flag defining what THE_ISA should be for all compilation
env.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())])
@@ -400,6 +377,7 @@ def make_objs(sources, env):
# the corresponding build directory to pick up generated include
# files.
env.Append(CPPPATH='.')
+env.Append(CPPPATH='./libelf')
# Debug binary
debugEnv = env.Copy(OBJSUFFIX='.do')
diff --git a/arch/SConscript b/arch/SConscript
index 5783b39dd..b4b7a1ddb 100644
--- a/arch/SConscript
+++ b/arch/SConscript
@@ -46,9 +46,8 @@ sources = []
# List of headers to generate
isa_switch_hdrs = Split('''
isa_traits.hh
- linux_process.hh
- tru64_process.hh
tlb.hh
+ process.hh
aout_machdep.h
ecoff_machdep.h
arguments.hh
diff --git a/arch/alpha/SConscript b/arch/alpha/SConscript
index 3b0e69b7a..03d73eef7 100644
--- a/arch/alpha/SConscript
+++ b/arch/alpha/SConscript
@@ -64,6 +64,7 @@ syscall_emulation_sources = Split('''
common_syscall_emul.cc
linux_process.cc
tru64_process.cc
+ process.cc
''')
# Set up complete list of sources based on configuration.
diff --git a/arch/alpha/ev5.cc b/arch/alpha/ev5.cc
index 2bb005eb4..c6da628be 100644
--- a/arch/alpha/ev5.cc
+++ b/arch/alpha/ev5.cc
@@ -164,41 +164,9 @@ AlphaISA::zeroRegisters(CPU *cpu)
}
void
-ExecContext::ev5_temp_trap(Fault fault)
-{
- DPRINTF(Fault, "Fault %s at PC: %#x\n", fault->name(), regs.pc);
- cpu->recordEvent(csprintf("Fault %s", fault->name()));
-
- assert(!misspeculating());
- kernelStats->fault(fault);
-
- if (fault->isA<ArithmeticFault>())
- panic("Arithmetic traps are unimplemented!");
-
- // exception restart address
- if (!fault->isA<InterruptFault>() || !inPalMode())
- setMiscReg(AlphaISA::IPR_EXC_ADDR, regs.pc);
-
- if (fault->isA<PalFault>() || fault->isA<ArithmeticFault>() /* ||
- fault == InterruptFault && !inPalMode() */) {
- // traps... skip faulting instruction.
- setMiscReg(AlphaISA::IPR_EXC_ADDR,
- readMiscReg(AlphaISA::IPR_EXC_ADDR) + 4);
- }
-
- if (!inPalMode())
- AlphaISA::swap_palshadow(&regs, true);
-
- regs.pc = readMiscReg(AlphaISA::IPR_PAL_BASE) +
- (dynamic_cast<AlphaFault *>(fault.get()))->vect();
- regs.npc = regs.pc + sizeof(MachInst);
-}
-
-
-void
AlphaISA::intr_post(RegFile *regs, Fault fault, Addr pc)
{
- bool use_pc = (fault == NoFault);
+/* bool use_pc = (fault == NoFault);
if (fault->isA<ArithmeticFault>())
panic("arithmetic faults NYI...");
@@ -218,7 +186,7 @@ AlphaISA::intr_post(RegFile *regs, Fault fault, Addr pc)
(dynamic_cast<AlphaFault *>(fault.get()))->vect();
else
regs->npc = regs->miscRegs.readReg(IPR_PAL_BASE) + pc;
-
+*/
// that's it! (orders of magnitude less painful than x86)
}
diff --git a/arch/alpha/faults.cc b/arch/alpha/faults.cc
index 78613761d..0a836363c 100644
--- a/arch/alpha/faults.cc
+++ b/arch/alpha/faults.cc
@@ -28,15 +28,20 @@
#include "arch/alpha/faults.hh"
#include "cpu/exec_context.hh"
+#include "cpu/base.hh"
+#include "base/trace.hh"
+#include "kern/kernel_stats.hh"
namespace AlphaISA
{
-FaultVect AlphaMachineCheckFault::_vect = 0x0401;
-FaultStat AlphaMachineCheckFault::_stat;
+FaultName MachineCheckFault::_name = "mchk";
+FaultVect MachineCheckFault::_vect = 0x0401;
+FaultStat MachineCheckFault::_stat;
-FaultVect AlphaAlignmentFault::_vect = 0x0301;
-FaultStat AlphaAlignmentFault::_stat;
+FaultName AlignmentFault::_name = "unalign";
+FaultVect AlignmentFault::_vect = 0x0301;
+FaultStat AlignmentFault::_stat;
FaultName ResetFault::_name = "reset";
FaultVect ResetFault::_vect = 0x0001;
@@ -96,20 +101,47 @@ FaultStat IntegerOverflowFault::_stat;
#if FULL_SYSTEM
-void AlphaFault::ev5_trap(ExecContext * xc)
+void AlphaFault::invoke(ExecContext * xc)
{
- xc->ev5_temp_trap(this);
+ DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), xc->regs.pc);
+ xc->cpu->recordEvent(csprintf("Fault %s", name()));
+
+ assert(!xc->misspeculating());
+ xc->kernelStats->fault(this);
+
+ // exception restart address
+ if (setRestartAddress() || !xc->inPalMode())
+ xc->setMiscReg(AlphaISA::IPR_EXC_ADDR, xc->regs.pc);
+
+ if (skipFaultingInstruction()) {
+ // traps... skip faulting instruction.
+ xc->setMiscReg(AlphaISA::IPR_EXC_ADDR,
+ xc->readMiscReg(AlphaISA::IPR_EXC_ADDR) + 4);
+ }
+
+ if (!xc->inPalMode())
+ AlphaISA::swap_palshadow(&(xc->regs), true);
+
+ xc->regs.pc = xc->readMiscReg(AlphaISA::IPR_PAL_BASE) + vect();
+ xc->regs.npc = xc->regs.pc + sizeof(MachInst);
}
-void AlphaMachineCheckFault::ev5_trap(ExecContext * xc)
+void ArithmeticFault::invoke(ExecContext * xc)
{
- xc->ev5_temp_trap(this);
+ DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), xc->regs.pc);
+ xc->cpu->recordEvent(csprintf("Fault %s", name()));
+
+ assert(!xc->misspeculating());
+ xc->kernelStats->fault(this);
+
+ panic("Arithmetic traps are unimplemented!");
}
-void AlphaAlignmentFault::ev5_trap(ExecContext * xc)
+
+/*void ArithmeticFault::invoke(ExecContext * xc)
{
- xc->ev5_temp_trap(this);
-}
+ panic("Arithmetic traps are unimplemented!");
+}*/
#endif
diff --git a/arch/alpha/faults.hh b/arch/alpha/faults.hh
index 156faa8fb..c4a72e07c 100644
--- a/arch/alpha/faults.hh
+++ b/arch/alpha/faults.hh
@@ -40,51 +40,50 @@ typedef const Addr FaultVect;
class AlphaFault : public virtual FaultBase
{
+ protected:
+ virtual bool skipFaultingInstruction() {return false;}
+ virtual bool setRestartAddress() {return true;}
public:
#if FULL_SYSTEM
- void ev5_trap(ExecContext * xc);
+ void invoke(ExecContext * xc);
#endif
virtual FaultVect vect() = 0;
};
-class AlphaMachineCheckFault :
- public MachineCheckFault,
- public AlphaFault
+class MachineCheckFault : public AlphaFault
{
private:
+ static FaultName _name;
static FaultVect _vect;
static FaultStat _stat;
public:
-#if FULL_SYSTEM
- void ev5_trap(ExecContext * xc);
-#endif
+ FaultName name() {return _name;}
FaultVect vect() {return _vect;}
FaultStat & stat() {return _stat;}
+ bool isMachineCheckFault() {return true;}
};
-class AlphaAlignmentFault :
- public AlignmentFault,
- public AlphaFault
+class AlignmentFault : public AlphaFault
{
private:
+ static FaultName _name;
static FaultVect _vect;
static FaultStat _stat;
public:
-#if FULL_SYSTEM
- void ev5_trap(ExecContext * xc);
-#endif
+ FaultName name() {return _name;}
FaultVect vect() {return _vect;}
FaultStat & stat() {return _stat;}
+ bool isAlignmentFault() {return true;}
};
static inline Fault genMachineCheckFault()
{
- return new AlphaMachineCheckFault;
+ return new MachineCheckFault;
}
static inline Fault genAlignmentFault()
{
- return new AlphaAlignmentFault;
+ return new AlignmentFault;
}
class ResetFault : public AlphaFault
@@ -101,6 +100,8 @@ class ResetFault : public AlphaFault
class ArithmeticFault : public AlphaFault
{
+ protected:
+ bool skipFaultingInstruction() {return true;}
private:
static FaultName _name;
static FaultVect _vect;
@@ -109,10 +110,15 @@ class ArithmeticFault : public AlphaFault
FaultName name() {return _name;}
FaultVect vect() {return _vect;}
FaultStat & stat() {return _stat;}
+#if FULL_SYSTEM
+ void invoke(ExecContext * xc);
+#endif
};
class InterruptFault : public AlphaFault
{
+ protected:
+ bool setRestartAddress() {return false;}
private:
static FaultName _name;
static FaultVect _vect;
@@ -233,6 +239,8 @@ class FloatEnableFault : public AlphaFault
class PalFault : public AlphaFault
{
+ protected:
+ bool skipFaultingInstruction() {return true;}
private:
static FaultName _name;
static FaultVect _vect;
diff --git a/arch/alpha/isa_traits.hh b/arch/alpha/isa_traits.hh
index 938ba696e..b8aeffdde 100644
--- a/arch/alpha/isa_traits.hh
+++ b/arch/alpha/isa_traits.hh
@@ -57,7 +57,6 @@ namespace AlphaISA
{
typedef uint32_t MachInst;
-// typedef uint64_t Addr;
typedef uint8_t RegIndex;
enum {
diff --git a/arch/alpha/process.cc b/arch/alpha/process.cc
new file mode 100644
index 000000000..b2dbe7ad1
--- /dev/null
+++ b/arch/alpha/process.cc
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2003-2004 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "arch/alpha/process.hh"
+
+namespace AlphaISA
+{
+
+LiveProcess *
+createProcess(const std::string &nm, ObjectFile * objFile,
+ int stdin_fd, int stdout_fd, int stderr_fd,
+ std::vector<std::string> &argv, std::vector<std::string> &envp)
+{
+ LiveProcess * process = NULL;
+ if (objFile->getArch() != ObjectFile::Alpha)
+ fatal("Object file does not match architecture.");
+ switch (objFile->getOpSys()) {
+ case ObjectFile::Tru64:
+ process = new AlphaTru64Process(nm, objFile,
+ stdin_fd, stdout_fd, stderr_fd,
+ argv, envp);
+ break;
+
+ case ObjectFile::Linux:
+ process = new AlphaLinuxProcess(nm, objFile,
+ stdin_fd, stdout_fd, stderr_fd,
+ argv, envp);
+ break;
+
+ default:
+ fatal("Unknown/unsupported operating system.");
+ }
+ return process;
+}
+
+} // namespace AlphaISA
diff --git a/arch/alpha/process.hh b/arch/alpha/process.hh
new file mode 100644
index 000000000..7b660ddd0
--- /dev/null
+++ b/arch/alpha/process.hh
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2003-2004 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __ALPHA_PROCESS_HH__
+#define __ALPHA_PROCESS_HH__
+
+#include <string>
+
+#include "arch/alpha/linux_process.hh"
+#include "arch/alpha/tru64_process.hh"
+#include "base/loader/object_file.hh"
+
+namespace AlphaISA
+{
+
+LiveProcess *
+createProcess(const std::string &nm, ObjectFile * objFile,
+ int stdin_fd, int stdout_fd, int stderr_fd,
+ std::vector<std::string> &argv, std::vector<std::string> &envp);
+
+} // namespace AlphaISA
+
+#endif // __ALPHA_PROCESS_HH__
diff --git a/arch/alpha/system.cc b/arch/alpha/system.cc
index b841a6d53..1e80c7768 100644
--- a/arch/alpha/system.cc
+++ b/arch/alpha/system.cc
@@ -27,6 +27,7 @@
*/
#include "arch/alpha/system.hh"
+#include "arch/vtophys.hh"
#include "base/remote_gdb.hh"
#include "base/loader/object_file.hh"
#include "base/loader/symtab.hh"
@@ -35,7 +36,6 @@
#include "mem/functional/physical.hh"
#include "sim/byteswap.hh"
#include "sim/builder.hh"
-#include "targetarch/vtophys.hh"
using namespace LittleEndianGuest;
diff --git a/arch/mips/process.cc b/arch/mips/process.cc
new file mode 100644
index 000000000..6de44fe9f
--- /dev/null
+++ b/arch/mips/process.cc
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2003-2004 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "arch/mips/process.hh"
+
+namespace MipsISA
+{
+
+LiveProcess *
+createProcess(const string &nm, ObjectFile * objFile,
+ int stdin_fd, int stdout_fd, int stderr_fd,
+ vector<string> &argv, vector<string> &envp)
+{
+ LiveProcess * process = NULL;
+ if (objFile->getArch() != ObjectFile::MIPS)
+ fatal("Object file does not match architecture.");
+ switch (objFile->getOpSys()) {
+ case ObjectFile::Linux:
+ process = new MipsLinuxProcess(nm, objFile,
+ stdin_fd, stdout_fd, stderr_fd,
+ argv, envp);
+ break;
+
+ default:
+ fatal("Unknown/unsupported operating system.");
+ }
+ return process;
+}
+
+} // namespace MipsISA
+
diff --git a/arch/mips/process.hh b/arch/mips/process.hh
new file mode 100644
index 000000000..ab4323107
--- /dev/null
+++ b/arch/mips/process.hh
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2003-2004 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MIPS_PROCESS_HH__
+#define __MIPS_PROCESS_HH__
+
+#include "arch/mips/linux_process.hh"
+#include "base/loader/object_file.hh"
+
+namespace MipsISA
+{
+
+LiveProcess *
+createProcess(const string &nm, ObjectFile * objFile,
+ int stdin_fd, int stdout_fd, int stderr_fd,
+ vector<string> &argv, vector<string> &envp);
+
+} // namespace MipsISA
+
+#endif // __MIPS_PROCESS_HH__
diff --git a/arch/sparc/SConscript b/arch/sparc/SConscript
index fea31fd5d..edff5821e 100644
--- a/arch/sparc/SConscript
+++ b/arch/sparc/SConscript
@@ -47,7 +47,7 @@ base_sources = Split('''
# Full-system sources
full_system_sources = Split('''
- alpha_memory.cc
+ tlb.cc
arguments.cc
ev5.cc
osfpal.cc
@@ -57,9 +57,9 @@ full_system_sources = Split('''
# Syscall emulation (non-full-system) sources
syscall_emulation_sources = Split('''
- alpha_common_syscall_emul.cc
- alpha_linux_process.cc
- alpha_tru64_process.cc
+ common_syscall_emul.cc
+ linux_process.cc
+ process.cc
''')
sources = base_sources
diff --git a/arch/sparc/linux_process.cc b/arch/sparc/linux_process.cc
new file mode 100644
index 000000000..d1c439d72
--- /dev/null
+++ b/arch/sparc/linux_process.cc
@@ -0,0 +1,451 @@
+/*
+ * Copyright (c) 2003-2005 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "arch/sparc/common_syscall_emul.hh"
+#include "arch/sparc/linux_process.hh"
+#include "arch/sparc/isa_traits.hh"
+
+#include "base/trace.hh"
+#include "cpu/exec_context.hh"
+#include "kern/linux/linux.hh"
+#include "mem/functional/functional.hh"
+
+#include "sim/process.hh"
+#include "sim/syscall_emul.hh"
+
+using namespace std;
+using namespace SparcISA;
+
+/// Target pipe() handler. Even though this is a generic Posix call,
+/// the Alpha return convention is funky, so that makes it
+/// Alpha-specific.
+SyscallReturn
+pipeFunc(SyscallDesc *desc, int callnum, Process *process,
+ ExecContext *xc)
+{
+ int fds[2], sim_fds[2];
+ int pipe_retval = pipe(fds);
+
+ if (pipe_retval < 0) {
+ // error
+ return pipe_retval;
+ }
+
+ sim_fds[0] = process->alloc_fd(fds[0]);
+ sim_fds[1] = process->alloc_fd(fds[1]);
+
+ // Alpha Linux convention for pipe() is that fd[0] is returned as
+ // the return value of the function, and fd[1] is returned in r20.
+ xc->regs.intRegFile[20] = sim_fds[1];
+ return sim_fds[0];
+}
+
+
+/// Target uname() handler.
+static SyscallReturn
+unameFunc(SyscallDesc *desc, int callnum, Process *process,
+ ExecContext *xc)
+{
+ TypedBufferArg<Linux::utsname> name(xc->getSyscallArg(0));
+
+ strcpy(name->sysname, "Linux");
+ strcpy(name->nodename, "m5.eecs.umich.edu");
+ strcpy(name->release, "2.4.20");
+ strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
+ strcpy(name->machine, "alpha");
+
+ name.copyOut(xc->mem);
+ return 0;
+}
+
+/// Target osf_getsysyinfo() handler. Even though this call is
+/// borrowed from Tru64, the subcases that get used appear to be
+/// different in practice from those used by Tru64 processes.
+static SyscallReturn
+osf_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
+ ExecContext *xc)
+{
+ unsigned op = xc->getSyscallArg(0);
+ // unsigned nbytes = xc->getSyscallArg(2);
+
+ switch (op) {
+
+ case 45: { // GSI_IEEE_FP_CONTROL
+ TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
+ // I don't think this exactly matches the HW FPCR
+ *fpcr = 0;
+ fpcr.copyOut(xc->mem);
+ return 0;
+ }
+
+ default:
+ cerr << "osf_getsysinfo: unknown op " << op << endl;
+ abort();
+ break;
+ }
+
+ return 1;
+}
+
+/// Target osf_setsysinfo() handler.
+static SyscallReturn
+osf_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
+ ExecContext *xc)
+{
+ unsigned op = xc->getSyscallArg(0);
+ // unsigned nbytes = xc->getSyscallArg(2);
+
+ switch (op) {
+
+ case 14: { // SSI_IEEE_FP_CONTROL
+ TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
+ // I don't think this exactly matches the HW FPCR
+ fpcr.copyIn(xc->mem);
+ DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
+ " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
+ return 0;
+ }
+
+ default:
+ cerr << "osf_setsysinfo: unknown op " << op << endl;
+ abort();
+ break;
+ }
+
+ return 1;
+}
+
+SyscallDesc SparcLinuxProcess::syscallDescs[] = {
+ /* 0 */ SyscallDesc("restart_syscall", unimplimentedFunc);
+ /* 1 */ SyscallDesc("exit", unimplimentedFunc);
+ /* 2 */ SyscallDesc("fork", unimplimentedFunc);
+ /* 3 */ SyscallDesc("read", unimplimentedFunc);
+ /* 4 */ SyscallDesc("write", unimplimentedFunc);
+ /* 5 */ SyscallDesc("open", unimplimentedFunc);
+ /* 6 */ SyscallDesc("close", unimplimentedFunc);
+ /* 7 */ SyscallDesc("wait4", unimplimentedFunc);
+ /* 8 */ SyscallDesc("creat", unimplimentedFunc);
+ /* 9 */ SyscallDesc("link", unimplimentedFunc);
+ /* 10 */ SyscallDesc("unlink", unimplimentedFunc);
+ /* 11 */ SyscallDesc("execv", unimplimentedFunc);
+ /* 12 */ SyscallDesc("chdir", unimplimentedFunc);
+ /* 13 */ SyscallDesc("chown", unimplimentedFunc);
+ /* 14 */ SyscallDesc("mknod", unimplimentedFunc);
+ /* 15 */ SyscallDesc("chmod", unimplimentedFunc);
+ /* 16 */ SyscallDesc("lchown", unimplimentedFunc);
+ /* 17 */ SyscallDesc("brk", unimplimentedFunc);
+ /* 18 */ SyscallDesc("perfctr", unimplimentedFunc);
+ /* 19 */ SyscallDesc("lseek", unimplimentedFunc);
+ /* 20 */ SyscallDesc("getpid", unimplimentedFunc);
+ /* 21 */ SyscallDesc("capget", unimplimentedFunc);
+ /* 22 */ SyscallDesc("capset", unimplimentedFunc);
+ /* 23 */ SyscallDesc("setuid", unimplimentedFunc);
+ /* 24 */ SyscallDesc("getuid", unimplimentedFunc);
+ /* 25 */ SyscallDesc("time", unimplimentedFunc);
+ /* 26 */ SyscallDesc("ptrace", unimplimentedFunc);
+ /* 27 */ SyscallDesc("alarm", unimplimentedFunc);
+ /* 28 */ SyscallDesc("sigaltstack", unimplimentedFunc);
+ /* 29 */ SyscallDesc("pause", unimplimentedFunc);
+ /* 30 */ SyscallDesc("utime", unimplimentedFunc);
+ /* 31 */ SyscallDesc("lchown32", unimplimentedFunc);
+ /* 32 */ SyscallDesc("fchown32", unimplimentedFunc);
+ /* 33 */ SyscallDesc("access", unimplimentedFunc);
+ /* 34 */ SyscallDesc("nice", unimplimentedFunc);
+ /* 35 */ SyscallDesc("chown32", unimplimentedFunc);
+ /* 36 */ SyscallDesc("sync", unimplimentedFunc);
+ /* 37 */ SyscallDesc("kill", unimplimentedFunc);
+ /* 38 */ SyscallDesc("stat", unimplimentedFunc);
+ /* 39 */ SyscallDesc("sendfile", unimplimentedFunc);
+ /* 40 */ SyscallDesc("lstat", unimplimentedFunc);
+ /* 41 */ SyscallDesc("dup", unimplimentedFunc);
+ /* 42 */ SyscallDesc("pipe", unimplimentedFunc);
+ /* 43 */ SyscallDesc("times", unimplimentedFunc);
+ /* 44 */ SyscallDesc("getuid32", unimplimentedFunc);
+ /* 45 */ SyscallDesc("umount2", unimplimentedFunc);
+ /* 46 */ SyscallDesc("setgid", unimplimentedFunc);
+ /* 47 */ SyscallDesc("getgid", unimplimentedFunc);
+ /* 48 */ SyscallDesc("signal", unimplimentedFunc);
+ /* 49 */ SyscallDesc("geteuid", unimplimentedFunc);
+ /* 50 */ SyscallDesc("getegid", unimplimentedFunc);
+ /* 51 */ SyscallDesc("acct", unimplimentedFunc);
+ /* 52 */ SyscallDesc("memory_ordering", unimplimentedFunc);
+ /* 53 */ SyscallDesc("getgid32", unimplimentedFunc);
+ /* 54 */ SyscallDesc("ioctl", unimplimentedFunc);
+ /* 55 */ SyscallDesc("reboot", unimplimentedFunc);
+ /* 56 */ SyscallDesc("mmap2", unimplimentedFunc);
+ /* 57 */ SyscallDesc("symlink", unimplimentedFunc);
+ /* 58 */ SyscallDesc("readlink", unimplimentedFunc);
+ /* 59 */ SyscallDesc("execve", unimplimentedFunc);
+ /* 60 */ SyscallDesc("umask", unimplimentedFunc);
+ /* 61 */ SyscallDesc("chroot", unimplimentedFunc);
+ /* 62 */ SyscallDesc("fstat", unimplimentedFunc);
+ /* 63 */ SyscallDesc("fstat64", unimplimentedFunc);
+ /* 64 */ SyscallDesc("getpagesize", unimplimentedFunc);
+ /* 65 */ SyscallDesc("msync", unimplimentedFunc);
+ /* 66 */ SyscallDesc("vfork", unimplimentedFunc);
+ /* 67 */ SyscallDesc("pread64", unimplimentedFunc);
+ /* 68 */ SyscallDesc("pwrite64", unimplimentedFunc);
+ /* 69 */ SyscallDesc("geteuid32", unimplimentedFunc);
+ /* 70 */ SyscallDesc("getdgid32", unimplimentedFunc);
+ /* 71 */ SyscallDesc("mmap", unimplimentedFunc);
+ /* 72 */ SyscallDesc("setreuid32", unimplimentedFunc);
+ /* 73 */ SyscallDesc("munmap", unimplimentedFunc);
+ /* 74 */ SyscallDesc("mprotect", unimplimentedFunc);
+ /* 75 */ SyscallDesc("madvise", unimplimentedFunc);
+ /* 76 */ SyscallDesc("vhangup", unimplimentedFunc);
+ /* 77 */ SyscallDesc("truncate64", unimplimentedFunc);
+ /* 78 */ SyscallDesc("mincore", unimplimentedFunc);
+ /* 79 */ SyscallDesc("getgroups", unimplimentedFunc);
+ /* 80 */ SyscallDesc("setgroups", unimplimentedFunc);
+ /* 81 */ SyscallDesc("getpgrp", unimplimentedFunc);
+ /* 82 */ SyscallDesc("setgroups32", unimplimentedFunc);
+ /* 83 */ SyscallDesc("setitimer", unimplimentedFunc);
+ /* 84 */ SyscallDesc("ftruncate64", unimplimentedFunc);
+ /* 85 */ SyscallDesc("swapon", unimplimentedFunc);
+ /* 86 */ SyscallDesc("getitimer", unimplimentedFunc);
+ /* 87 */ SyscallDesc("setuid32", unimplimentedFunc);
+ /* 88 */ SyscallDesc("sethostname", unimplimentedFunc);
+ /* 89 */ SyscallDesc("setgid32", unimplimentedFunc);
+ /* 90 */ SyscallDesc("dup2", unimplimentedFunc);
+ /* 91 */ SyscallDesc("setfsuid32", unimplimentedFunc);
+ /* 92 */ SyscallDesc("fcntl", unimplimentedFunc);
+ /* 93 */ SyscallDesc("select", unimplimentedFunc);
+ /* 94 */ SyscallDesc("setfsgid32", unimplimentedFunc);
+ /* 95 */ SyscallDesc("fsync", unimplimentedFunc);
+ /* 96 */ SyscallDesc("setpriority", unimplimentedFunc);
+ /* 97 */ SyscallDesc("socket", unimplimentedFunc);
+ /* 98 */ SyscallDesc("connect", unimplimentedFunc);
+ /* 99 */ SyscallDesc("accept", unimplimentedFunc);
+ /* 100 */ SyscallDesc("getpriority", unimplimentedFunc);
+ /* 101 */ SyscallDesc("rt_sigreturn", unimplimentedFunc);
+ /* 102 */ SyscallDesc("rt_sigaction", unimplimentedFunc);
+ /* 103 */ SyscallDesc("rt_sigprocmask", unimplimentedFunc);
+ /* 104 */ SyscallDesc("rt_sigpending", unimplimentedFunc);
+ /* 105 */ SyscallDesc("rt_sigtimedwait", unimplimentedFunc);
+ /* 106 */ SyscallDesc("rt_sigqueueinfo", unimplimentedFunc);
+ /* 107 */ SyscallDesc("rt_sigsuspend", unimplimentedFunc);
+ /* 108 */ SyscallDesc("setresuid", unimplimentedFunc);
+ /* 109 */ SyscallDesc("getresuid", unimplimentedFunc);
+ /* 110 */ SyscallDesc("setresgid", unimplimentedFunc);
+ /* 111 */ SyscallDesc("getresgid", unimplimentedFunc);
+ /* 112 */ SyscallDesc("setregid32", unimplimentedFunc);
+ /* 113 */ SyscallDesc("recvmsg", unimplimentedFunc);
+ /* 114 */ SyscallDesc("sendmsg", unimplimentedFunc);
+ /* 115 */ SyscallDesc("getgroups32", unimplimentedFunc);
+ /* 116 */ SyscallDesc("gettimeofday", unimplimentedFunc);
+ /* 117 */ SyscallDesc("getrusage", unimplimentedFunc);
+ /* 118 */ SyscallDesc("getsockopt", unimplimentedFunc);
+ /* 119 */ SyscallDesc("getcwd", unimplimentedFunc);
+ /* 120 */ SyscallDesc("readv", unimplimentedFunc);
+ /* 121 */ SyscallDesc("writev", unimplimentedFunc);
+ /* 122 */ SyscallDesc("settimeofday", unimplimentedFunc);
+ /* 123 */ SyscallDesc("fchown", unimplimentedFunc);
+ /* 124 */ SyscallDesc("fchmod", unimplimentedFunc);
+ /* 125 */ SyscallDesc("recvfrom", unimplimentedFunc);
+ /* 126 */ SyscallDesc("setreuid", unimplimentedFunc);
+ /* 127 */ SyscallDesc("setregid", unimplimentedFunc);
+ /* 128 */ SyscallDesc("rename", unimplimentedFunc);
+ /* 129 */ SyscallDesc("truncate", unimplimentedFunc);
+ /* 130 */ SyscallDesc("ftruncate", unimplimentedFunc);
+ /* 131 */ SyscallDesc("flock", unimplimentedFunc);
+ /* 132 */ SyscallDesc("lstat64", unimplimentedFunc);
+ /* 133 */ SyscallDesc("sendto", unimplimentedFunc);
+ /* 134 */ SyscallDesc("shutdown", unimplimentedFunc);
+ /* 135 */ SyscallDesc("socketpair", unimplimentedFunc);
+ /* 136 */ SyscallDesc("mkdir", unimplimentedFunc);
+ /* 137 */ SyscallDesc("rmdir", unimplimentedFunc);
+ /* 138 */ SyscallDesc("utimes", unimplimentedFunc);
+ /* 139 */ SyscallDesc("stat64", unimplimentedFunc);
+ /* 140 */ SyscallDesc("sendfile64", unimplimentedFunc);
+ /* 141 */ SyscallDesc("getpeername", unimplimentedFunc);
+ /* 142 */ SyscallDesc("futex", unimplimentedFunc);
+ /* 143 */ SyscallDesc("gettid", unimplimentedFunc);
+ /* 144 */ SyscallDesc("getrlimit", unimplimentedFunc);
+ /* 145 */ SyscallDesc("setrlimit", unimplimentedFunc);
+ /* 146 */ SyscallDesc("pivot_root", unimplimentedFunc);
+ /* 147 */ SyscallDesc("prctl", unimplimentedFunc);
+ /* 148 */ SyscallDesc("pciconfig_read", unimplimentedFunc);
+ /* 149 */ SyscallDesc("pciconfig_write", unimplimentedFunc);
+ /* 150 */ SyscallDesc("getsockname", unimplimentedFunc);
+ /* 151 */ SyscallDesc("inotify_init", unimplimentedFunc);
+ /* 152 */ SyscallDesc("inotify_add_watch", unimplimentedFunc);
+ /* 153 */ SyscallDesc("poll", unimplimentedFunc);
+ /* 154 */ SyscallDesc("getdents64", unimplimentedFunc);
+ /* 155 */ SyscallDesc("fcntl64", unimplimentedFunc);
+ /* 156 */ SyscallDesc("inotify_rm_watch", unimplimentedFunc);
+ /* 157 */ SyscallDesc("statfs", unimplimentedFunc);
+ /* 158 */ SyscallDesc("fstatfs", unimplimentedFunc);
+ /* 159 */ SyscallDesc("umount", unimplimentedFunc);
+ /* 160 */ SyscallDesc("sched_set_affinity", unimplimentedFunc);
+ /* 161 */ SyscallDesc("sched_get_affinity", unimplimentedFunc);
+ /* 162 */ SyscallDesc("getdomainname", unimplimentedFunc);
+ /* 163 */ SyscallDesc("setdomainname", unimplimentedFunc);
+ /* 164 */ SyscallDesc("utrap_install", unimplimentedFunc);
+ /* 165 */ SyscallDesc("quotactl", unimplimentedFunc);
+ /* 166 */ SyscallDesc("set_tid_address", unimplimentedFunc);
+ /* 167 */ SyscallDesc("mount", unimplimentedFunc);
+ /* 168 */ SyscallDesc("ustat", unimplimentedFunc);
+ /* 169 */ SyscallDesc("setxattr", unimplimentedFunc);
+ /* 170 */ SyscallDesc("lsetxattr", unimplimentedFunc);
+ /* 171 */ SyscallDesc("fsetxattr", unimplimentedFunc);
+ /* 172 */ SyscallDesc("getxattr", unimplimentedFunc);
+ /* 173 */ SyscallDesc("lgetxattr", unimplimentedFunc);
+ /* 174 */ SyscallDesc("getdents", unimplimentedFunc);
+ /* 175 */ SyscallDesc("setsid", unimplimentedFunc);
+ /* 176 */ SyscallDesc("fchdir", unimplimentedFunc);
+ /* 177 */ SyscallDesc("fgetxattr", unimplimentedFunc);
+ /* 178 */ SyscallDesc("listxattr", unimplimentedFunc);
+ /* 179 */ SyscallDesc("llistxattr", unimplimentedFunc);
+ /* 180 */ SyscallDesc("flistxattr", unimplimentedFunc);
+ /* 181 */ SyscallDesc("removexattr", unimplimentedFunc);
+ /* 182 */ SyscallDesc("lremovexattr", unimplimentedFunc);
+ /* 183 */ SyscallDesc("sigpending", unimplimentedFunc);
+ /* 184 */ SyscallDesc("query_module", unimplimentedFunc);
+ /* 185 */ SyscallDesc("setpgid", unimplimentedFunc);
+ /* 186 */ SyscallDesc("fremovexattr", unimplimentedFunc);
+ /* 187 */ SyscallDesc("tkill", unimplimentedFunc);
+ /* 188 */ SyscallDesc("exit_group", unimplimentedFunc);
+ /* 189 */ SyscallDesc("uname", unimplimentedFunc);
+ /* 190 */ SyscallDesc("init_module", unimplimentedFunc);
+ /* 191 */ SyscallDesc("personality", unimplimentedFunc);
+ /* 192 */ SyscallDesc("remap_file_pages", unimplimentedFunc);
+ /* 193 */ SyscallDesc("epoll_create", unimplimentedFunc);
+ /* 194 */ SyscallDesc("epoll_ctl", unimplimentedFunc);
+ /* 195 */ SyscallDesc("epoll_wait", unimplimentedFunc);
+ /* 196 */ SyscallDesc("ioprio_set", unimplimentedFunc);
+ /* 197 */ SyscallDesc("getppid", unimplimentedFunc);
+ /* 198 */ SyscallDesc("sigaction", unimplimentedFunc);
+ /* 199 */ SyscallDesc("sgetmask", unimplimentedFunc);
+ /* 200 */ SyscallDesc("ssetmask", unimplimentedFunc);
+ /* 201 */ SyscallDesc("sigsuspend", unimplimentedFunc);
+ /* 202 */ SyscallDesc("oldlstat", unimplimentedFunc);
+ /* 203 */ SyscallDesc("uselib", unimplimentedFunc);
+ /* 204 */ SyscallDesc("readdir", unimplimentedFunc);
+ /* 205 */ SyscallDesc("readahead", unimplimentedFunc);
+ /* 206 */ SyscallDesc("socketcall", unimplimentedFunc);
+ /* 207 */ SyscallDesc("syslog", unimplimentedFunc);
+ /* 208 */ SyscallDesc("lookup_dcookie", unimplimentedFunc);
+ /* 209 */ SyscallDesc("fadvise64", unimplimentedFunc);
+ /* 210 */ SyscallDesc("fadvise64_64", unimplimentedFunc);
+ /* 211 */ SyscallDesc("tgkill", unimplimentedFunc);
+ /* 212 */ SyscallDesc("waitpid", unimplimentedFunc);
+ /* 213 */ SyscallDesc("swapoff", unimplimentedFunc);
+ /* 214 */ SyscallDesc("sysinfo", unimplimentedFunc);
+ /* 215 */ SyscallDesc("ipc", unimplimentedFunc);
+ /* 216 */ SyscallDesc("sigreturn", unimplimentedFunc);
+ /* 217 */ SyscallDesc("clone", unimplimentedFunc);
+ /* 218 */ SyscallDesc("ioprio_get", unimplimentedFunc);
+ /* 219 */ SyscallDesc("adjtimex", unimplimentedFunc);
+ /* 220 */ SyscallDesc("sigprocmask", unimplimentedFunc);
+ /* 221 */ SyscallDesc("create_module", unimplimentedFunc);
+ /* 222 */ SyscallDesc("delete_module", unimplimentedFunc);
+ /* 223 */ SyscallDesc("get_kernel_syms", unimplimentedFunc);
+ /* 224 */ SyscallDesc("getpgid", unimplimentedFunc);
+ /* 225 */ SyscallDesc("bdflush", unimplimentedFunc);
+ /* 226 */ SyscallDesc("sysfs", unimplimentedFunc);
+ /* 227 */ SyscallDesc("afs_syscall", unimplimentedFunc);
+ /* 228 */ SyscallDesc("setfsuid", unimplimentedFunc);
+ /* 229 */ SyscallDesc("setfsgid", unimplimentedFunc);
+ /* 230 */ SyscallDesc("_newselect", unimplimentedFunc);
+ /* 231 */ SyscallDesc("time", unimplimentedFunc);
+ /* 232 */ SyscallDesc("oldstat", unimplimentedFunc);
+ /* 233 */ SyscallDesc("stime", unimplimentedFunc);
+ /* 234 */ SyscallDesc("statfs64", unimplimentedFunc);
+ /* 235 */ SyscallDesc("fstatfs64", unimplimentedFunc);
+ /* 236 */ SyscallDesc("_llseek", unimplimentedFunc);
+ /* 237 */ SyscallDesc("mlock", unimplimentedFunc);
+ /* 238 */ SyscallDesc("munlock", unimplimentedFunc);
+ /* 239 */ SyscallDesc("mlockall", unimplimentedFunc);
+ /* 240 */ SyscallDesc("munlockall", unimplimentedFunc);
+ /* 241 */ SyscallDesc("sched_setparam", unimplimentedFunc);
+ /* 242 */ SyscallDesc("sched_getparam", unimplimentedFunc);
+ /* 243 */ SyscallDesc("sched_setscheduler", unimplimentedFunc);
+ /* 244 */ SyscallDesc("sched_getscheduler", unimplimentedFunc);
+ /* 245 */ SyscallDesc("sched_yield", unimplimentedFunc);
+ /* 246 */ SyscallDesc("sched_get_priority_max", unimplimented);
+ /* 247 */ SyscallDesc("sched_get_priority_min", unimplimented);
+ /* 248 */ SyscallDesc("sched_rr_get_interval", unimplimented);
+ /* 249 */ SyscallDesc("nanosleep", unimplimentedFunc);
+ /* 250 */ SyscallDesc("mremap", unimplimentedFunc);
+ /* 251 */ SyscallDesc("_sysctl", unimplimentedFunc);
+ /* 252 */ SyscallDesc("getsid", unimplimentedFunc);
+ /* 253 */ SyscallDesc("fdatasync", unimplimentedFunc);
+ /* 254 */ SyscallDesc("nfsservctl", unimplimentedFunc);
+ /* 255 */ SyscallDesc("aplib", unimplimentedFunc);
+ /* 256 */ SyscallDesc("clock_settime", unimplimentedFunc);
+ /* 257 */ SyscallDesc("clock_gettime", unimplimentedFunc);
+ /* 258 */ SyscallDesc("clock_getres", unimplimentedFunc);
+ /* 259 */ SyscallDesc("clock_nanosleep", unimplimentedFunc);
+ /* 260 */ SyscallDesc("sched_getaffinity", unimplimentedFunc);
+ /* 261 */ SyscallDesc("sched_setaffinity", unimplimentedFunc);
+ /* 262 */ SyscallDesc("timer_settime", unimplimentedFunc);
+ /* 263 */ SyscallDesc("timer_gettime", unimplimentedFunc);
+ /* 264 */ SyscallDesc("timer_getoverrun", unimplimentedFunc);
+ /* 265 */ SyscallDesc("timer_delete", unimplimentedFunc);
+ /* 266 */ SyscallDesc("timer_create", unimplimentedFunc);
+ /* 267 */ SyscallDesc("vserver", unimplimentedFunc);
+ /* 268 */ SyscallDesc("io_setup", unimplimentedFunc);
+ /* 269 */ SyscallDesc("io_destroy", unimplimentedFunc);
+ /* 270 */ SyscallDesc("io_submit", unimplimentedFunc);
+ /* 271 */ SyscallDesc("io_cancel", unimplimentedFunc);
+ /* 272 */ SyscallDesc("io_getevents", unimplimentedFunc);
+ /* 273 */ SyscallDesc("mq_open", unimplimentedFunc);
+ /* 274 */ SyscallDesc("mq_unlink", unimplimentedFunc);
+ /* 275 */ SyscallDesc("mq_timedsend", unimplimentedFunc);
+ /* 276 */ SyscallDesc("mq_timedreceive", unimplimentedFunc);
+ /* 277 */ SyscallDesc("mq_notify", unimplimentedFunc);
+ /* 278 */ SyscallDesc("mq_getsetattr", unimplimentedFunc);
+ /* 279 */ SyscallDesc("waitid", unimplimentedFunc);
+ /* 280 */ SyscallDesc("sys_setaltroot", unimplimentedFunc);
+ /* 281 */ SyscallDesc("add_key", unimplimentedFunc);
+ /* 282 */ SyscallDesc("request_key", unimplimentedFunc);
+ /* 283 */ SyscallDesc("keyctl", unimplimentedFunc);
+};
+
+SparcLinuxProcess::SparcLinuxProcess(const std::string &name,
+ ObjectFile *objFile,
+ int stdin_fd,
+ int stdout_fd,
+ int stderr_fd,
+ std::vector<std::string> &argv,
+ std::vector<std::string> &envp)
+ : LiveProcess(name, objFile, stdin_fd, stdout_fd, stderr_fd, argv, envp),
+ Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
+{
+ init_regs->intRegFile[0] = 0;
+}
+
+
+
+SyscallDesc*
+AlphaLinuxProcess::getDesc(int callnum)
+{
+ if (callnum < 0 || callnum > Num_Syscall_Descs)
+ return NULL;
+ return &syscallDescs[callnum];
+}
diff --git a/arch/sparc/linux_process.hh b/arch/sparc/linux_process.hh
new file mode 100644
index 000000000..c41406b4b
--- /dev/null
+++ b/arch/sparc/linux_process.hh
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2003-2004 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __SPARC_LINUX_PROCESS_HH__
+#define __SPARC_LINUX_PROCESS_HH__
+
+#include "sim/process.hh"
+
+
+/// A process with emulated SPARC/Linux syscalls.
+class SparcLinuxProcess : public LiveProcess
+{
+ public:
+ /// Constructor.
+ SparcLinuxProcess(const std::string &name,
+ ObjectFile *objFile,
+ int stdin_fd, int stdout_fd, int stderr_fd,
+ std::vector<std::string> &argv,
+ std::vector<std::string> &envp);
+
+ virtual SyscallDesc* getDesc(int callnum);
+
+ /// The target system's hostname.
+ static const char *hostname;
+
+ /// Array of syscall descriptors, indexed by call number.
+ static SyscallDesc syscallDescs[];
+
+ const int Num_Syscall_Descs;
+};
+
+
+#endif // __ALPHA_LINUX_PROCESS_HH__
diff --git a/arch/sparc/process.cc b/arch/sparc/process.cc
new file mode 100644
index 000000000..53a215379
--- /dev/null
+++ b/arch/sparc/process.cc
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2003-2004 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "arch/sparc/process.hh"
+
+namespace SparcISA
+{
+
+LiveProcess *
+createProcess(const string &nm, ObjectFile * objFile,
+ int stdin_fd, int stdout_fd, int stderr_fd,
+ vector<string> &argv, vector<string> &envp)
+{
+ LiveProcess * process = NULL;
+ if (objFile->getArch() != ObjectFile::SPARC)
+ fatal("Object file does not match architecture.");
+ switch (objFile->getOpSys()) {
+ case ObjectFile::Linux:
+ process = new SparcLinuxProcess(nm, objFile,
+ stdin_fd, stdout_fd, stderr_fd,
+ argv, envp);
+ break;
+
+ case ObjectFile::Solaris:
+ default:
+ fatal("Unknown/unsupported operating system.");
+ }
+ return process;
+}
+
+} // namespace SparcISA
diff --git a/arch/sparc/process.hh b/arch/sparc/process.hh
new file mode 100644
index 000000000..387649d47
--- /dev/null
+++ b/arch/sparc/process.hh
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2003-2004 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __SPARC_PROCESS_HH__
+#define __SPARC_PROCESS_HH__
+
+#include "arch/sparc/linux_process.hh"
+#include "base/loader/object_file.hh"
+
+namespace SparcISA
+{
+
+LiveProcess *
+createProcess(const string &nm, ObjectFile * objFile,
+ int stdin_fd, int stdout_fd, int stderr_fd,
+ vector<string> &argv, vector<string> &envp);
+
+} // namespace SparcISA
+
+#endif // __SPARC_PROCESS_HH__
diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc
index b74d537af..fd69c9e56 100644
--- a/base/loader/elf_object.cc
+++ b/base/loader/elf_object.cc
@@ -38,8 +38,8 @@
#define __LIBELF_NEED_LINK_H 0
#define __LIBELF_SYMBOL_VERSIONS 0
-#include <libelf/libelf.h>
-#include <libelf/gelf.h>
+#include "libelf/libelf.h"
+#include "libelf/gelf.h"
#include "base/loader/elf_object.hh"
@@ -56,6 +56,8 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
{
Elf *elf;
GElf_Ehdr ehdr;
+ Arch arch = UnknownArch;
+ OpSys opSys = UnknownOpSys;
// check that header matches library version
if (elf_version(EV_CURRENT) == EV_NONE)
@@ -73,8 +75,8 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
return NULL;
}
else {
- if (ehdr.e_ident[EI_CLASS] == ELFCLASS32)
- panic("32 bit ELF Binary, Not Supported");
+// if (ehdr.e_ident[EI_CLASS] == ELFCLASS32)
+// panic("32 bit ELF Binary, Not Supported");
/* @todo this emachine value isn't offical yet.
* so we probably shouldn't check it. */
// if (ehdr.e_machine != EM_ALPHA)
@@ -82,8 +84,43 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
elf_end(elf);
- return new ElfObject(fname, fd, len, data,
- ObjectFile::Alpha, ObjectFile::Linux);
+ //Detect the architecture
+ //Versioning issues in libelf need to be resolved to get the correct
+ //SPARC constants.
+ //If MIPS supports 32 bit executables, this may need to be changed.
+ //Also, there are other MIPS constants which may be used, like
+ //EM_MIPS_RS3_LE and EM_MIPS_X
+ //Since we don't know how to check for alpha right now, we'll
+ //just assume if it wasn't something else and it's 64 bit, that's
+ //what it must be.
+ if (ehdr.e_machine == EM_SPARC64 ||
+ ehdr.e_machine == EM_SPARC ||
+ ehdr.e_machine == EM_SPARCV9) {
+ arch = ObjectFile::SPARC;
+ } else if (ehdr.e_machine == EM_MIPS
+ && ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
+ arch = ObjectFile::MIPS;
+ } else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
+ arch = ObjectFile::Alpha;
+ } else {
+ arch = ObjectFile::UnknownArch;
+ }
+
+ //Detect the operating system
+ switch (ehdr.e_ident[EI_OSABI])
+ {
+ case ELFOSABI_LINUX:
+ opSys = ObjectFile::Linux;
+ break;
+ case ELFOSABI_SOLARIS:
+ opSys = ObjectFile::Solaris;
+ case ELFOSABI_TRU64:
+ opSys = ObjectFile::Tru64;
+ default:
+ opSys = ObjectFile::UnknownOpSys;
+ }
+
+ return new ElfObject(fname, fd, len, data, arch, opSys);
}
}
diff --git a/base/loader/object_file.hh b/base/loader/object_file.hh
index 3c8659e18..1b44ae14f 100644
--- a/base/loader/object_file.hh
+++ b/base/loader/object_file.hh
@@ -29,7 +29,9 @@
#ifndef __OBJECT_FILE_HH__
#define __OBJECT_FILE_HH__
-#include "arch/isa_traits.hh" // for Addr
+#include <string>
+
+#include "sim/host.hh" // for Addr
class FunctionalMemory;
class SymbolTable;
@@ -40,13 +42,16 @@ class ObjectFile
enum Arch {
UnknownArch,
- Alpha
+ Alpha,
+ SPARC,
+ MIPS
};
enum OpSys {
UnknownOpSys,
Tru64,
- Linux
+ Linux,
+ Solaris
};
protected:
diff --git a/cpu/exec_context.cc b/cpu/exec_context.cc
index 7dd9bf58d..e0ab1007f 100644
--- a/cpu/exec_context.cc
+++ b/cpu/exec_context.cc
@@ -253,15 +253,3 @@ ExecContext::regStats(const string &name)
#endif
}
-void
-ExecContext::trap(Fault fault)
-{
- //TheISA::trap(fault); //One possible way to do it...
-
- /** @todo: Going to hack it for now. Do a true fixup later. */
-#if FULL_SYSTEM
- fault->ev5_trap(this);
-#else
- fatal("fault (%d) detected @ PC 0x%08p", fault, readPC());
-#endif
-}
diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh
index d8ec88537..bc3551b4f 100644
--- a/cpu/exec_context.hh
+++ b/cpu/exec_context.hh
@@ -447,18 +447,9 @@ class ExecContext
void setIntrFlag(int val) { regs.intrflag = val; }
Fault hwrei();
bool inPalMode() { return AlphaISA::PcPAL(regs.pc); }
- void ev5_temp_trap(Fault fault);
bool simPalCheck(int palFunc);
#endif
- /** Meant to be more generic trap function to be
- * called when an instruction faults.
- * @param fault The fault generated by executing the instruction.
- * @todo How to do this properly so it's dependent upon ISA only?
- */
-
- void trap(Fault fault);
-
#if !FULL_SYSTEM
TheISA::IntReg getSyscallArg(int i)
{
diff --git a/cpu/o3/alpha_cpu_impl.hh b/cpu/o3/alpha_cpu_impl.hh
index daa61bb1c..a1c659b51 100644
--- a/cpu/o3/alpha_cpu_impl.hh
+++ b/cpu/o3/alpha_cpu_impl.hh
@@ -302,7 +302,7 @@ template <class Impl>
void
AlphaFullCPU<Impl>::trap(Fault fault)
{
- // Keep in mind that a trap may be initiated by fetch if there's a TLB
+/* // Keep in mind that a trap may be initiated by fetch if there's a TLB
// miss
uint64_t PC = this->commit.readCommitPC();
@@ -318,8 +318,9 @@ AlphaFullCPU<Impl>::trap(Fault fault)
if (!fault->isA<InterruptFault>() || !inPalMode(PC))
this->regFile.miscRegs.setReg(AlphaISA::IPR_EXC_ADDR, PC);
- if (fault->isA<PalFault>() || fault->isA<ArithmeticFault>() /* ||
- fault == InterruptFault && !PC_PAL(regs.pc) */) {
+ if (fault->isA<PalFault>() || fault->isA<ArithmeticFault>())
+ // || fault == InterruptFault && !PC_PAL(regs.pc)
+ {
// traps... skip faulting instruction
AlphaISA::MiscReg ipr_exc_addr =
this->regFile.miscRegs.readReg(AlphaISA::IPR_EXC_ADDR);
@@ -332,7 +333,7 @@ AlphaFullCPU<Impl>::trap(Fault fault)
this->regFile.setPC(this->regFile.miscRegs.readReg(AlphaISA::IPR_PAL_BASE) +
(dynamic_cast<AlphaFault *>(fault.get()))->vect());
- this->regFile.setNextPC(PC + sizeof(MachInst));
+ this->regFile.setNextPC(PC + sizeof(MachInst));*/
}
template <class Impl>
diff --git a/cpu/ozone/cpu.hh b/cpu/ozone/cpu.hh
index 667e2b3f8..f5d84d656 100644
--- a/cpu/ozone/cpu.hh
+++ b/cpu/ozone/cpu.hh
@@ -517,7 +517,7 @@ class OoOCPU : public BaseCPU
int readIntrFlag() { return xc->readIntrFlag(); }
void setIntrFlag(int val) { xc->setIntrFlag(val); }
bool inPalMode() { return xc->inPalMode(); }
- void ev5_trap(Fault fault) { xc->ev5_trap(fault); }
+ void trap(Fault fault) { fault->invoke(xc); }
bool simPalCheck(int palFunc) { return xc->simPalCheck(palFunc); }
#else
void syscall() { xc->syscall(); }
diff --git a/cpu/simple/cpu.cc b/cpu/simple/cpu.cc
index ca5d54694..b547e9432 100644
--- a/cpu/simple/cpu.cc
+++ b/cpu/simple/cpu.cc
@@ -688,7 +688,7 @@ SimpleCPU::tick()
if (ipl && ipl > xc->readMiscReg(IPR_IPLR)) {
xc->setMiscReg(IPR_ISR, summary);
xc->setMiscReg(IPR_INTID, ipl);
- (new InterruptFault)->ev5_trap(xc);
+ Fault(new InterruptFault)->invoke(xc);
DPRINTF(Flow, "Interrupt! IPLR=%d ipl=%d summary=%x\n",
xc->readMiscReg(IPR_IPLR), ipl, summary);
@@ -812,7 +812,7 @@ SimpleCPU::tick()
if (fault != NoFault) {
#if FULL_SYSTEM
- fault->ev5_trap(xc);
+ fault->invoke(xc);
#else // !FULL_SYSTEM
fatal("fault (%d) detected @ PC 0x%08p", fault, xc->regs.pc);
#endif // FULL_SYSTEM
diff --git a/cpu/simple/cpu.hh b/cpu/simple/cpu.hh
index 243172821..0b8d84e53 100644
--- a/cpu/simple/cpu.hh
+++ b/cpu/simple/cpu.hh
@@ -347,7 +347,7 @@ class SimpleCPU : public BaseCPU
int readIntrFlag() { return xc->readIntrFlag(); }
void setIntrFlag(int val) { xc->setIntrFlag(val); }
bool inPalMode() { return xc->inPalMode(); }
- void ev5_trap(Fault fault) { fault->ev5_trap(xc); }
+ void trap(Fault fault) { fault->invoke(xc); }
bool simPalCheck(int palFunc) { return xc->simPalCheck(palFunc); }
#else
void syscall() { xc->syscall(); }
diff --git a/kern/tru64/tru64.hh b/kern/tru64/tru64.hh
index ad568cb0c..9c541ae1a 100644
--- a/kern/tru64/tru64.hh
+++ b/kern/tru64/tru64.hh
@@ -155,15 +155,16 @@ class Tru64 {
/// implementing another set of stat functions using the old
/// structure definition and binding them to the old syscall
/// numbers.
+
struct pre_F64_stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
- uid_t st_uid;
+ uid_t st_uid __attribute__ ((aligned(sizeof(uid_t))));
gid_t st_gid;
dev_t st_rdev;
- off_t st_size;
+ off_t st_size __attribute__ ((aligned(sizeof(off_t))));
time_t st_atimeX;
int32_t st_uatime;
time_t st_mtimeX;
diff --git a/sim/faults.cc b/sim/faults.cc
index 78bfc8092..9b4a0ea7f 100644
--- a/sim/faults.cc
+++ b/sim/faults.cc
@@ -27,7 +27,11 @@
*/
#include "sim/faults.hh"
+#include "cpu/exec_context.hh"
-FaultName MachineCheckFault::_name = "mchk";
-FaultName AlignmentFault::_name = "unalign";
-
+#if !FULL_SYSTEM
+void FaultBase::invoke(ExecContext * xc)
+{
+ fatal("fault (%s) detected @ PC 0x%08p", name(), xc->readPC());
+}
+#endif
diff --git a/sim/faults.hh b/sim/faults.hh
index 9b8c94cda..9e8d224cd 100644
--- a/sim/faults.hh
+++ b/sim/faults.hh
@@ -53,39 +53,16 @@ class FaultBase : public RefCounted
virtual FaultName name() = 0;
virtual FaultStat & stat() = 0;
#if FULL_SYSTEM
- virtual void ev5_trap(ExecContext * xc) = 0;
+ virtual void invoke(ExecContext * xc) = 0;
+#else
+ virtual void invoke(ExecContext * xc);
#endif
- template<typename T>
- bool isA() {return dynamic_cast<T *>(this);}
+// template<typename T>
+// bool isA() {return dynamic_cast<T *>(this);}
virtual bool isMachineCheckFault() {return false;}
virtual bool isAlignmentFault() {return false;}
};
FaultBase * const NoFault = 0;
-//The ISAs are each responsible for providing a genMachineCheckFault and a
-//genAlignmentFault functions, which return faults to use in the case of a
-//machine check fault or an alignment fault, respectively. Base classes which
-//provide the name() function, and the isMachineCheckFault and isAlignmentFault
-//functions are provided below.
-
-class MachineCheckFault : public virtual FaultBase
-{
- private:
- static FaultName _name;
- public:
- FaultName name() {return _name;}
- bool isMachineCheckFault() {return true;}
-};
-
-class AlignmentFault : public virtual FaultBase
-{
- private:
- static FaultName _name;
- public:
- FaultName name() {return _name;}
- bool isAlignmentFault() {return true;}
-};
-
-
#endif // __FAULTS_HH__
diff --git a/sim/process.cc b/sim/process.cc
index e3cae2855..fddd9a0b9 100644
--- a/sim/process.cc
+++ b/sim/process.cc
@@ -48,8 +48,7 @@
#include "sim/stats.hh"
#include "sim/syscall_emul.hh"
-#include "arch/tru64_process.hh"
-#include "arch/linux_process.hh"
+#include "arch/process.hh"
using namespace std;
using namespace TheISA;
@@ -376,27 +375,10 @@ LiveProcess::create(const string &nm,
fatal("Can't load object file %s", executable);
}
- // check object type & set up syscall emulation pointer
- if (objFile->getArch() == ObjectFile::Alpha) {
- switch (objFile->getOpSys()) {
- case ObjectFile::Tru64:
- process = new AlphaTru64Process(nm, objFile,
- stdin_fd, stdout_fd, stderr_fd,
- argv, envp);
- break;
-
- case ObjectFile::Linux:
- process = new AlphaLinuxProcess(nm, objFile,
- stdin_fd, stdout_fd, stderr_fd,
- argv, envp);
- break;
-
- default:
- fatal("Unknown/unsupported operating system.");
- }
- } else {
- fatal("Unknown object file architecture.");
- }
+ // set up syscall emulation pointer for the current ISA
+ process = createProcess(nm, objFile,
+ stdin_fd, stdout_fd, stderr_fd,
+ argv, envp);
delete objFile;