changeset 7a74edaa8741 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=7a74edaa8741
description:
X86: Make the loader recognize 32 bit x86 processes.
diffstat:
3 files changed, 13 insertions(+), 7 deletions(-)
src/base/loader/elf_object.cc | 8 ++++----
src/base/loader/object_file.hh | 3 ++-
src/sim/process.cc | 9 +++++++--
diffs (56 lines):
diff -r 67a6ea624776 -r 7a74edaa8741 src/base/loader/elf_object.cc
--- a/src/base/loader/elf_object.cc Sun Feb 15 20:39:12 2009 -0800
+++ b/src/base/loader/elf_object.cc Sun Feb 15 23:43:39 2009 -0800
@@ -89,10 +89,10 @@
}
} else if (ehdr.e_machine == EM_X86_64 &&
ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
- //In the future, we might want to differentiate between 32 bit
- //and 64 bit x86 processes in case there are differences in their
- //initial stack frame.
- arch = ObjectFile::X86;
+ arch = ObjectFile::X86_64;
+ } else if (ehdr.e_machine == EM_386 &&
+ ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
+ arch = ObjectFile::I386;
} else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
arch = ObjectFile::Alpha;
} else if (ehdr.e_machine == EM_ARM) {
diff -r 67a6ea624776 -r 7a74edaa8741 src/base/loader/object_file.hh
--- a/src/base/loader/object_file.hh Sun Feb 15 20:39:12 2009 -0800
+++ b/src/base/loader/object_file.hh Sun Feb 15 23:43:39 2009 -0800
@@ -50,7 +50,8 @@
SPARC64,
SPARC32,
Mips,
- X86,
+ X86_64,
+ I386,
Arm
};
diff -r 67a6ea624776 -r 7a74edaa8741 src/sim/process.cc
--- a/src/sim/process.cc Sun Feb 15 20:39:12 2009 -0800
+++ b/src/sim/process.cc Sun Feb 15 23:43:39 2009 -0800
@@ -708,14 +708,19 @@
fatal("Unknown/unsupported operating system.");
}
#elif THE_ISA == X86_ISA
- if (objFile->getArch() != ObjectFile::X86)
+ if (objFile->getArch() != ObjectFile::X86_64 &&
+ objFile->getArch() != ObjectFile::I386)
fatal("Object file architecture does not match compiled ISA (x86).");
switch (objFile->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
- process = new X86LinuxProcess(params, objFile);
+ if (objFile->getArch() == ObjectFile::X86_64) {
+ process = new X86LinuxProcess(params, objFile);
+ } else {
+ panic("32 bit x86 Linux process aren't implemented.\n");
+ }
break;
default:
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev