From 7c4c623302dca7da95b1c95d4968f4ef76de391d Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 4 Mar 2006 03:09:23 -0500 Subject: Filled out the object file loader so it can load object files for several OSs and architectures. SConscript: Added ./libelf as an include search directory. There might be a better spot for this than where I put it. arch/SConscript: Combined the linux_process.h and tru64_process.h into process.h. This allows each ISA to support processes from arbitrary OSs. arch/alpha/SConscript: Added process.cc as a source file. It provides an implementation of createProcess, which takes an object_file object and creates the appropriate process object, or dies. base/loader/elf_object.cc: Actually extract the OS and architecture from the elf file, rather than always guessing Alpha and Linux. base/loader/object_file.hh: Added constants for SPARC, MIPS, and Solaris, and changed the include for the Addr type. sim/process.cc: Pushed creation of specific process objects into the ISA specific code. --HG-- extra : convert_revision : b4754e7ca8328672d07e1394c4d162e199606b53 --- sim/process.cc | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'sim') 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; -- cgit v1.2.3