From 82a228bd4348f2788151630fab0160acc368b4ff Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 25 May 2012 00:53:37 -0700 Subject: Decode: Make the Decoder class defined per ISA. --HG-- rename : src/cpu/decode.cc => src/arch/generic/decoder.cc rename : src/cpu/decode.hh => src/arch/generic/decoder.hh --- src/arch/SConscript | 1 + src/arch/alpha/decoder.hh | 44 +++++++++++++++++++++++ src/arch/alpha/remote_gdb.cc | 2 +- src/arch/arm/decoder.hh | 44 +++++++++++++++++++++++ src/arch/arm/remote_gdb.cc | 2 +- src/arch/generic/SConscript | 31 ++++++++++++++++ src/arch/generic/decoder.cc | 38 ++++++++++++++++++++ src/arch/generic/decoder.hh | 64 +++++++++++++++++++++++++++++++++ src/arch/mips/decoder.hh | 44 +++++++++++++++++++++++ src/arch/mips/remote_gdb.cc | 2 +- src/arch/power/decoder.hh | 44 +++++++++++++++++++++++ src/arch/sparc/decoder.hh | 44 +++++++++++++++++++++++ src/arch/x86/decoder.hh | 44 +++++++++++++++++++++++ src/cpu/SConscript | 1 - src/cpu/checker/thread_context.hh | 3 +- src/cpu/decode.cc | 33 ----------------- src/cpu/decode.hh | 59 ------------------------------ src/cpu/inorder/cpu.cc | 2 +- src/cpu/inorder/cpu.hh | 2 +- src/cpu/inorder/resources/fetch_unit.hh | 4 +-- src/cpu/inorder/thread_context.hh | 2 +- src/cpu/legiontrace.cc | 2 +- src/cpu/o3/fetch.hh | 4 +-- src/cpu/o3/thread_context.hh | 2 +- src/cpu/simple/base.hh | 2 +- src/cpu/simple_thread.hh | 6 ++-- src/cpu/thread_context.hh | 6 ++-- 27 files changed, 419 insertions(+), 113 deletions(-) create mode 100644 src/arch/alpha/decoder.hh create mode 100644 src/arch/arm/decoder.hh create mode 100644 src/arch/generic/SConscript create mode 100644 src/arch/generic/decoder.cc create mode 100644 src/arch/generic/decoder.hh create mode 100644 src/arch/mips/decoder.hh create mode 100644 src/arch/power/decoder.hh create mode 100644 src/arch/sparc/decoder.hh create mode 100644 src/arch/x86/decoder.hh delete mode 100644 src/cpu/decode.cc delete mode 100644 src/cpu/decode.hh (limited to 'src') diff --git a/src/arch/SConscript b/src/arch/SConscript index d423fe9ea..f271f487f 100644 --- a/src/arch/SConscript +++ b/src/arch/SConscript @@ -44,6 +44,7 @@ Import('*') # List of headers to generate isa_switch_hdrs = Split(''' + decoder.hh interrupts.hh isa.hh isa_traits.hh diff --git a/src/arch/alpha/decoder.hh b/src/arch/alpha/decoder.hh new file mode 100644 index 000000000..77a165ad7 --- /dev/null +++ b/src/arch/alpha/decoder.hh @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2012 Google + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __ARCH_ALPHA_DECODER_HH__ +#define __ARCH_ALPHA_DECODER_HH__ + +#include "arch/generic/decoder.hh" + +namespace AlphaISA +{ + +class Decoder : public GenericISA::Decoder +{}; + +} // namespace AlphaISA + +#endif // __ARCH_ALPHA_DECODER_HH__ diff --git a/src/arch/alpha/remote_gdb.cc b/src/arch/alpha/remote_gdb.cc index 8e742c38b..21464fda4 100644 --- a/src/arch/alpha/remote_gdb.cc +++ b/src/arch/alpha/remote_gdb.cc @@ -122,6 +122,7 @@ #include +#include "arch/alpha/decoder.hh" #include "arch/alpha/kgdb.h" #include "arch/alpha/regredir.hh" #include "arch/alpha/remote_gdb.hh" @@ -131,7 +132,6 @@ #include "base/remote_gdb.hh" #include "base/socket.hh" #include "base/trace.hh" -#include "cpu/decode.hh" #include "cpu/static_inst.hh" #include "cpu/thread_context.hh" #include "debug/GDBAcc.hh" diff --git a/src/arch/arm/decoder.hh b/src/arch/arm/decoder.hh new file mode 100644 index 000000000..5525b4a89 --- /dev/null +++ b/src/arch/arm/decoder.hh @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2012 Google + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __ARCH_ARM_DECODER_HH__ +#define __ARCH_ARM_DECODER_HH__ + +#include "arch/generic/decoder.hh" + +namespace ArmISA +{ + +class Decoder : public GenericISA::Decoder +{}; + +} // namespace ArmISA + +#endif // __ARCH_ARM_DECODER_HH__ diff --git a/src/arch/arm/remote_gdb.cc b/src/arch/arm/remote_gdb.cc index 528e19acf..37a46b052 100644 --- a/src/arch/arm/remote_gdb.cc +++ b/src/arch/arm/remote_gdb.cc @@ -134,6 +134,7 @@ #include +#include "arch/arm/decoder.hh" #include "arch/arm/pagetable.hh" #include "arch/arm/registers.hh" #include "arch/arm/remote_gdb.hh" @@ -143,7 +144,6 @@ #include "base/remote_gdb.hh" #include "base/socket.hh" #include "base/trace.hh" -#include "cpu/decode.hh" #include "cpu/static_inst.hh" #include "cpu/thread_context.hh" #include "cpu/thread_state.hh" diff --git a/src/arch/generic/SConscript b/src/arch/generic/SConscript new file mode 100644 index 000000000..70795e3b2 --- /dev/null +++ b/src/arch/generic/SConscript @@ -0,0 +1,31 @@ +# Copyright (c) 2012 Google +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Authors: Gabe Black + +Import('*') + +Source('decoder.cc') diff --git a/src/arch/generic/decoder.cc b/src/arch/generic/decoder.cc new file mode 100644 index 000000000..46ad0cf95 --- /dev/null +++ b/src/arch/generic/decoder.cc @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011 Google + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#include "arch/generic/decoder.hh" + +namespace GenericISA +{ + +DecodeCache Decoder::defaultCache; + +} diff --git a/src/arch/generic/decoder.hh b/src/arch/generic/decoder.hh new file mode 100644 index 000000000..fb880d54d --- /dev/null +++ b/src/arch/generic/decoder.hh @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2011-2012 Google + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __ARCH_GENERIC_DECODER_HH__ +#define __ARCH_GENERIC_DECODER_HH__ + +#include "arch/isa_traits.hh" +#include "arch/types.hh" +#include "config/the_isa.hh" +#include "cpu/decode_cache.hh" +#include "cpu/static_inst.hh" + +namespace GenericISA +{ + +/// The decoder class. This class doesn't do much of anything now, but in the +/// future it will be redefinable per ISA and allow more interesting behavior. +class Decoder +{ + protected: + /// A cache of decoded instruction objects. + static DecodeCache defaultCache; + + public: + /// Decode a machine instruction. + /// @param mach_inst The binary instruction to decode. + /// @retval A pointer to the corresponding StaticInst object. + StaticInstPtr + decode(TheISA::ExtMachInst mach_inst, Addr addr) + { + return defaultCache.decode(mach_inst, addr); + } +}; + +} // namespace GenericISA + +#endif // __ARCH_GENERIC_DECODER_HH__ diff --git a/src/arch/mips/decoder.hh b/src/arch/mips/decoder.hh new file mode 100644 index 000000000..071b188ae --- /dev/null +++ b/src/arch/mips/decoder.hh @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2012 Google + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __ARCH_MIPS_DECODER_HH__ +#define __ARCH_MIPS_DECODER_HH__ + +#include "arch/generic/decoder.hh" + +namespace MipsISA +{ + +class Decoder : public GenericISA::Decoder +{}; + +} // namespace MipsISA + +#endif // __ARCH_MIPS_DECODER_HH__ diff --git a/src/arch/mips/remote_gdb.cc b/src/arch/mips/remote_gdb.cc index 656cb8cbb..c35f532a1 100644 --- a/src/arch/mips/remote_gdb.cc +++ b/src/arch/mips/remote_gdb.cc @@ -135,9 +135,9 @@ #include +#include "arch/mips/decoder.hh" #include "arch/mips/remote_gdb.hh" #include "arch/mips/vtophys.hh" -#include "cpu/decode.hh" #include "cpu/thread_state.hh" #include "debug/GDBAcc.hh" #include "debug/GDBMisc.hh" diff --git a/src/arch/power/decoder.hh b/src/arch/power/decoder.hh new file mode 100644 index 000000000..8fd8bed1a --- /dev/null +++ b/src/arch/power/decoder.hh @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2012 Google + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __ARCH_POWER_DECODER_HH__ +#define __ARCH_POWER_DECODER_HH__ + +#include "arch/generic/decoder.hh" + +namespace PowerISA +{ + +class Decoder : public GenericISA::Decoder +{}; + +} // namespace PowerISA + +#endif // __ARCH_POWER_DECODER_HH__ diff --git a/src/arch/sparc/decoder.hh b/src/arch/sparc/decoder.hh new file mode 100644 index 000000000..0386bd095 --- /dev/null +++ b/src/arch/sparc/decoder.hh @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2012 Google + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __ARCH_SPARC_DECODER_HH__ +#define __ARCH_SPARC_DECODER_HH__ + +#include "arch/generic/decoder.hh" + +namespace SparcISA +{ + +class Decoder : public GenericISA::Decoder +{}; + +} // namespace SparcISA + +#endif // __ARCH_SPARC_DECODER_HH__ diff --git a/src/arch/x86/decoder.hh b/src/arch/x86/decoder.hh new file mode 100644 index 000000000..6c8c122f8 --- /dev/null +++ b/src/arch/x86/decoder.hh @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2012 Google + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __ARCH_X86_DECODER_HH__ +#define __ARCH_X86_DECODER_HH__ + +#include "arch/generic/decoder.hh" + +namespace X86ISA +{ + +class Decoder : public GenericISA::Decoder +{}; + +} // namespace X86ISA + +#endif // __ARCH_X86_DECODER_HH__ diff --git a/src/cpu/SConscript b/src/cpu/SConscript index 922a2d9d7..e1ba59b8b 100644 --- a/src/cpu/SConscript +++ b/src/cpu/SConscript @@ -108,7 +108,6 @@ SimObject('NativeTrace.py') Source('activity.cc') Source('base.cc') Source('cpuevent.cc') -Source('decode.cc') Source('exetrace.cc') Source('func_unit.cc') Source('inteltrace.cc') diff --git a/src/cpu/checker/thread_context.hh b/src/cpu/checker/thread_context.hh index 710d827cc..0da73a137 100644 --- a/src/cpu/checker/thread_context.hh +++ b/src/cpu/checker/thread_context.hh @@ -55,6 +55,7 @@ namespace TheISA { namespace Kernel { class Statistics; }; + class Decoder; }; /** @@ -117,7 +118,7 @@ class CheckerThreadContext : public ThreadContext return checkerCPU; } - Decoder *getDecoderPtr() { return actualTC->getDecoderPtr(); } + TheISA::Decoder *getDecoderPtr() { return actualTC->getDecoderPtr(); } System *getSystemPtr() { return actualTC->getSystemPtr(); } diff --git a/src/cpu/decode.cc b/src/cpu/decode.cc deleted file mode 100644 index 56a484b07..000000000 --- a/src/cpu/decode.cc +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2011 Google - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Gabe Black - */ - -#include "cpu/decode.hh" - -DecodeCache Decoder::cache; diff --git a/src/cpu/decode.hh b/src/cpu/decode.hh deleted file mode 100644 index 653f8eea5..000000000 --- a/src/cpu/decode.hh +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2011 Google - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Gabe Black - */ - -#ifndef __CPU_DECODE_HH__ -#define __CPU_DECODE_HH__ - -#include "arch/isa_traits.hh" -#include "arch/types.hh" -#include "config/the_isa.hh" -#include "cpu/decode_cache.hh" -#include "cpu/static_inst.hh" - -/// The decoder class. This class doesn't do much of anything now, but in the -/// future it will be redefinable per ISA and allow more interesting behavior. -class Decoder -{ - protected: - /// A cache of decoded instruction objects. - static DecodeCache cache; - - public: - /// Decode a machine instruction. - /// @param mach_inst The binary instruction to decode. - /// @retval A pointer to the corresponding StaticInst object. - StaticInstPtr - decode(TheISA::ExtMachInst mach_inst, Addr addr) - { - return cache.decode(mach_inst, addr); - } -}; - -#endif // __CPU_DECODE_HH__ diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc index 7e75dfbb8..9ad0a2680 100644 --- a/src/cpu/inorder/cpu.cc +++ b/src/cpu/inorder/cpu.cc @@ -1772,7 +1772,7 @@ InOrderCPU::getDTBPtr() return resPool->getDataUnit()->tlb(); } -Decoder * +TheISA::Decoder * InOrderCPU::getDecoderPtr() { return &resPool->getInstUnit()->decoder; diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh index bb52c6023..29fe6bc3b 100644 --- a/src/cpu/inorder/cpu.hh +++ b/src/cpu/inorder/cpu.hh @@ -342,7 +342,7 @@ class InOrderCPU : public BaseCPU TheISA::TLB *getITBPtr(); TheISA::TLB *getDTBPtr(); - Decoder *getDecoderPtr(); + TheISA::Decoder *getDecoderPtr(); /** Accessor Type for the SkedCache */ typedef uint32_t SkedID; diff --git a/src/cpu/inorder/resources/fetch_unit.hh b/src/cpu/inorder/resources/fetch_unit.hh index 6d734d7e6..eb99cd570 100644 --- a/src/cpu/inorder/resources/fetch_unit.hh +++ b/src/cpu/inorder/resources/fetch_unit.hh @@ -36,10 +36,10 @@ #include #include +#include "arch/decoder.hh" #include "arch/predecoder.hh" #include "arch/tlb.hh" #include "config/the_isa.hh" -#include "cpu/decode.hh" #include "cpu/inorder/resources/cache_unit.hh" #include "cpu/inorder/inorder_dyn_inst.hh" #include "cpu/inorder/pipeline_traits.hh" @@ -89,7 +89,7 @@ class FetchUnit : public CacheUnit void trap(Fault fault, ThreadID tid, DynInstPtr inst); - Decoder decoder; + TheISA::Decoder decoder; private: void squashCacheRequest(CacheReqPtr req_ptr); diff --git a/src/cpu/inorder/thread_context.hh b/src/cpu/inorder/thread_context.hh index 6f9bc5dac..b7d0dda9c 100644 --- a/src/cpu/inorder/thread_context.hh +++ b/src/cpu/inorder/thread_context.hh @@ -83,7 +83,7 @@ class InOrderThreadContext : public ThreadContext */ CheckerCPU *getCheckerCpuPtr() { return NULL; } - Decoder *getDecoderPtr() { return cpu->getDecoderPtr(); } + TheISA::Decoder *getDecoderPtr() { return cpu->getDecoderPtr(); } System *getSystemPtr() { return cpu->system; } diff --git a/src/cpu/legiontrace.cc b/src/cpu/legiontrace.cc index 75d30c894..34c732c54 100644 --- a/src/cpu/legiontrace.cc +++ b/src/cpu/legiontrace.cc @@ -42,13 +42,13 @@ #include #include +#include "arch/sparc/decoder.hh" #include "arch/sparc/predecoder.hh" #include "arch/sparc/registers.hh" #include "arch/sparc/utility.hh" #include "arch/tlb.hh" #include "base/socket.hh" #include "cpu/base.hh" -#include "cpu/decode.hh" #include "cpu/legiontrace.hh" #include "cpu/static_inst.hh" #include "cpu/thread_context.hh" diff --git a/src/cpu/o3/fetch.hh b/src/cpu/o3/fetch.hh index b61ae2c7b..474834889 100644 --- a/src/cpu/o3/fetch.hh +++ b/src/cpu/o3/fetch.hh @@ -44,11 +44,11 @@ #ifndef __CPU_O3_FETCH_HH__ #define __CPU_O3_FETCH_HH__ +#include "arch/decoder.hh" #include "arch/predecoder.hh" #include "arch/utility.hh" #include "base/statistics.hh" #include "config/the_isa.hh" -#include "cpu/decode.hh" #include "cpu/pc_event.hh" #include "cpu/timebuf.hh" #include "cpu/translation.hh" @@ -340,7 +340,7 @@ class DefaultFetch } /** The decoder. */ - Decoder decoder; + TheISA::Decoder decoder; private: DynInstPtr buildInst(ThreadID tid, StaticInstPtr staticInst, diff --git a/src/cpu/o3/thread_context.hh b/src/cpu/o3/thread_context.hh index 178a344f9..b4108e25c 100755 --- a/src/cpu/o3/thread_context.hh +++ b/src/cpu/o3/thread_context.hh @@ -85,7 +85,7 @@ class O3ThreadContext : public ThreadContext CheckerCPU *getCheckerCpuPtr() { return NULL; } - Decoder *getDecoderPtr() { return &cpu->fetch.decoder; } + TheISA::Decoder *getDecoderPtr() { return &cpu->fetch.decoder; } /** Returns a pointer to this CPU. */ virtual BaseCPU *getCpuPtr() { return cpu; } diff --git a/src/cpu/simple/base.hh b/src/cpu/simple/base.hh index 67fbccf98..34b039fc0 100644 --- a/src/cpu/simple/base.hh +++ b/src/cpu/simple/base.hh @@ -45,12 +45,12 @@ #ifndef __CPU_SIMPLE_BASE_HH__ #define __CPU_SIMPLE_BASE_HH__ +#include "arch/decoder.hh" #include "arch/predecoder.hh" #include "base/statistics.hh" #include "config/the_isa.hh" #include "cpu/base.hh" #include "cpu/checker/cpu.hh" -#include "cpu/decode.hh" #include "cpu/pc_event.hh" #include "cpu/simple_thread.hh" #include "cpu/static_inst.hh" diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh index b1b8a66e4..1595551fb 100644 --- a/src/cpu/simple_thread.hh +++ b/src/cpu/simple_thread.hh @@ -44,6 +44,7 @@ #ifndef __CPU_SIMPLE_THREAD_HH__ #define __CPU_SIMPLE_THREAD_HH__ +#include "arch/decoder.hh" #include "arch/isa.hh" #include "arch/isa_traits.hh" #include "arch/registers.hh" @@ -51,7 +52,6 @@ #include "arch/types.hh" #include "base/types.hh" #include "config/the_isa.hh" -#include "cpu/decode.hh" #include "cpu/thread_context.hh" #include "cpu/thread_state.hh" #include "debug/FloatRegs.hh" @@ -128,7 +128,7 @@ class SimpleThread : public ThreadState TheISA::TLB *itb; TheISA::TLB *dtb; - Decoder decoder; + TheISA::Decoder decoder; // constructor: initialize SimpleThread from given process structure // FS @@ -199,7 +199,7 @@ class SimpleThread : public ThreadState CheckerCPU *getCheckerCpuPtr() { return NULL; } - Decoder *getDecoderPtr() { return &decoder; } + TheISA::Decoder *getDecoderPtr() { return &decoder; } System *getSystemPtr() { return system; } diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh index 220c6cfc5..e186e2f83 100644 --- a/src/cpu/thread_context.hh +++ b/src/cpu/thread_context.hh @@ -55,12 +55,12 @@ // DTB pointers. namespace TheISA { + class Decoder; class TLB; } class BaseCPU; class CheckerCPU; class Checkpoint; -class Decoder; class EndQuiesceEvent; class SETranslatingPortProxy; class FSTranslatingPortProxy; @@ -135,7 +135,7 @@ class ThreadContext virtual CheckerCPU *getCheckerCpuPtr() = 0; - virtual Decoder *getDecoderPtr() = 0; + virtual TheISA::Decoder *getDecoderPtr() = 0; virtual System *getSystemPtr() = 0; @@ -306,7 +306,7 @@ class ProxyThreadContext : public ThreadContext CheckerCPU *getCheckerCpuPtr() { return actualTC->getCheckerCpuPtr(); } - Decoder *getDecoderPtr() { return actualTC->getDecoderPtr(); } + TheISA::Decoder *getDecoderPtr() { return actualTC->getDecoderPtr(); } System *getSystemPtr() { return actualTC->getSystemPtr(); } -- cgit v1.2.3