2010-06-02 19:58:16 +02:00
|
|
|
/*
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
* Copyright (c) 2010-2013 ARM Limited
|
2010-06-02 19:58:16 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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: Ali Saidi
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
* Giacomo Gabrielli
|
2010-06-02 19:58:16 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ARCH_ARM_TABLE_WALKER_HH__
|
|
|
|
#define __ARCH_ARM_TABLE_WALKER_HH__
|
|
|
|
|
2010-08-23 18:18:39 +02:00
|
|
|
#include <list>
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
#include "arch/arm/miscregs.hh"
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
#include "arch/arm/system.hh"
|
2010-06-02 19:58:16 +02:00
|
|
|
#include "arch/arm/tlb.hh"
|
2012-05-23 15:15:45 +02:00
|
|
|
#include "dev/dma_device.hh"
|
2010-06-02 19:58:16 +02:00
|
|
|
#include "mem/mem_object.hh"
|
|
|
|
#include "mem/request.hh"
|
|
|
|
#include "params/ArmTableWalker.hh"
|
|
|
|
#include "sim/eventq.hh"
|
2011-02-04 06:47:58 +01:00
|
|
|
#include "sim/fault_fwd.hh"
|
2010-06-02 19:58:16 +02:00
|
|
|
|
|
|
|
class ThreadContext;
|
|
|
|
|
|
|
|
namespace ArmISA {
|
|
|
|
class Translation;
|
|
|
|
class TLB;
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
class Stage2MMU;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
|
|
|
class TableWalker : public MemObject
|
|
|
|
{
|
2010-10-01 23:03:27 +02:00
|
|
|
public:
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
class WalkerState;
|
|
|
|
|
|
|
|
class DescriptorBase {
|
|
|
|
public:
|
|
|
|
/** Current lookup level for this descriptor */
|
|
|
|
LookupLevel lookupLevel;
|
|
|
|
|
|
|
|
virtual Addr pfn() const = 0;
|
|
|
|
virtual TlbEntry::DomainType domain() const = 0;
|
|
|
|
virtual bool xn() const = 0;
|
|
|
|
virtual uint8_t ap() const = 0;
|
|
|
|
virtual bool global(WalkerState *currState) const = 0;
|
|
|
|
virtual uint8_t offsetBits() const = 0;
|
|
|
|
virtual bool secure(bool have_security, WalkerState *currState) const = 0;
|
|
|
|
virtual std::string dbgHeader() const = 0;
|
|
|
|
virtual uint64_t getRawData() const = 0;
|
|
|
|
virtual uint8_t texcb() const
|
|
|
|
{
|
|
|
|
panic("texcb() not implemented for this class\n");
|
|
|
|
}
|
|
|
|
virtual bool shareable() const
|
|
|
|
{
|
|
|
|
panic("shareable() not implemented for this class\n");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class L1Descriptor : public DescriptorBase {
|
|
|
|
public:
|
2010-06-02 19:58:16 +02:00
|
|
|
/** Type of page table entry ARM DDI 0406B: B3-8*/
|
|
|
|
enum EntryType {
|
|
|
|
Ignore,
|
|
|
|
PageTable,
|
|
|
|
Section,
|
|
|
|
Reserved
|
|
|
|
};
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** The raw bits of the entry */
|
2010-06-02 19:58:16 +02:00
|
|
|
uint32_t data;
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** This entry has been modified (access flag set) and needs to be
|
|
|
|
* written back to memory */
|
|
|
|
bool _dirty;
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** Default ctor */
|
|
|
|
L1Descriptor()
|
|
|
|
{
|
|
|
|
lookupLevel = L1;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual uint64_t getRawData() const
|
|
|
|
{
|
|
|
|
return (data);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual std::string dbgHeader() const
|
|
|
|
{
|
|
|
|
return "Inserting Section Descriptor into TLB\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual uint8_t offsetBits() const
|
|
|
|
{
|
|
|
|
return 20;
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
EntryType type() const
|
|
|
|
{
|
|
|
|
return (EntryType)(data & 0x3);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Is the page a Supersection (16MB)?*/
|
|
|
|
bool supersection() const
|
|
|
|
{
|
|
|
|
return bits(data, 18);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Return the physcal address of the entry, bits in position*/
|
|
|
|
Addr paddr() const
|
|
|
|
{
|
|
|
|
if (supersection())
|
|
|
|
panic("Super sections not implemented\n");
|
2011-02-12 01:29:35 +01:00
|
|
|
return mbits(data, 31, 20);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
2010-10-01 23:03:27 +02:00
|
|
|
/** Return the physcal address of the entry, bits in position*/
|
|
|
|
Addr paddr(Addr va) const
|
|
|
|
{
|
|
|
|
if (supersection())
|
|
|
|
panic("Super sections not implemented\n");
|
2011-02-12 01:29:35 +01:00
|
|
|
return mbits(data, 31, 20) | mbits(va, 19, 0);
|
2010-10-01 23:03:27 +02:00
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
|
|
|
|
/** Return the physical frame, bits shifted right */
|
|
|
|
Addr pfn() const
|
|
|
|
{
|
|
|
|
if (supersection())
|
|
|
|
panic("Super sections not implemented\n");
|
2011-02-12 01:29:35 +01:00
|
|
|
return bits(data, 31, 20);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Is the translation global (no asid used)? */
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
bool global(WalkerState *currState) const
|
2010-06-02 19:58:16 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
return !bits(data, 17);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Is the translation not allow execution? */
|
|
|
|
bool xn() const
|
|
|
|
{
|
2010-08-23 18:18:41 +02:00
|
|
|
return bits(data, 4);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Three bit access protection flags */
|
|
|
|
uint8_t ap() const
|
|
|
|
{
|
2011-02-12 01:29:35 +01:00
|
|
|
return (bits(data, 15) << 2) | bits(data, 11, 10);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Domain Client/Manager: ARM DDI 0406B: B3-31 */
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TlbEntry::DomainType domain() const
|
2010-06-02 19:58:16 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
return static_cast<TlbEntry::DomainType>(bits(data, 8, 5));
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Address of L2 descriptor if it exists */
|
|
|
|
Addr l2Addr() const
|
|
|
|
{
|
2011-02-12 01:29:35 +01:00
|
|
|
return mbits(data, 31, 10);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** Memory region attributes: ARM DDI 0406B: B3-32.
|
|
|
|
* These bits are largly ignored by M5 and only used to
|
|
|
|
* provide the illusion that the memory system cares about
|
|
|
|
* anything but cachable vs. uncachable.
|
|
|
|
*/
|
2010-06-02 19:58:16 +02:00
|
|
|
uint8_t texcb() const
|
|
|
|
{
|
2011-02-12 01:29:35 +01:00
|
|
|
return bits(data, 2) | bits(data, 3) << 1 | bits(data, 14, 12) << 2;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** If the section is shareable. See texcb() comment. */
|
|
|
|
bool shareable() const
|
|
|
|
{
|
|
|
|
return bits(data, 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Set access flag that this entry has been touched. Mark
|
|
|
|
* the entry as requiring a writeback, in the future.
|
|
|
|
*/
|
|
|
|
void setAp0()
|
|
|
|
{
|
|
|
|
data |= 1 << 10;
|
|
|
|
_dirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** This entry needs to be written back to memory */
|
|
|
|
bool dirty() const
|
|
|
|
{
|
|
|
|
return _dirty;
|
|
|
|
}
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this entry targets the secure physical address
|
|
|
|
* map.
|
|
|
|
*/
|
|
|
|
bool secure(bool have_security, WalkerState *currState) const
|
|
|
|
{
|
|
|
|
if (have_security) {
|
|
|
|
if (type() == PageTable)
|
|
|
|
return !bits(data, 3);
|
|
|
|
else
|
|
|
|
return !bits(data, 19);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2010-06-02 19:58:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Level 2 page table descriptor */
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
class L2Descriptor : public DescriptorBase {
|
|
|
|
public:
|
2010-06-02 19:58:18 +02:00
|
|
|
/** The raw bits of the entry. */
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
uint32_t data;
|
|
|
|
L1Descriptor *l1Parent;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** This entry has been modified (access flag set) and needs to be
|
|
|
|
* written back to memory */
|
|
|
|
bool _dirty;
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** Default ctor */
|
|
|
|
L2Descriptor()
|
|
|
|
{
|
|
|
|
lookupLevel = L2;
|
|
|
|
}
|
|
|
|
|
|
|
|
L2Descriptor(L1Descriptor &parent) : l1Parent(&parent)
|
|
|
|
{
|
|
|
|
lookupLevel = L2;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual uint64_t getRawData() const
|
|
|
|
{
|
|
|
|
return (data);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual std::string dbgHeader() const
|
|
|
|
{
|
|
|
|
return "Inserting L2 Descriptor into TLB\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual TlbEntry::DomainType domain() const
|
|
|
|
{
|
|
|
|
return l1Parent->domain();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool secure(bool have_security, WalkerState *currState) const
|
|
|
|
{
|
|
|
|
return l1Parent->secure(have_security, currState);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual uint8_t offsetBits() const
|
|
|
|
{
|
|
|
|
return large() ? 16 : 12;
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
/** Is the entry invalid */
|
|
|
|
bool invalid() const
|
|
|
|
{
|
2011-02-12 01:29:35 +01:00
|
|
|
return bits(data, 1, 0) == 0;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** What is the size of the mapping? */
|
|
|
|
bool large() const
|
|
|
|
{
|
|
|
|
return bits(data, 1) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Is execution allowed on this mapping? */
|
|
|
|
bool xn() const
|
|
|
|
{
|
|
|
|
return large() ? bits(data, 15) : bits(data, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Is the translation global (no asid used)? */
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
bool global(WalkerState *currState) const
|
2010-06-02 19:58:16 +02:00
|
|
|
{
|
|
|
|
return !bits(data, 11);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Three bit access protection flags */
|
|
|
|
uint8_t ap() const
|
|
|
|
{
|
|
|
|
return bits(data, 5, 4) | (bits(data, 9) << 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Memory region attributes: ARM DDI 0406B: B3-32 */
|
|
|
|
uint8_t texcb() const
|
|
|
|
{
|
|
|
|
return large() ?
|
2011-02-12 01:29:35 +01:00
|
|
|
(bits(data, 2) | (bits(data, 3) << 1) | (bits(data, 14, 12) << 2)) :
|
|
|
|
(bits(data, 2) | (bits(data, 3) << 1) | (bits(data, 8, 6) << 2));
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Return the physical frame, bits shifted right */
|
|
|
|
Addr pfn() const
|
|
|
|
{
|
|
|
|
return large() ? bits(data, 31, 16) : bits(data, 31, 12);
|
|
|
|
}
|
|
|
|
|
2010-10-01 23:03:27 +02:00
|
|
|
/** Return complete physical address given a VA */
|
|
|
|
Addr paddr(Addr va) const
|
|
|
|
{
|
|
|
|
if (large())
|
|
|
|
return mbits(data, 31, 16) | mbits(va, 15, 0);
|
|
|
|
else
|
|
|
|
return mbits(data, 31, 12) | mbits(va, 11, 0);
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** If the section is shareable. See texcb() comment. */
|
|
|
|
bool shareable() const
|
|
|
|
{
|
|
|
|
return bits(data, 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Set access flag that this entry has been touched. Mark
|
|
|
|
* the entry as requiring a writeback, in the future.
|
|
|
|
*/
|
|
|
|
void setAp0()
|
|
|
|
{
|
|
|
|
data |= 1 << 4;
|
|
|
|
_dirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** This entry needs to be written back to memory */
|
|
|
|
bool dirty() const
|
|
|
|
{
|
|
|
|
return _dirty;
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
};
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** Long-descriptor format (LPAE) */
|
|
|
|
class LongDescriptor : public DescriptorBase {
|
|
|
|
public:
|
|
|
|
/** Descriptor type */
|
|
|
|
enum EntryType {
|
|
|
|
Invalid,
|
|
|
|
Table,
|
|
|
|
Block,
|
|
|
|
Page
|
|
|
|
};
|
2012-05-23 15:14:12 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** The raw bits of the entry */
|
|
|
|
uint64_t data;
|
2012-05-23 15:14:12 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** This entry has been modified (access flag set) and needs to be
|
|
|
|
* written back to memory */
|
|
|
|
bool _dirty;
|
2012-05-23 15:14:12 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
virtual uint64_t getRawData() const
|
|
|
|
{
|
|
|
|
return (data);
|
|
|
|
}
|
2012-05-23 15:14:12 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
virtual std::string dbgHeader() const
|
|
|
|
{
|
|
|
|
if (type() == LongDescriptor::Page) {
|
|
|
|
assert(lookupLevel == L3);
|
|
|
|
return "Inserting Page descriptor into TLB\n";
|
|
|
|
} else {
|
|
|
|
assert(lookupLevel < L3);
|
|
|
|
return "Inserting Block descriptor into TLB\n";
|
|
|
|
}
|
|
|
|
}
|
2012-05-23 15:14:12 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/**
|
|
|
|
* Returns true if this entry targets the secure physical address
|
|
|
|
* map.
|
|
|
|
*/
|
|
|
|
bool secure(bool have_security, WalkerState *currState) const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return have_security && (currState->secureLookup && !bits(data, 5));
|
|
|
|
}
|
2012-05-23 15:14:12 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** True if the current lookup is performed in AArch64 state */
|
|
|
|
bool aarch64;
|
2012-05-23 15:14:12 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** True if the granule size is 64 KB (AArch64 only) */
|
|
|
|
bool largeGrain;
|
2012-05-23 15:14:12 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** Width of the granule size in bits */
|
|
|
|
int grainSize;
|
|
|
|
|
|
|
|
/** Return the descriptor type */
|
|
|
|
EntryType type() const
|
|
|
|
{
|
|
|
|
switch (bits(data, 1, 0)) {
|
|
|
|
case 0x1:
|
|
|
|
// In AArch64 blocks are not allowed at L0 for the 4 KB granule
|
|
|
|
// and at L1 for the 64 KB granule
|
|
|
|
if (largeGrain)
|
|
|
|
return lookupLevel == L2 ? Block : Invalid;
|
|
|
|
return lookupLevel == L0 || lookupLevel == L3 ? Invalid : Block;
|
|
|
|
case 0x3:
|
|
|
|
return lookupLevel == L3 ? Page : Table;
|
|
|
|
default:
|
|
|
|
return Invalid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Return the bit width of the page/block offset */
|
|
|
|
uint8_t offsetBits() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
if (largeGrain) {
|
|
|
|
if (type() == Block)
|
|
|
|
return 29 /* 512 MB */;
|
|
|
|
return 16 /* 64 KB */; // type() == Page
|
|
|
|
} else {
|
|
|
|
if (type() == Block)
|
|
|
|
return lookupLevel == L1 ? 30 /* 1 GB */ : 21 /* 2 MB */;
|
|
|
|
return 12 /* 4 KB */; // type() == Page
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Return the physical frame, bits shifted right */
|
|
|
|
Addr pfn() const
|
|
|
|
{
|
|
|
|
if (aarch64)
|
|
|
|
return bits(data, 47, offsetBits());
|
|
|
|
return bits(data, 39, offsetBits());
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Return the complete physical address given a VA */
|
|
|
|
Addr paddr(Addr va) const
|
|
|
|
{
|
|
|
|
int n = offsetBits();
|
|
|
|
if (aarch64)
|
|
|
|
return mbits(data, 47, n) | mbits(va, n - 1, 0);
|
|
|
|
return mbits(data, 39, n) | mbits(va, n - 1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Return the physical address of the entry */
|
|
|
|
Addr paddr() const
|
|
|
|
{
|
|
|
|
if (aarch64)
|
|
|
|
return mbits(data, 47, offsetBits());
|
|
|
|
return mbits(data, 39, offsetBits());
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Return the address of the next page table */
|
|
|
|
Addr nextTableAddr() const
|
|
|
|
{
|
|
|
|
assert(type() == Table);
|
|
|
|
if (aarch64)
|
|
|
|
return mbits(data, 47, grainSize);
|
|
|
|
else
|
|
|
|
return mbits(data, 39, 12);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Return the address of the next descriptor */
|
|
|
|
Addr nextDescAddr(Addr va) const
|
|
|
|
{
|
|
|
|
assert(type() == Table);
|
|
|
|
Addr pa = 0;
|
|
|
|
if (aarch64) {
|
|
|
|
int stride = grainSize - 3;
|
|
|
|
int va_lo = stride * (3 - (lookupLevel + 1)) + grainSize;
|
|
|
|
int va_hi = va_lo + stride - 1;
|
|
|
|
pa = nextTableAddr() | (bits(va, va_hi, va_lo) << 3);
|
|
|
|
} else {
|
|
|
|
if (lookupLevel == L1)
|
|
|
|
pa = nextTableAddr() | (bits(va, 29, 21) << 3);
|
|
|
|
else // lookupLevel == L2
|
|
|
|
pa = nextTableAddr() | (bits(va, 20, 12) << 3);
|
|
|
|
}
|
|
|
|
return pa;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Is execution allowed on this mapping? */
|
|
|
|
bool xn() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return bits(data, 54);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Is privileged execution allowed on this mapping? (LPAE only) */
|
|
|
|
bool pxn() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return bits(data, 53);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Contiguous hint bit. */
|
|
|
|
bool contiguousHint() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return bits(data, 52);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Is the translation global (no asid used)? */
|
|
|
|
bool global(WalkerState *currState) const
|
|
|
|
{
|
|
|
|
assert(currState && (type() == Block || type() == Page));
|
|
|
|
if (!currState->aarch64 && (currState->isSecure &&
|
|
|
|
!currState->secureLookup)) {
|
|
|
|
return false; // ARM ARM issue C B3.6.3
|
|
|
|
} else if (currState->aarch64) {
|
|
|
|
if (currState->el == EL2 || currState->el == EL3) {
|
|
|
|
return true; // By default translations are treated as global
|
|
|
|
// in AArch64 EL2 and EL3
|
|
|
|
} else if (currState->isSecure && !currState->secureLookup) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return !bits(data, 11);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Returns true if the access flag (AF) is set. */
|
|
|
|
bool af() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return bits(data, 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 2-bit shareability field */
|
|
|
|
uint8_t sh() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return bits(data, 9, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 2-bit access protection flags */
|
|
|
|
uint8_t ap() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
// Long descriptors only support the AP[2:1] scheme
|
|
|
|
return bits(data, 7, 6);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Read/write access protection flag */
|
|
|
|
bool rw() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return !bits(data, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** User/privileged level access protection flag */
|
|
|
|
bool user() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return bits(data, 6);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Return the AP bits as compatible with the AP[2:0] format. Utility
|
|
|
|
* function used to simplify the code in the TLB for performing
|
|
|
|
* permission checks. */
|
|
|
|
static uint8_t ap(bool rw, bool user)
|
|
|
|
{
|
|
|
|
return ((!rw) << 2) | (user << 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
TlbEntry::DomainType domain() const
|
|
|
|
{
|
|
|
|
// Long-desc. format only supports Client domain
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return TlbEntry::DomainType::Client;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Attribute index */
|
|
|
|
uint8_t attrIndx() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return bits(data, 4, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Memory attributes, only used by stage 2 translations */
|
|
|
|
uint8_t memAttr() const
|
|
|
|
{
|
|
|
|
assert(type() == Block || type() == Page);
|
|
|
|
return bits(data, 5, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Set access flag that this entry has been touched. Mark the entry as
|
|
|
|
* requiring a writeback, in the future. */
|
|
|
|
void setAf()
|
|
|
|
{
|
|
|
|
data |= 1 << 10;
|
|
|
|
_dirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** This entry needs to be written back to memory */
|
|
|
|
bool dirty() const
|
|
|
|
{
|
|
|
|
return _dirty;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Whether the subsequent levels of lookup are secure */
|
|
|
|
bool secureTable() const
|
|
|
|
{
|
|
|
|
assert(type() == Table);
|
|
|
|
return !bits(data, 63);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Two bit access protection flags for subsequent levels of lookup */
|
|
|
|
uint8_t apTable() const
|
|
|
|
{
|
|
|
|
assert(type() == Table);
|
|
|
|
return bits(data, 62, 61);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** R/W protection flag for subsequent levels of lookup */
|
|
|
|
uint8_t rwTable() const
|
|
|
|
{
|
|
|
|
assert(type() == Table);
|
|
|
|
return !bits(data, 62);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** User/privileged mode protection flag for subsequent levels of
|
|
|
|
* lookup */
|
|
|
|
uint8_t userTable() const
|
|
|
|
{
|
|
|
|
assert(type() == Table);
|
|
|
|
return !bits(data, 61);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Is execution allowed on subsequent lookup levels? */
|
|
|
|
bool xnTable() const
|
|
|
|
{
|
|
|
|
assert(type() == Table);
|
|
|
|
return bits(data, 60);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Is privileged execution allowed on subsequent lookup levels? */
|
|
|
|
bool pxnTable() const
|
|
|
|
{
|
|
|
|
assert(type() == Table);
|
|
|
|
return bits(data, 59);
|
|
|
|
}
|
2012-05-23 15:14:12 +02:00
|
|
|
};
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
class WalkerState
|
2010-06-02 19:58:18 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
public:
|
2010-06-02 19:58:18 +02:00
|
|
|
/** Thread context that we're doing the walk for */
|
|
|
|
ThreadContext *tc;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** If the access is performed in AArch64 state */
|
|
|
|
bool aarch64;
|
|
|
|
|
|
|
|
/** Current exception level */
|
|
|
|
ExceptionLevel el;
|
|
|
|
|
|
|
|
/** Current physical address range in bits */
|
|
|
|
int physAddrRange;
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** Request that is currently being serviced */
|
|
|
|
RequestPtr req;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** ASID that we're servicing the request under */
|
|
|
|
uint16_t asid;
|
|
|
|
uint8_t vmid;
|
|
|
|
bool isHyp;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** Translation state for delayed requests */
|
|
|
|
TLB::Translation *transState;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** The fault that we are going to return */
|
|
|
|
Fault fault;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** The virtual address that is being translated with tagging removed.*/
|
2010-06-02 19:58:18 +02:00
|
|
|
Addr vaddr;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** The virtual address that is being translated */
|
|
|
|
Addr vaddr_tainted;
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** Cached copy of the sctlr as it existed when translation began */
|
|
|
|
SCTLR sctlr;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** Cached copy of the scr as it existed when translation began */
|
|
|
|
SCR scr;
|
|
|
|
|
|
|
|
/** Cached copy of the cpsr as it existed when translation began */
|
|
|
|
CPSR cpsr;
|
|
|
|
|
|
|
|
/** Cached copy of the ttbcr as it existed when translation began. */
|
|
|
|
TTBCR ttbcr;
|
|
|
|
|
|
|
|
/** Cached copy of the htcr as it existed when translation began. */
|
|
|
|
HTCR htcr;
|
|
|
|
|
|
|
|
/** Cached copy of the htcr as it existed when translation began. */
|
|
|
|
HCR hcr;
|
|
|
|
|
|
|
|
/** Cached copy of the vtcr as it existed when translation began. */
|
|
|
|
VTCR_t vtcr;
|
2010-06-02 19:58:18 +02:00
|
|
|
|
|
|
|
/** If the access is a write */
|
|
|
|
bool isWrite;
|
|
|
|
|
|
|
|
/** If the access is a fetch (for execution, and no-exec) must be checked?*/
|
|
|
|
bool isFetch;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** If the access comes from the secure state. */
|
|
|
|
bool isSecure;
|
|
|
|
|
|
|
|
/** Helper variables used to implement hierarchical access permissions
|
|
|
|
* when the long-desc. format is used (LPAE only) */
|
|
|
|
bool secureLookup;
|
|
|
|
bool rwTable;
|
|
|
|
bool userTable;
|
|
|
|
bool xnTable;
|
|
|
|
bool pxnTable;
|
|
|
|
|
|
|
|
/** Flag indicating if a second stage of lookup is required */
|
|
|
|
bool stage2Req;
|
|
|
|
|
|
|
|
/** Indicates whether the translation has been passed onto the second
|
|
|
|
* stage mmu, and no more work is required from the first stage.
|
|
|
|
*/
|
|
|
|
bool doingStage2;
|
|
|
|
|
|
|
|
/** A pointer to the stage 2 translation that's in progress */
|
|
|
|
TLB::Translation *stage2Tran;
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** If the mode is timing or atomic */
|
|
|
|
bool timing;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2012-01-31 16:46:03 +01:00
|
|
|
/** If the atomic mode should be functional */
|
|
|
|
bool functional;
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** Save mode for use in delayed response */
|
|
|
|
BaseTLB::Mode mode;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** The translation type that has been requested */
|
|
|
|
TLB::ArmTranslationType tranType;
|
|
|
|
|
|
|
|
/** Short-format descriptors */
|
2010-06-02 19:58:18 +02:00
|
|
|
L1Descriptor l1Desc;
|
|
|
|
L2Descriptor l2Desc;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** Long-format descriptor (LPAE and AArch64) */
|
|
|
|
LongDescriptor longDesc;
|
|
|
|
|
|
|
|
/** Whether the response is delayed in timing mode due to additional
|
|
|
|
* lookups */
|
2010-06-02 19:58:18 +02:00
|
|
|
bool delayed;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
TableWalker *tableWalker;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
void doL1Descriptor();
|
|
|
|
void doL2Descriptor();
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
void doLongDescriptor();
|
|
|
|
|
|
|
|
WalkerState();
|
|
|
|
|
|
|
|
std::string name() const { return tableWalker->name(); }
|
2010-06-02 19:58:18 +02:00
|
|
|
};
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
protected:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A snooping DMA port that currently does nothing besides
|
|
|
|
* extending the DMA port to accept snoops without complaining.
|
|
|
|
*/
|
|
|
|
class SnoopingDmaPort : public DmaPort
|
|
|
|
{
|
2010-06-02 19:58:18 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
protected:
|
2010-08-26 02:10:43 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
virtual void recvTimingSnoopReq(PacketPtr pkt)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual Tick recvAtomicSnoop(PacketPtr pkt)
|
|
|
|
{ return 0; }
|
|
|
|
|
|
|
|
virtual void recvFunctionalSnoop(PacketPtr pkt)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual bool isSnooping() const { return true; }
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A snooping DMA port merely calls the construtor of the DMA
|
|
|
|
* port.
|
|
|
|
*/
|
|
|
|
SnoopingDmaPort(MemObject *dev, System *s) :
|
|
|
|
DmaPort(dev, s)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Queues of requests for all the different lookup levels */
|
|
|
|
std::list<WalkerState *> stateQueues[MAX_LOOKUP_LEVELS];
|
2010-06-02 19:58:18 +02:00
|
|
|
|
2010-11-08 20:58:24 +01:00
|
|
|
/** Queue of requests that have passed are waiting because the walker is
|
|
|
|
* currently busy. */
|
2012-03-19 11:36:09 +01:00
|
|
|
std::list<WalkerState *> pendingQueue;
|
2010-11-08 20:58:24 +01:00
|
|
|
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** Port to issue translation requests from */
|
2012-05-23 15:14:12 +02:00
|
|
|
SnoopingDmaPort port;
|
2010-06-02 19:58:18 +02:00
|
|
|
|
2012-08-15 16:38:08 +02:00
|
|
|
/** If we're draining keep the drain event around until we're drained */
|
2012-11-02 17:32:01 +01:00
|
|
|
DrainManager *drainManager;
|
2012-08-15 16:38:08 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** The MMU to forward second stage look upts to */
|
|
|
|
Stage2MMU *stage2Mmu;
|
|
|
|
|
|
|
|
/** Indicates whether this table walker is part of the stage 2 mmu */
|
|
|
|
const bool isStage2;
|
|
|
|
|
2010-06-02 19:58:18 +02:00
|
|
|
/** TLB that is initiating these table walks */
|
|
|
|
TLB *tlb;
|
|
|
|
|
|
|
|
/** Cached copy of the sctlr as it existed when translation began */
|
|
|
|
SCTLR sctlr;
|
|
|
|
|
|
|
|
WalkerState *currState;
|
2010-06-02 19:58:18 +02:00
|
|
|
|
2010-11-08 20:58:24 +01:00
|
|
|
/** If a timing translation is currently in progress */
|
|
|
|
bool pending;
|
|
|
|
|
2012-02-12 23:07:38 +01:00
|
|
|
/** Request id for requests generated by this walker */
|
|
|
|
MasterID masterId;
|
|
|
|
|
2012-09-25 18:49:40 +02:00
|
|
|
/** The number of walks belonging to squashed instructions that can be
|
|
|
|
* removed from the pendingQueue per cycle. */
|
|
|
|
unsigned numSquashable;
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/** Cached copies of system-level properties */
|
|
|
|
bool haveSecurity;
|
|
|
|
bool _haveLPAE;
|
|
|
|
bool _haveVirtualization;
|
|
|
|
uint8_t physAddrRange;
|
|
|
|
bool _haveLargeAsid64;
|
|
|
|
ArmSystem *armSys;
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
public:
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
typedef ArmTableWalkerParams Params;
|
2010-06-02 19:58:16 +02:00
|
|
|
TableWalker(const Params *p);
|
|
|
|
virtual ~TableWalker();
|
|
|
|
|
|
|
|
const Params *
|
|
|
|
params() const
|
|
|
|
{
|
|
|
|
return dynamic_cast<const Params *>(_params);
|
|
|
|
}
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
bool haveLPAE() const { return _haveLPAE; }
|
|
|
|
bool haveVirtualization() const { return _haveVirtualization; }
|
|
|
|
bool haveLargeAsid64() const { return _haveLargeAsid64; }
|
2012-08-15 16:38:08 +02:00
|
|
|
/** Checks if all state is cleared and if so, completes drain */
|
|
|
|
void completeDrain();
|
2012-11-02 17:32:01 +01:00
|
|
|
unsigned int drain(DrainManager *dm);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
virtual void drainResume();
|
2012-10-15 14:12:35 +02:00
|
|
|
virtual BaseMasterPort& getMasterPort(const std::string &if_name,
|
|
|
|
PortID idx = InvalidPortID);
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
/**
|
|
|
|
* Allow the MMU (overseeing both stage 1 and stage 2 TLBs) to
|
|
|
|
* access the table walker port through the TLB so that it can
|
|
|
|
* orchestrate staged translations.
|
|
|
|
*
|
|
|
|
* @return Our DMA port
|
|
|
|
*/
|
|
|
|
DmaPort& getWalkerPort() { return port; }
|
|
|
|
|
|
|
|
Fault walk(RequestPtr req, ThreadContext *tc, uint16_t asid, uint8_t _vmid,
|
|
|
|
bool _isHyp, TLB::Mode mode, TLB::Translation *_trans,
|
|
|
|
bool timing, bool functional, bool secure,
|
|
|
|
TLB::ArmTranslationType tranType);
|
2010-06-02 19:58:16 +02:00
|
|
|
|
|
|
|
void setTlb(TLB *_tlb) { tlb = _tlb; }
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TLB* getTlb() { return tlb; }
|
|
|
|
void setMMU(Stage2MMU *m) { stage2Mmu = m; }
|
2010-06-02 19:58:18 +02:00
|
|
|
void memAttrs(ThreadContext *tc, TlbEntry &te, SCTLR sctlr,
|
|
|
|
uint8_t texcb, bool s);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
void memAttrsLPAE(ThreadContext *tc, TlbEntry &te,
|
|
|
|
LongDescriptor &lDescriptor);
|
|
|
|
void memAttrsAArch64(ThreadContext *tc, TlbEntry &te, uint8_t attrIndx,
|
|
|
|
uint8_t sh);
|
|
|
|
|
|
|
|
static LookupLevel toLookupLevel(uint8_t lookup_level_as_int);
|
2010-06-02 19:58:16 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void doL1Descriptor();
|
2010-06-02 19:58:18 +02:00
|
|
|
void doL1DescriptorWrapper();
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
EventWrapper<TableWalker,
|
|
|
|
&TableWalker::doL1DescriptorWrapper> doL1DescEvent;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
|
|
|
void doL2Descriptor();
|
2010-06-02 19:58:18 +02:00
|
|
|
void doL2DescriptorWrapper();
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
EventWrapper<TableWalker,
|
|
|
|
&TableWalker::doL2DescriptorWrapper> doL2DescEvent;
|
|
|
|
|
|
|
|
void doLongDescriptor();
|
|
|
|
|
|
|
|
void doL0LongDescriptorWrapper();
|
|
|
|
EventWrapper<TableWalker,
|
|
|
|
&TableWalker::doL0LongDescriptorWrapper> doL0LongDescEvent;
|
|
|
|
void doL1LongDescriptorWrapper();
|
|
|
|
EventWrapper<TableWalker,
|
|
|
|
&TableWalker::doL1LongDescriptorWrapper> doL1LongDescEvent;
|
|
|
|
void doL2LongDescriptorWrapper();
|
|
|
|
EventWrapper<TableWalker,
|
|
|
|
&TableWalker::doL2LongDescriptorWrapper> doL2LongDescEvent;
|
|
|
|
void doL3LongDescriptorWrapper();
|
|
|
|
EventWrapper<TableWalker,
|
|
|
|
&TableWalker::doL3LongDescriptorWrapper> doL3LongDescEvent;
|
|
|
|
|
|
|
|
void doLongDescriptorWrapper(LookupLevel curr_lookup_level);
|
|
|
|
|
|
|
|
bool fetchDescriptor(Addr descAddr, uint8_t *data, int numBytes,
|
|
|
|
Request::Flags flags, int queueIndex, Event *event,
|
|
|
|
void (TableWalker::*doDescriptor)());
|
|
|
|
|
|
|
|
void insertTableEntry(DescriptorBase &descriptor, bool longDescriptor);
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2010-11-08 20:58:24 +01:00
|
|
|
Fault processWalk();
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
Fault processWalkLPAE();
|
|
|
|
static unsigned adjustTableSizeAArch64(unsigned tsz);
|
|
|
|
/// Returns true if the address exceeds the range permitted by the
|
|
|
|
/// system-wide setting or by the TCR_ELx IPS/PS setting
|
|
|
|
static bool checkAddrSizeFaultAArch64(Addr addr, int currPhysAddrRange);
|
|
|
|
Fault processWalkAArch64();
|
2010-11-08 20:58:24 +01:00
|
|
|
void processWalkWrapper();
|
|
|
|
EventWrapper<TableWalker, &TableWalker::processWalkWrapper> doProcessEvent;
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2010-11-08 20:58:24 +01:00
|
|
|
void nextWalk(ThreadContext *tc);
|
2010-06-02 19:58:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ArmISA
|
|
|
|
|
|
|
|
#endif //__ARCH_ARM_TABLE_WALKER_HH__
|
|
|
|
|