summaryrefslogtreecommitdiff
path: root/sim/system.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2003-10-07 23:13:01 -0700
committerSteve Reinhardt <stever@eecs.umich.edu>2003-10-07 23:13:01 -0700
commite475dba424d70e99646f897fae832f87b1cf15cf (patch)
tree04acc02acfc77419aaf80a26e03b4ccf742838cc /sim/system.cc
parent998d2914db377d5236d6241e3c839af1728c36e7 (diff)
downloadgem5-e475dba424d70e99646f897fae832f87b1cf15cf.tar.xz
New loader structure. Expand Nate's ObjectFile to automatically detect file formats
and generate an appropriate child object, which knows how to load its text & data into memory (and symbols, for ecoff only at this point). Ecoff format supports Tru64 binaries, kernel, and console. A.out format is used by PAL code. Elf support is there and appears to work for Alpha/Linux binaries, but awaits a Linux syscall emulation layer before further testing. arch/alpha/ecoff_machdep.h: base/coff_sym.h: base/coff_symconst.h: base/exec_ecoff.h: Add Id string & provenance comment, clean up types base/object_file.cc: base/object_file.hh: Add auto format detection and text/data loading. sim/prog.cc: Moved binary loading & stack setup here (was in arch/alpha/loader.cc). Some of this is platform-dependent, but I think most of it is not. We'll factor out the platform-dependent parts when the need arises. sim/prog.hh: Get rid of unused environ_base field. sim/system.cc: Use new ObjectFile loader structure for console, kernel, & palcode. --HG-- extra : convert_revision : 8eae509bf71cf204bc3ec78c68699cfd01baed97
Diffstat (limited to 'sim/system.cc')
-rw-r--r--sim/system.cc36
1 files changed, 27 insertions, 9 deletions
diff --git a/sim/system.cc b/sim/system.cc
index 04db8b134..0f6dce10c 100644
--- a/sim/system.cc
+++ b/sim/system.cc
@@ -26,7 +26,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "kernel_loader.hh"
#include "exec_context.hh"
#include "object_file.hh"
#include "memory_control.hh"
@@ -68,28 +67,47 @@ System::System(const std::string _name,
kernelSymtab = new SymbolTable;
consoleSymtab = new SymbolTable;
- EcoffObject kernel(kernel_path);
- EcoffObject console(console_path);
+ ObjectFile *kernel = createObjectFile(kernel_path);
+ if (kernel == NULL)
+ fatal("Could not load kernel file %s", kernel_path);
- if (!kernel.loadGlobals(kernelSymtab))
+ ObjectFile *console = createObjectFile(console_path);
+ if (console == NULL)
+ fatal("Could not load console file %s", console_path);
+
+ if (!kernel->loadGlobalSymbols(kernelSymtab))
panic("could not load kernel symbols\n");
- if (!console.loadGlobals(consoleSymtab))
+ if (!console->loadGlobalSymbols(consoleSymtab))
panic("could not load console symbols\n");
// Load pal file
- loadPal(palcode, physmem, PAL_BASE);
+ ObjectFile *pal = createObjectFile(palcode);
+ if (pal == NULL)
+ fatal("Could not load PALcode file %s", palcode);
+ pal->loadSections(physmem, true);
// copy of initial reg file contents
initRegs = new RegFile;
memset(initRegs, 0, sizeof(RegFile));
// Load console file
- loadKernel(console_path, physmem);
+ console->loadSections(physmem, true);
// Load kernel file
- loadKernel(kernel_path, physmem, initRegs,
- &kernelStart, &kernelEnd, &kernelEntry);
+ kernel->loadSections(physmem, true);
+ kernelStart = kernel->textBase();
+ kernelEnd = kernel->bssBase() + kernel->bssSize();
+ kernelEntry = kernel->entryPoint();
+
+ DPRINTF(Loader, "Kernel start = %#x\n"
+ "Kernel end = %#x\n"
+ "Kernel entry = %#x\n",
+ kernelStart, kernelEnd, kernelEntry);
+
+ // Setup kernel boot parameters
+ initRegs->pc = 0x4001;
+ initRegs->npc = initRegs->pc + sizeof(MachInst);
DPRINTF(Loader, "Kernel loaded...\n");