summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2010-06-02 12:58:00 -0500
committerGabe Black <gblack@eecs.umich.edu>2010-06-02 12:58:00 -0500
commit4ddeceba96c5e066d79138709091a6dffec17372 (patch)
tree347a920e1d9216a02955c6833a0d69cee429e0b3
parent3951afd2fa6140f85a94c9636ac2d9e9d3a1c764 (diff)
downloadgem5-4ddeceba96c5e066d79138709091a6dffec17372.tar.xz
ARM: Allow ARM processes to start in Thumb mode.
-rw-r--r--src/arch/arm/linux/process.cc4
-rw-r--r--src/arch/arm/linux/process.hh3
-rw-r--r--src/arch/arm/process.cc7
-rw-r--r--src/arch/arm/process.hh5
-rw-r--r--src/sim/process.cc5
5 files changed, 14 insertions, 10 deletions
diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc
index f909d871a..7a5e9da56 100644
--- a/src/arch/arm/linux/process.cc
+++ b/src/arch/arm/linux/process.cc
@@ -435,8 +435,8 @@ SyscallDesc ArmLinuxProcess::privSyscallDescs[] = {
};
ArmLinuxProcess::ArmLinuxProcess(LiveProcessParams * params,
- ObjectFile *objFile)
- : ArmLiveProcess(params, objFile),
+ ObjectFile *objFile, ObjectFile::Arch _arch)
+ : ArmLiveProcess(params, objFile, _arch),
Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)),
Num_Priv_Syscall_Descs(sizeof(privSyscallDescs) / sizeof(SyscallDesc))
{ }
diff --git a/src/arch/arm/linux/process.hh b/src/arch/arm/linux/process.hh
index ab836fab2..7b9e5789e 100644
--- a/src/arch/arm/linux/process.hh
+++ b/src/arch/arm/linux/process.hh
@@ -38,7 +38,8 @@
class ArmLinuxProcess : public ArmLiveProcess
{
public:
- ArmLinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
+ ArmLinuxProcess(LiveProcessParams * params, ObjectFile *objFile,
+ ObjectFile::Arch _arch);
virtual SyscallDesc* getDesc(int callnum);
diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc
index 702922a43..3c51c80a7 100644
--- a/src/arch/arm/process.cc
+++ b/src/arch/arm/process.cc
@@ -43,8 +43,9 @@
using namespace std;
using namespace ArmISA;
-ArmLiveProcess::ArmLiveProcess(LiveProcessParams *params, ObjectFile *objFile)
- : LiveProcess(params, objFile)
+ArmLiveProcess::ArmLiveProcess(LiveProcessParams *params, ObjectFile *objFile,
+ ObjectFile::Arch _arch)
+ : LiveProcess(params, objFile), arch(_arch)
{
stack_base = 0xbf000000L;
@@ -316,6 +317,8 @@ ArmLiveProcess::argsInit(int intSize, int pageSize)
}
Addr prog_entry = objFile->entryPoint();
+ if (arch == ObjectFile::Thumb)
+ prog_entry = (prog_entry & ~mask(1)) | (ULL(1) << PcTBitShift);
tc->setPC(prog_entry);
tc->setNextPC(prog_entry + sizeof(MachInst));
diff --git a/src/arch/arm/process.hh b/src/arch/arm/process.hh
index f793892d0..a4dd5e842 100644
--- a/src/arch/arm/process.hh
+++ b/src/arch/arm/process.hh
@@ -33,6 +33,7 @@
#include <string>
#include <vector>
+#include "base/loader/object_file.hh"
#include "sim/process.hh"
class LiveProcess;
@@ -42,7 +43,9 @@ class System;
class ArmLiveProcess : public LiveProcess
{
protected:
- ArmLiveProcess(LiveProcessParams * params, ObjectFile *objFile);
+ ObjectFile::Arch arch;
+ ArmLiveProcess(LiveProcessParams * params, ObjectFile *objFile,
+ ObjectFile::Arch _arch);
void startup();
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 18f33abdc..ba4a3905b 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -763,10 +763,7 @@ LiveProcess::create(LiveProcessParams * params)
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
- if (objFile->getArch() == ObjectFile::Thumb)
- panic("Thumb processes not yet supported.\n");
- else
- process = new ArmLinuxProcess(params, objFile);
+ process = new ArmLinuxProcess(params, objFile, objFile->getArch());
break;
case ObjectFile::LinuxArmOABI:
fatal("M5 does not support ARM OABI binaries. Please recompile with an"