ARM: Hook in the mmap2 system call. Make ArmLinuxProcess handle 5,6 syscall params.

This commit is contained in:
Gabe Black 2009-06-09 23:41:45 -07:00
parent c913c64be2
commit b394242240
2 changed files with 22 additions and 1 deletions

View file

@ -255,7 +255,7 @@ SyscallDesc ArmLinuxProcess::syscallDescs[] = {
/* 189 */ SyscallDesc("putpmsg", unimplementedFunc),
/* 190 */ SyscallDesc("vfork", unimplementedFunc),
/* 191 */ SyscallDesc("getrlimit", unimplementedFunc),
/* 192 */ SyscallDesc("mmap2", unimplementedFunc),
/* 192 */ SyscallDesc("mmap2", mmapFunc<ArmLinux>),
/* 193 */ SyscallDesc("truncate64", unimplementedFunc),
/* 194 */ SyscallDesc("ftruncate64", unimplementedFunc),
/* 195 */ SyscallDesc("stat64", unimplementedFunc),
@ -509,3 +509,21 @@ ArmLinuxProcess::startup()
};
tc->getMemPort()->writeBlob(commPage + 0x0fe0, get_tls, sizeof(get_tls));
}
ArmISA::IntReg
ArmLinuxProcess::getSyscallArg(ThreadContext *tc, int i)
{
// Linux apparently allows more parameter than the ABI says it should.
// This limit may need to be increased even further.
assert(i < 6);
return tc->readIntReg(ArgumentReg0 + i);
}
void
ArmLinuxProcess::setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val)
{
// Linux apparently allows more parameter than the ABI says it should.
// This limit may need to be increased even further.
assert(i < 6);
tc->setIntReg(ArgumentReg0 + i, val);
}

View file

@ -44,6 +44,9 @@ class ArmLinuxProcess : public ArmLiveProcess
void startup();
ArmISA::IntReg getSyscallArg(ThreadContext *tc, int i);
void setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val);
/// The target system's hostname.
static const char *hostname;