ARM: Allow ARM processes to start in Thumb mode.

This commit is contained in:
Gabe Black 2010-06-02 12:58:00 -05:00
parent 3951afd2fa
commit 4ddeceba96
5 changed files with 14 additions and 10 deletions

View file

@ -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))
{ }

View file

@ -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);

View file

@ -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));

View file

@ -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();

View file

@ -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"