arch, cpu: Add a takeOverFrom method for switching ISAs

This will be used by architectures to handle the m5.switchCpus at the
ISA level since some ISA specific fields might need to be aware of the
TC change.

Change-Id: If8d50c5c80bc3458d5f1d14cf93ae107314c98cf
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27712
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2020-04-07 13:57:13 +01:00
parent d30068d538
commit b4f9e0a02f
3 changed files with 24 additions and 0 deletions

View File

@@ -1,4 +1,16 @@
/*
* Copyright (c) 2020 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
* not be construed as granting a license to any other intellectual
* property including but not limited to intellectual property relating
* to a hardware implementation of the functionality of the software
* licensed hereunder. You may use the software subject to the license
* terms below provided that you ensure that this notice is replicated
* unmodified and in its entirety in all distributions of the software,
* modified or unmodified, in source code or in binary form.
*
* Copyright 2020 Google Inc.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,10 +42,17 @@
#include "sim/sim_object.hh"
class ThreadContext;
class BaseISA : public SimObject
{
protected:
using SimObject::SimObject;
public:
virtual void
takeOverFrom(ThreadContext *new_tc, ThreadContext *old_tc)
{}
};
#endif // __ARCH_GENERIC_ISA_HH__

View File

@@ -69,6 +69,9 @@ void
O3ThreadContext<Impl>::takeOverFrom(ThreadContext *old_context)
{
::takeOverFrom(*this, *old_context);
this->getIsaPtr()->takeOverFrom(this, old_context);
TheISA::Decoder *newDecoder = getDecoderPtr();
TheISA::Decoder *oldDecoder = old_context->getDecoderPtr();
newDecoder->takeOverFrom(oldDecoder);

View File

@@ -121,6 +121,8 @@ SimpleThread::takeOverFrom(ThreadContext *oldContext)
::takeOverFrom(*this, *oldContext);
decoder.takeOverFrom(oldContext->getDecoderPtr());
isa->takeOverFrom(this, oldContext);
kernelStats = oldContext->getKernelStats();
funcExeInst = oldContext->readFuncExeInst();
storeCondFailures = 0;