gem5 will panic if it encounters a trap it doesn't know what to do with.
Newer versions of glibc, gcc, etc., use the getcontext trap in setjmp
during startup.
This change hooks up a function for both the getcontext and setcontext
traps. The getcontext one just warns that it isn't implemented. If the
context it creates is never used (likely) then that should be fine for
now. If we ever try to actually use a context with setcontext, then
something bad will almost certainly happen if it's not implemented, and
we panic.
Change-Id: Id6797ac6955249d299e975c9c30360920d380e60
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26825
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
syscallDescs.get(tc->readIntReg(1))->doSyscall(tc, fault);
}
+void
+Sparc64LinuxProcess::getContext(ThreadContext *tc)
+{
+ warn("The getcontext trap is not implemented on SPARC");
+}
+
+void
+Sparc64LinuxProcess::setContext(ThreadContext *tc)
+{
+ panic("The setcontext trap is not implemented on SPARC");
+}
+
void
Sparc64LinuxProcess::handleTrap(int trapNum, ThreadContext *tc, Fault *fault)
{
case 0x6d: // Linux 64 bit syscall trap
tc->syscall(fault);
break;
+ case 0x6e: // Linux 64 bit getcontext trap
+ getContext(tc);
+ break;
+ case 0x6f: // Linux 64 bit setcontext trap
+ setContext(tc);
+ break;
default:
SparcProcess::handleTrap(trapNum, tc, fault);
}
void syscall(ThreadContext *tc, Fault *fault) override;
+ void getContext(ThreadContext *tc);
+ void setContext(ThreadContext *tc);
+
void handleTrap(int trapNum, ThreadContext *tc, Fault *fault) override;
};